Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
7e8732c8
Commit
7e8732c8
authored
Mar 16, 2004
by
Sami Nopanen
Committed by
Alexandre Julliard
Mar 16, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Enumerated different drawing modes.
- Implemented HILITE, REMOVE and GHOST drawing modes.
parent
bb86eb65
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
22 deletions
+71
-22
cards.c
dlls/cards/cards.c
+62
-22
cards.h
dlls/cards/cards.h
+9
-0
No files found.
dlls/cards/cards.c
View file @
7e8732c8
...
@@ -76,46 +76,79 @@ BOOL WINAPI cdtInit(int *width, int *height)
...
@@ -76,46 +76,79 @@ BOOL WINAPI cdtInit(int *width, int *height)
/***********************************************************************
/***********************************************************************
* Draw a card. Unlike cdtDrawCard, this version allows you to stretch
* Draw a card. Unlike cdtDrawCard, this version allows you to stretch
* card bitmaps to the size you specify (dx, dy). See cdtDraw for info
* card bitmaps to the size you specify (dx, dy). See cdtDraw for info
* on card,
typ
e and color parameters.
* on card,
mod
e and color parameters.
*/
*/
BOOL
WINAPI
cdtDrawExt
(
HDC
hdc
,
int
x
,
int
y
,
int
dx
,
int
dy
,
int
card
,
int
typ
e
,
DWORD
color
)
BOOL
WINAPI
cdtDrawExt
(
HDC
hdc
,
int
x
,
int
y
,
int
dx
,
int
dy
,
int
card
,
int
mod
e
,
DWORD
color
)
{
{
HDC
hMemoryDC
;
HDC
hMemoryDC
;
HBITMAP
hCardBitmap
;
HBITMAP
hCardBitmap
;
HGDIOBJ
result
;
HGDIOBJ
result
;
DWORD
rasterOp
=
SRCCOPY
;
TRACE
(
"(%p, %d, %d, %d, %d, %d, %d, %ld)
\n
"
,
hdc
,
x
,
y
,
dx
,
dy
,
card
,
typ
e
,
color
);
TRACE
(
"(%p, %d, %d, %d, %d, %d, %d, %ld)
\n
"
,
hdc
,
x
,
y
,
dx
,
dy
,
card
,
mod
e
,
color
);
if
((
card
<
0
)
||
(
card
>
CARD_MAX
))
if
((
card
<
0
)
||
(
card
>
CARD_MAX
))
{
{
FIXME
(
"Unexpected card: %d
\n
"
,
card
);
FIXME
(
"Unexpected card: %d
\n
"
,
card
);
return
0
;
return
FALSE
;
}
}
if
((
type
<
0
)
||
(
type
>
2
))
if
((
mode
<
MODE_FACEUP
)
||
(
mode
>
MODE_DECKO
))
FIXME
(
"Unexpected type: %d
\n
"
,
type
);
{
FIXME
(
"Unexpected mode: %d
\n
"
,
mode
);
return
FALSE
;
}
hCardBitmap
=
cardBitmaps
[
card
];
if
(
mode
==
MODE_INVISIBLEGHOST
||
mode
==
MODE_DECKX
||
mode
==
MODE_DECKO
)
if
(
hCardBitmap
==
0
)
{
FIXME
(
"Mode %d not implemented.
\n
"
,
mode
);
return
FALSE
;
return
FALSE
;
}
hMemoryDC
=
CreateCompatibleDC
(
hdc
);
hMemoryDC
=
CreateCompatibleDC
(
hdc
);
if
(
hMemoryDC
==
0
)
if
(
hMemoryDC
==
0
)
return
FALSE
;
return
FALSE
;
result
=
SelectObject
(
hMemoryDC
,
hCardBitmap
);
if
((
mode
==
MODE_REMOVE
)
||
(
mode
==
MODE_GHOST
))
if
((
result
==
0
)
||
(
result
==
HGDI_ERROR
))
{
{
DeleteDC
(
hMemoryDC
);
HBRUSH
hBrush
;
return
FALSE
;
RECT
rect
;
hBrush
=
CreateSolidBrush
(
color
);
rect
.
left
=
x
;
rect
.
top
=
y
;
rect
.
right
=
x
+
cardWidth
-
1
;
rect
.
bottom
=
y
+
cardHeight
-
1
;
FillRect
(
hdc
,
&
rect
,
hBrush
);
if
(
mode
==
MODE_GHOST
)
{
hBrush
=
CreateSolidBrush
(
RGB
(
255
,
255
,
255
));
FrameRect
(
hdc
,
&
rect
,
hBrush
);
}
}
}
else
/* MODE_FACEUP, MODE_FACEDOWN, MODE_HILITE */
{
if
(
mode
==
MODE_HILITE
)
rasterOp
=
NOTSRCCOPY
;
hCardBitmap
=
cardBitmaps
[
card
];
if
(
hCardBitmap
==
0
)
return
FALSE
;
result
=
SelectObject
(
hMemoryDC
,
hCardBitmap
);
if
((
result
==
0
)
||
(
result
==
HGDI_ERROR
))
{
DeleteDC
(
hMemoryDC
);
return
FALSE
;
}
SetBkColor
(
hdc
,
color
);
SetBkColor
(
hdc
,
color
);
if
((
cardWidth
==
dx
)
&&
(
cardHeight
==
dy
))
if
((
cardWidth
==
dx
)
&&
(
cardHeight
==
dy
))
BitBlt
(
hdc
,
x
,
y
,
cardWidth
,
cardHeight
,
hMemoryDC
,
0
,
0
,
SRCCOPY
);
BitBlt
(
hdc
,
x
,
y
,
cardWidth
,
cardHeight
,
hMemoryDC
,
0
,
0
,
rasterOp
);
else
else
StretchBlt
(
hdc
,
x
,
y
,
dx
,
dy
,
hMemoryDC
,
0
,
0
,
cardWidth
,
cardHeight
,
SRCCOPY
);
StretchBlt
(
hdc
,
x
,
y
,
dx
,
dy
,
hMemoryDC
,
0
,
0
,
cardWidth
,
cardHeight
,
rasterOp
);
}
DeleteDC
(
hMemoryDC
);
DeleteDC
(
hMemoryDC
);
...
@@ -127,8 +160,15 @@ BOOL WINAPI cdtDrawExt(HDC hdc, int x, int y, int dx, int dy, int card, int type
...
@@ -127,8 +160,15 @@ BOOL WINAPI cdtDrawExt(HDC hdc, int x, int y, int dx, int dy, int card, int type
* Draws a card at position x, y in its default size (as returned by
* Draws a card at position x, y in its default size (as returned by
* cdtInit.
* cdtInit.
*
*
* Type parameter controls whether the front (0), back (1), or inverted
* Mode controls how the card gets drawn:
* front (2) of the card is to be drawn.
* MODE_FACEUP ; draw card facing up
* MODE_FACEDOWN ; draw card facing down
* MODE_HILITE ; draw face up, with NOTSRCCOPY
* MODE_GHOST ; draw 'ghost' card
* MODE_REMOVE ; draw with background color
* MODE_INVISIBLEGHOST ; ?
* MODE_DECKX ; draw X
* MODE_DECKO ; draw O
*
*
* The card parameter defines the card graphic to be drawn. If we are
* The card parameter defines the card graphic to be drawn. If we are
* drawing fronts of cards, card should have a value from 0 through 51
* drawing fronts of cards, card should have a value from 0 through 51
...
@@ -143,11 +183,11 @@ BOOL WINAPI cdtDrawExt(HDC hdc, int x, int y, int dx, int dy, int card, int type
...
@@ -143,11 +183,11 @@ BOOL WINAPI cdtDrawExt(HDC hdc, int x, int y, int dx, int dy, int card, int type
* Color parameter defines the background color, used when drawing some
* Color parameter defines the background color, used when drawing some
* card backs.
* card backs.
*/
*/
BOOL
WINAPI
cdtDraw
(
HDC
hdc
,
int
x
,
int
y
,
int
card
,
int
typ
e
,
DWORD
color
)
BOOL
WINAPI
cdtDraw
(
HDC
hdc
,
int
x
,
int
y
,
int
card
,
int
mod
e
,
DWORD
color
)
{
{
TRACE
(
"(%p, %d, %d, %d, %d, %ld)
\n
"
,
hdc
,
x
,
y
,
card
,
typ
e
,
color
);
TRACE
(
"(%p, %d, %d, %d, %d, %ld)
\n
"
,
hdc
,
x
,
y
,
card
,
mod
e
,
color
);
return
cdtDrawExt
(
hdc
,
x
,
y
,
cardWidth
,
cardHeight
,
card
,
typ
e
,
color
);
return
cdtDrawExt
(
hdc
,
x
,
y
,
cardWidth
,
cardHeight
,
card
,
mod
e
,
color
);
}
}
...
...
dlls/cards/cards.h
View file @
7e8732c8
...
@@ -51,6 +51,15 @@
...
@@ -51,6 +51,15 @@
#define CARD_MAX 68
#define CARD_MAX 68
/* Drawing modes */
#define MODE_FACEUP 0
#define MODE_FACEDOWN 1
#define MODE_HILITE 2
#define MODE_GHOST 3
#define MODE_REMOVE 4
#define MODE_INVISIBLEGHOST 5
#define MODE_DECKX 6
#define MODE_DECKO 7
/* As defined by CARD_SUIT_* */
/* As defined by CARD_SUIT_* */
#define SUIT_FROM_CARD(card) (card & 3)
#define SUIT_FROM_CARD(card) (card & 3)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment