ReactOS 0.4.16-dev-329-g9223134
cardrgndraw.cpp File Reference
#include "cardlib.h"
Include dependency graph for cardrgndraw.cpp:

Go to the source code of this file.

Functions

HPALETTE UseNicePalette (HDC hdc, HPALETTE hPalette)
 
void PaintRect (HDC hdc, RECT *rect, COLORREF colour)
 
void CardBlt (HDC hdc, int x, int y, int nCardNum)
 
void DrawCard (HDC hdc, int x, int y, HDC hdcSource, int width, int height)
 
void DrawHorzCardStrip (HDC hdc, int x, int y, int nCardNum, int height, BOOL fDrawTips)
 
void DrawVertCardStrip (HDC hdc, int x, int y, int nCardNum, int width, BOOL fDrawTips)
 
void DrawCardCorner (HDC hdc, int x, int y, int cardval, int xdir, int ydir)
 
int ClipCard (HDC hdc, int x, int y, int width, int height)
 
int calc_offset (int offset, int numcards, int numtodrag, int realvisible)
 

Function Documentation

◆ calc_offset()

int calc_offset ( int  offset,
int  numcards,
int  numtodrag,
int  realvisible 
)

Definition at line 370 of file cardrgndraw.cpp.

371{
372 if(offset >= 0)
373 return -offset * numcards;
374 else
375 return -offset * (numtodrag) +
376 -offset * (realvisible - 1);
377}
GLintptr offset
Definition: glext.h:5920

Referenced by CardRegion::PrepareDragBitmaps(), and CardRegion::PrepareDragBitmapsThreed().

◆ CardBlt()

void CardBlt ( HDC  hdc,
int  x,
int  y,
int  nCardNum 
)

Definition at line 22 of file cardrgndraw.cpp.

23{
24 int sx = nCardNum * __cardwidth;
25 int sy = 0;
26 int width = __cardwidth;
27 int height = __cardheight;
28
29 //draw main center band
30 BitBlt(hdc, x+2, y, width - 4, height, __hdcCardBitmaps, sx+2, sy+0, SRCCOPY);
31
32 //draw the two bits to the left
33 BitBlt(hdc, x, y+2, 1, height - 4, __hdcCardBitmaps, sx+0, sy+2, SRCCOPY);
34 BitBlt(hdc, x+1, y+1, 1, height - 2, __hdcCardBitmaps, sx+1, sy+1, SRCCOPY);
35
36 //draw the two bits to the right
37 BitBlt(hdc, x+width-2, y+1, 1, height - 2, __hdcCardBitmaps, sx+width-2, sy+1, SRCCOPY);
38 BitBlt(hdc, x+width-1, y+2, 1, height - 4, __hdcCardBitmaps, sx+width-1, sy+2, SRCCOPY);
39}
int __cardwidth
Definition: cardlib.cpp:25
int __cardheight
Definition: cardlib.cpp:26
HDC __hdcCardBitmaps
Definition: cardlib.cpp:18
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
HDC hdc
Definition: main.c:9
#define SRCCOPY
Definition: wingdi.h:333

Referenced by CardRegion::PrepareDragBitmaps(), CardRegion::PrepareDragBitmapsThreed(), and CardRegion::Render().

◆ ClipCard()

int ClipCard ( HDC  hdc,
int  x,
int  y,
int  width,
int  height 
)

Definition at line 198 of file cardrgndraw.cpp.

199{
200 ExcludeClipRect(hdc, x+2, y, x+2+width-4, y+ height);
201 ExcludeClipRect(hdc, x, y+2, x+1, y+2+height-4);
202 ExcludeClipRect(hdc, x+1, y+1, x+2, y+1+height-2);
203 ExcludeClipRect(hdc, x+width-2, y+1, x+width-2+1, y+1+height-2);
204 ExcludeClipRect(hdc, x+width-1, y+2, x+width-1+1, y+2+height-4);
205 return 0;
206}
int WINAPI ExcludeClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by CardRegion::Clip(), and CardRegion::MoveDragCardTo().

◆ DrawCard()

void DrawCard ( HDC  hdc,
int  x,
int  y,
HDC  hdcSource,
int  width,
int  height 
)

Definition at line 180 of file cardrgndraw.cpp.

181{
182 //draw main center band
183 BitBlt(hdc, x+2, y, width - 4, height, hdcDragCard, 2, 0, SRCCOPY);
184
185 //draw the two bits to the left
186 BitBlt(hdc, x, y+2, 1, height - 4, hdcDragCard, 0, 2, SRCCOPY);
187 BitBlt(hdc, x+1, y+1, 1, height - 2, hdcDragCard, 1, 1, SRCCOPY);
188
189 //draw the two bits to the right
190 BitBlt(hdc, x+width-2, y+1, 1, height - 2, hdcDragCard, width-2, 1, SRCCOPY);
191 BitBlt(hdc, x+width-1, y+2, 1, height - 4, hdcDragCard, width-1, 2, SRCCOPY);
192}

Referenced by CardRegion::MoveDragCardTo(), CardRegion::PrepareDragBitmaps(), CardRegion::PrepareDragBitmapsThreed(), and CardRegion::Render().

◆ DrawCardCorner()

void DrawCardCorner ( HDC  hdc,
int  x,
int  y,
int  cardval,
int  xdir,
int  ydir 
)

Definition at line 138 of file cardrgndraw.cpp.

139{
140 int sx = cardval * __cardwidth;
141 int sy = 0;
142
143 HDC hdcSource = __hdcCardBitmaps;
144
145 if(xdir < 0)
146 {
147 x += __cardwidth + xdir - 1;
148 sx += __cardwidth + xdir - 1;
149 }
150 else
151 {
152 x += xdir;
153 sx += xdir;
154 }
155
156 if(ydir < 0)
157 {
158 y += __cardheight + ydir - 1;
159 sy += __cardheight + ydir - 1;
160 }
161 else
162 {
163 y += ydir;
164 sy += ydir;
165 }
166
167 //convert x,y directions to -1, +1
168 xdir = xdir < 0 ? -1 : 1;
169 ydir = ydir < 0 ? -1 : 1;
170
171 SetPixel(hdc, x+xdir, y , GetPixel(hdcSource, sx+xdir, sy));
172 SetPixel(hdc, x, y, GetPixel(hdcSource, sx, sy));
173 SetPixel(hdc, x, y+ydir, GetPixel(hdcSource, sx, sy+ydir));
174
175}
FORCEINLINE VOID SetPixel(_In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color)
Definition: arm.h:55
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
static HDC
Definition: imagelist.c:88

Referenced by CardRegion::Render().

◆ DrawHorzCardStrip()

void DrawHorzCardStrip ( HDC  hdc,
int  x,
int  y,
int  nCardNum,
int  height,
BOOL  fDrawTips 
)

Definition at line 48 of file cardrgndraw.cpp.

49{
50 int sx = nCardNum * __cardwidth;
51 int sy = 0;
52 int one = 1;
53 int two = 2;
54 BOOL tips = fDrawTips ? FALSE : TRUE;
55
56 if(height == 0) return;
57
58 if(height < 0)
59 {
60 sy = sy + __cardheight;
61 y -= height;
62 one = -one;
63 two = -two;
64 }
65
66 // draw the main vertical band
67 //
68 BitBlt(hdc, x + 2, y, __cardwidth - 4, height, __hdcCardBitmaps, sx+2, sy, SRCCOPY);
69
70 //if(height <= 1) return;
71
72 // draw the "lips" at the left and right
73 BitBlt(hdc, x+1, y+one, 1, height-one*tips, __hdcCardBitmaps, sx+1, sy+one, SRCCOPY);
75
76 //if(height <= 2) return;
77
78 // draw the outer-most lips
79 BitBlt(hdc, x, y+two, 1, height-two*tips, __hdcCardBitmaps, sx, sy+two, SRCCOPY);
81}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static double two
Definition: jn_yn.c:52
int one
Definition: sehframes.cpp:28

Referenced by CardRegion::Render().

◆ DrawVertCardStrip()

void DrawVertCardStrip ( HDC  hdc,
int  x,
int  y,
int  nCardNum,
int  width,
BOOL  fDrawTips 
)

Definition at line 98 of file cardrgndraw.cpp.

99{
100 int sx = nCardNum * __cardwidth;
101 int sy = 0;
102 int one = 1;
103 int two = 2;
104 BOOL tips = fDrawTips ? FALSE : TRUE;
105
106 if(width == 0) return;
107
108
109 if(width < 0)
110 {
111 sx = sx + __cardwidth;
112 x -= width;
113 one = -1;
114 two = -2;
115 }
116
117 // draw the main vertical band
118 //
119 BitBlt(hdc, x, y + 2, width, __cardheight - 4, __hdcCardBitmaps, sx, sy+2, SRCCOPY);
120
121 //if(width <= 1) return;
122
123 // draw the "lips" at the top and bottom
124 BitBlt(hdc, x+one, y+1, width-one*tips, 1, __hdcCardBitmaps, sx+one, sy + 1, SRCCOPY);
126
127 //if(width <= 2) return;
128
129 // draw the outer-most lips
130 BitBlt(hdc, x+two, y, width-two*tips, 1, __hdcCardBitmaps, sx+two, sy, SRCCOPY);
132}

Referenced by CardRegion::Render().

◆ PaintRect()

void PaintRect ( HDC  hdc,
RECT rect,
COLORREF  colour 
)

Definition at line 116 of file cardlib.cpp.

117{
118 COLORREF oldcr = SetBkColor(hdc, colour);
119 ExtTextOut(hdc, 0, 0, ETO_OPAQUE, rect, TEXT(""), 0, 0);
120 SetBkColor(hdc, oldcr);
121}
#define TEXT(s)
Definition: k32.h:26
& rect
Definition: startmenu.cpp:1413
DWORD COLORREF
Definition: windef.h:300
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
#define ExtTextOut
Definition: wingdi.h:4454
#define ETO_OPAQUE
Definition: wingdi.h:647

◆ UseNicePalette()

HPALETTE UseNicePalette ( HDC  hdc,
HPALETTE  hPalette 
)

Definition at line 14 of file cardwindow.cpp.

15{
16 HPALETTE hOld;
17
18 hOld = SelectPalette(hdc, hPalette, FALSE);
20
21 return hOld;
22}
UINT WINAPI RealizePalette(_In_ HDC)
Definition: palette.c:138
HPALETTE WINAPI SelectPalette(_In_ HDC, _In_ HPALETTE, _In_ BOOL)