My Present for ya all. A new cards.dll with bigger, photorealistic Bavarian Style Cards. I theory Number 2-5 are NON existant. But to be fully compatible I sat down and made them by myself. Its fully compatible to Windows Solitaire, not ROS Solitaire, which does not like the bigger cards. This needs a fix. Btw if someone finds out how to modify the edges on the cards to be transparent, plz tell me. They need to be waay more round.

svn path=/trunk/; revision=28180
This commit is contained in:
Daniel Reimer 2007-08-05 20:38:19 +00:00
parent c55a8d231d
commit ecfdde12b9
62 changed files with 430 additions and 0 deletions

249
rosapps/cardsbav/cardsbav.c Normal file
View file

@ -0,0 +1,249 @@
/*
* ReactOS Bavarian Cards
*
* Copyright (C) 2007 Filip Navara <xnavara@volny.org>
* Daniel Reimer <reimer.daniel@freenet.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include "windows.h"
#include "cardsbav.h"
HBITMAP g_CardBitmaps[MAX_CARD_BITMAPS];
HINSTANCE g_hModule = 0;
/*
* Redundant function from 16-bit Windows time
*/
BOOL WINAPI WEP(DWORD Unknown)
{
UNREFERENCED_PARAMETER(Unknown);
return TRUE;
}
/*
* Initialize card library and return cards width and height
*/
BOOL WINAPI cdtInit(INT *Width, INT *Height)
{
DWORD dwIndex;
/* Report card width and height to user */
*Width = CARD_WIDTH;
*Height = CARD_HEIGHT;
/* Load images */
for (dwIndex = 0; dwIndex < MAX_CARD_BITMAPS; ++dwIndex)
g_CardBitmaps[dwIndex] =
(HBITMAP)LoadBitmapA(g_hModule, MAKEINTRESOURCEA(dwIndex + 1));
return TRUE;
}
/*
* Terminate card library
*/
VOID WINAPI cdtTerm(VOID)
{
DWORD dwIndex;
/* Unload images */
for (dwIndex = 0; dwIndex < MAX_CARD_BITMAPS; dwIndex++)
DeleteObject(g_CardBitmaps[dwIndex]);
}
/*
* Render card with no stretching
*/
BOOL WINAPI cdtDraw(HDC hdc, INT x, INT y, INT card, INT type, COLORREF color)
{
return cdtDrawExt(hdc, x, y, CARD_WIDTH, CARD_HEIGHT, card, type, color);
}
/*
* internal
*/
static __inline VOID BltCard(HDC hdc, INT x, INT y, INT dx, INT dy, HDC hdcCard, DWORD dwRasterOp, BOOL bStretch)
{
if (bStretch)
{
StretchBlt(hdc, x, y, dx, dy, hdcCard, 0, 0, CARD_WIDTH, CARD_HEIGHT, dwRasterOp);
} else
{
BitBlt(hdc, x, y, dx, dy, hdcCard, 0, 0, dwRasterOp);
/*
* This is need when using Microsoft images, because they use two-color red/white images for
* red cards and thus needs fix-up of the edge to black color.
*/
#if 0
if (ISREDCARD(card))
{
PatBlt(hdc, x, y + 2, 1, dy - 4, BLACKNESS);
PatBlt(hdc, x + dx - 1, y + 2, 1, dy - 4, BLACKNESS);
PatBlt(hdc, x + 2, y, dx - 4, 1, BLACKNESS);
PatBlt(hdc, x + 2, y + dy - 1, dx - 4, 1, BLACKNESS);
SetPixel(hdc, x + 1, y + 1, 0);
SetPixel(hdc, x + dx - 2, y + 1, 0);
SetPixel(hdc, x + 1, y + dy - 2, 0);
SetPixel(hdc, x + dx - 2, y + dy - 2, 0);
}
#endif
}
}
/*
* Render card
*
* Parameters:
* hdc - Handle of destination device context
* x - Position left
* y - Position right
* dx - Destination width
* dy - Destination height
* card - Image id (meaning depend on type)
* type - One of edt* constants
* color - Background color (?)
*/
BOOL WINAPI cdtDrawExt(HDC hdc, INT x, INT y, INT dx, INT dy, INT card, INT type, COLORREF color)
{
HDC hdcCard;
DWORD dwRasterOp = SRCCOPY, OldBkColor;
BOOL bSaveEdges = TRUE;
BOOL bStretch = FALSE;
if (type & ectSAVEEDGESMASK)
{
type &= ~ectSAVEEDGESMASK;
bSaveEdges = FALSE;
}
if (dx != CARD_WIDTH || dy != CARD_HEIGHT)
{
bStretch = TRUE;
bSaveEdges = FALSE;
}
switch (type)
{
case ectINVERTED:
dwRasterOp = NOTSRCCOPY;
case ectFACES:
card = (card % 4) * 13 + (card / 4);
break;
case ectBACKS:
--card;
break;
case ectEMPTYNOBG:
dwRasterOp = SRCAND;
case ectEMPTY:
card = 52;
break;
case ectERASE:
break;
case ectREDX:
card = 66;
break;
case ectGREENO:
card = 67;
break;
default:
return FALSE;
}
if (type == ectEMPTY || type == ectERASE)
{
POINT pPoint;
HBRUSH hBrush;
hBrush = CreateSolidBrush(color);
GetDCOrgEx(hdc, &pPoint);
SetBrushOrgEx(hdc, pPoint.x, pPoint.y, 0);
SelectObject(hdc, hBrush);
PatBlt(hdc, x, y, dx, dy, PATCOPY);
}
if (type != ectERASE)
{
hdcCard = CreateCompatibleDC(hdc);
SelectObject(hdcCard, g_CardBitmaps[card]);
OldBkColor = SetBkColor(hdc, (type == ectFACES) ? 0xFFFFFF : color);
if (bSaveEdges)
{
COLORREF SavedPixels[12];
SavedPixels[0] = GetPixel(hdc, x, y);
SavedPixels[1] = GetPixel(hdc, x + 1, y);
SavedPixels[2] = GetPixel(hdc, x, y + 1);
SavedPixels[3] = GetPixel(hdc, x + dx - 1, y);
SavedPixels[4] = GetPixel(hdc, x + dx - 2, y);
SavedPixels[5] = GetPixel(hdc, x + dx - 1, y + 1);
SavedPixels[6] = GetPixel(hdc, x, y + dy - 1);
SavedPixels[7] = GetPixel(hdc, x + 1, y + dy - 1);
SavedPixels[8] = GetPixel(hdc, x, y + dy - 2);
SavedPixels[9] = GetPixel(hdc, x + dx - 1, y + dy - 1);
SavedPixels[10] = GetPixel(hdc, x + dx - 2, y + dy - 1);
SavedPixels[11] = GetPixel(hdc, x + dx - 1, y + dy - 2);
BltCard(hdc, x, y, dx, dy, hdcCard, dwRasterOp, bStretch);
SetPixel(hdc, x, y, SavedPixels[0]);
SetPixel(hdc, x + 1, y, SavedPixels[1]);
SetPixel(hdc, x, y + 1, SavedPixels[2]);
SetPixel(hdc, x + dx - 1, y, SavedPixels[3]);
SetPixel(hdc, x + dx - 2, y, SavedPixels[4]);
SetPixel(hdc, x + dx - 1, y + 1, SavedPixels[5]);
SetPixel(hdc, x, y + dy - 1, SavedPixels[6]);
SetPixel(hdc, x + 1, y + dy - 1, SavedPixels[7]);
SetPixel(hdc, x, y + dy - 2, SavedPixels[8]);
SetPixel(hdc, x + dx - 1, y + dy - 1, SavedPixels[9]);
SetPixel(hdc, x + dx - 2, y + dy - 1, SavedPixels[10]);
SetPixel(hdc, x + dx - 1, y + dy - 2, SavedPixels[11]);
}
else
{
BltCard(hdc, x, y, dx, dy, hdcCard, dwRasterOp, bStretch);
}
SetBkColor(hdc, OldBkColor);
DeleteDC(hdcCard);
}
return TRUE;
}
/***********************************************************************
* cdtAnimate (CARDS.@)
*
* Animate card background, we don't use it
*/
BOOL WINAPI cdtAnimate(HDC hdc, int cardback, int x, int y, int frame)
{
UNREFERENCED_PARAMETER(frame);
UNREFERENCED_PARAMETER(y);
UNREFERENCED_PARAMETER(x);
UNREFERENCED_PARAMETER(cardback);
UNREFERENCED_PARAMETER(hdc);
return TRUE;
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
UNREFERENCED_PARAMETER(lpvReserved);
if (fdwReason == DLL_PROCESS_ATTACH)
g_hModule = hinstDLL;
return TRUE;
}

View file

@ -0,0 +1,8 @@
LIBRARY cardsbav.dll
EXPORTS
WEP
cdtAnimate
cdtDraw
cdtDrawExt
cdtInit
cdtTerm

View file

@ -0,0 +1,62 @@
/*
* ReactOS Bavarian Cards
*
* Copyright (C) 2007 Filip Navara <xnavara@volny.org>
* Daniel Reimer <reimer.daniel@freenet.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _CARDS_H
#define _CARDS_H
/*
* 52 card faces +
* 12 card backs +
* X Sign +
* O Sign +
* FreeCard +
* Joker
*/
#define MAX_CARD_BITMAPS 68
#define ectFACES 0
#define ectBACKS 1
#define ectINVERTED 2
#define ectEMPTY 3
#define ectERASE 4
#define ectEMPTYNOBG 5
#define ectREDX 6
#define ectGREENO 7
#define ectSAVEEDGESMASK 0x80000000
/* Microsoft card dimensions */
/*
#define CARD_WIDTH 110
#define CARD_HEIGHT 198
*/
/* MacSolitaireX's card dimensions */
#define CARD_WIDTH 110
#define CARD_HEIGHT 198
#define ISREDCARD(x) (x >= 13 && x <= 39)
BOOL WINAPI cdtInit(int *width, int *height);
BOOL WINAPI cdtDraw(HDC hdc, int x, int y, int card, int type, DWORD color);
BOOL WINAPI cdtDrawExt(HDC hdc, int x, int y, int dx, int dy, int card, int suit, DWORD color);
BOOL WINAPI cdtAnimate(HDC hdc, int cardback, int x, int y, int frame);
void WINAPI cdtTerm(void);
#endif /* _CARDS_H */

View file

@ -0,0 +1,12 @@
<module name="cardsbav" type="win32dll" baseaddress="${BASEADDRESS_CARDS}" installbase="system32" installname="cardsbav.dll">
<importlibrary definition="cardsbav.def" />
<include base="cardsbav">.</include>
<define name="UNICODE" />
<define name="_UNICODE" />
<define name="__USE_W32API" />
<library>kernel32</library>
<library>gdi32</library>
<library>user32</library>
<file>cardsbav.c</file>
<file>cardsbav.rc</file>
</module>

View file

@ -0,0 +1,99 @@
/*
* ReactOS Bavarian Cards
*
* Copyright (C) 2007 Filip Navara <xnavara@volny.org>
* Daniel Reimer <reimer.daniel@freenet.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <windows.h>
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "Bavarian Cardplaying Helper DLL\0"
#define REACTOS_STR_INTERNAL_NAME "cardsbav\0"
#define REACTOS_STR_ORIGINAL_FILENAME "cardsbav.dll\0"
#include <reactos/version.rc>
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
1 BITMAP "res/EichelAs.bmp"
2 BITMAP "res/Eichel2.bmp"
3 BITMAP "res/Eichel3.bmp"
4 BITMAP "res/Eichel4.bmp"
5 BITMAP "res/Eichel5.bmp"
6 BITMAP "res/Eichel6.bmp"
7 BITMAP "res/Eichel7.bmp"
8 BITMAP "res/Eichel8.bmp"
9 BITMAP "res/Eichel9.bmp"
10 BITMAP "res/Eichel10.bmp"
11 BITMAP "res/EichelUnter.bmp"
12 BITMAP "res/EichelOber.bmp"
13 BITMAP "res/EichelKoenig.bmp"
14 BITMAP "res/SchellenAs.bmp"
15 BITMAP "res/Schellen2.bmp"
16 BITMAP "res/Schellen3.bmp"
17 BITMAP "res/Schellen4.bmp"
18 BITMAP "res/Schellen5.bmp"
19 BITMAP "res/Schellen6.bmp"
20 BITMAP "res/Schellen7.bmp"
21 BITMAP "res/Schellen8.bmp"
22 BITMAP "res/Schellen9.bmp"
23 BITMAP "res/Schellen10.bmp"
24 BITMAP "res/SchellenUnter.bmp"
25 BITMAP "res/SchellenOber.bmp"
26 BITMAP "res/SchellenKoenig.bmp"
27 BITMAP "res/HerzAs.bmp"
28 BITMAP "res/Herz2.bmp"
29 BITMAP "res/Herz3.bmp"
30 BITMAP "res/Herz4.bmp"
31 BITMAP "res/Herz5.bmp"
32 BITMAP "res/Herz6.bmp"
33 BITMAP "res/Herz7.bmp"
34 BITMAP "res/Herz8.bmp"
35 BITMAP "res/Herz9.bmp"
36 BITMAP "res/Herz10.bmp"
37 BITMAP "res/HerzUnter.bmp"
38 BITMAP "res/HerzOber.bmp"
39 BITMAP "res/HerzKoenig.bmp"
40 BITMAP "res/GrasAs.bmp"
41 BITMAP "res/Gras2.bmp"
42 BITMAP "res/Gras3.bmp"
43 BITMAP "res/Gras4.bmp"
44 BITMAP "res/Gras5.bmp"
45 BITMAP "res/Gras6.bmp"
46 BITMAP "res/Gras7.bmp"
47 BITMAP "res/Gras8.bmp"
48 BITMAP "res/Gras9.bmp"
49 BITMAP "res/Gras10.bmp"
50 BITMAP "res/GrasUnter.bmp"
51 BITMAP "res/GrasOber.bmp"
52 BITMAP "res/GrasKoenig.bmp"
53 BITMAP "res/FreeCard.bmp"
54 BITMAP "res/Ruecken.bmp"
55 BITMAP "res/Ruecken.bmp"
56 BITMAP "res/Ruecken.bmp"
57 BITMAP "res/Ruecken.bmp"
58 BITMAP "res/Ruecken.bmp"
59 BITMAP "res/Ruecken.bmp"
60 BITMAP "res/Ruecken.bmp"
61 BITMAP "res/Ruecken.bmp"
62 BITMAP "res/Ruecken.bmp"
63 BITMAP "res/Ruecken.bmp"
64 BITMAP "res/Ruecken.bmp"
65 BITMAP "res/Ruecken.bmp"
66 BITMAP "res/Joker.bmp"
67 BITMAP "res/XSign.bmp"
68 BITMAP "res/OSign.bmp"

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB