2017-01-21 17:27:46 +01:00
|
|
|
|
// CPixmap.h
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <ddraw.h>
|
2017-01-23 00:20:27 +01:00
|
|
|
|
#include <SDL_surface.h>
|
2017-01-21 17:27:46 +01:00
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#define MAXIMAGE 100
|
|
|
|
|
|
|
|
|
|
class CPixmap
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
CPixmap();
|
|
|
|
|
~CPixmap();
|
|
|
|
|
|
2017-01-22 00:10:12 +01:00
|
|
|
|
void SetDebug(bool bDebug);
|
2017-01-21 17:27:46 +01:00
|
|
|
|
|
2017-01-22 00:10:12 +01:00
|
|
|
|
bool Create(HWND hwnd, POINT dim, bool bFullScreen, int mouseType);
|
|
|
|
|
bool Flush();
|
|
|
|
|
bool Restore();
|
|
|
|
|
bool InitSysPalette();
|
|
|
|
|
bool IsPalette();
|
2017-01-21 17:27:46 +01:00
|
|
|
|
void Fill(RECT rect, COLORREF color);
|
|
|
|
|
|
2017-01-22 00:10:12 +01:00
|
|
|
|
bool SavePalette();
|
|
|
|
|
bool RestorePalette();
|
2017-01-21 17:27:46 +01:00
|
|
|
|
int SearchColor(int red, int green, int blue);
|
2017-01-22 00:10:12 +01:00
|
|
|
|
bool Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim, bool bUsePalette);
|
|
|
|
|
bool Cache(int channel, char *pFilename, POINT totalDim, bool bUsePalette);
|
|
|
|
|
bool Cache(int channel, HBITMAP hbm, POINT totalDim);
|
2017-01-21 17:27:46 +01:00
|
|
|
|
void Flush(int channel);
|
|
|
|
|
void SetTransparent(int channel, COLORREF color);
|
|
|
|
|
void SetTransparent2(int channel, COLORREF color1, COLORREF color2);
|
|
|
|
|
void SetClipping(RECT clip);
|
|
|
|
|
RECT GetClipping();
|
|
|
|
|
|
2017-01-22 00:10:12 +01:00
|
|
|
|
bool IsIconPixel(int channel, int rank, POINT pos);
|
2017-01-21 17:27:46 +01:00
|
|
|
|
|
2017-01-22 00:10:12 +01:00
|
|
|
|
bool DrawIcon(int chDst, int channel, int rank, POINT pos, int mode=0, bool bMask=false);
|
|
|
|
|
bool DrawIconDemi(int chDst, int channel, int rank, POINT pos, int mode=0, bool bMask=false);
|
|
|
|
|
bool DrawIconPart(int chDst, int channel, int rank, POINT pos, int startY, int endY, int mode=0, bool bMask=false);
|
|
|
|
|
bool DrawPart(int chDst, int channel, POINT dest, RECT rect, int mode=0, bool bMask=false);
|
|
|
|
|
bool DrawImage(int chDst, int channel, RECT rect, int mode=0);
|
2017-01-21 17:27:46 +01:00
|
|
|
|
|
2017-01-22 00:10:12 +01:00
|
|
|
|
bool BuildIconMask(int channelMask, int rankMask,
|
2017-01-21 17:27:46 +01:00
|
|
|
|
int channel, int rankSrc, int rankDst);
|
|
|
|
|
|
2017-01-22 00:10:12 +01:00
|
|
|
|
bool Display();
|
2017-01-21 17:27:46 +01:00
|
|
|
|
|
2017-01-22 00:10:12 +01:00
|
|
|
|
void SetMousePosSprite(POINT pos, int sprite, bool bDemoPlay);
|
|
|
|
|
void SetMousePos(POINT pos, bool bDemoPlay);
|
|
|
|
|
void SetMouseSprite(int sprite, bool bDemoPlay);
|
|
|
|
|
void MouseShow(bool bShow);
|
2017-01-21 17:27:46 +01:00
|
|
|
|
void MouseInvalidate();
|
|
|
|
|
void MouseBackClear();
|
|
|
|
|
void MouseBackDraw();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
HRESULT RestoreAll();
|
|
|
|
|
HRESULT BltFast(int chDst, int channel, POINT dst, RECT rcRect, int mode);
|
2017-01-23 00:20:27 +01:00
|
|
|
|
HRESULT BltFast(LPDIRECTDRAWSURFACE lpDD, SDL_Surface *lpSDL,
|
2017-01-21 17:27:46 +01:00
|
|
|
|
int channel, POINT dst, RECT rcRect, int mode);
|
|
|
|
|
|
|
|
|
|
void MouseUpdate();
|
2017-01-22 00:10:12 +01:00
|
|
|
|
bool MouseQuickDraw(RECT rect);
|
2017-01-21 17:27:46 +01:00
|
|
|
|
void MouseBackSave();
|
|
|
|
|
void MouseBackRestore();
|
|
|
|
|
void MouseBackDebug();
|
|
|
|
|
RECT MouseRectSprite();
|
|
|
|
|
void MouseHotSpot();
|
|
|
|
|
|
|
|
|
|
protected:
|
2017-01-22 00:10:12 +01:00
|
|
|
|
bool m_bFullScreen;
|
2017-01-21 17:27:46 +01:00
|
|
|
|
int m_mouseType;
|
2017-01-22 00:10:12 +01:00
|
|
|
|
bool m_bDebug;
|
|
|
|
|
bool m_bPalette;
|
2017-01-21 17:27:46 +01:00
|
|
|
|
HWND m_hWnd;
|
|
|
|
|
POINT m_dim; // dimensions totales
|
|
|
|
|
RECT m_clipRect; // rectangle de clipping
|
|
|
|
|
|
|
|
|
|
POINT m_mousePos;
|
|
|
|
|
int m_mouseSprite;
|
|
|
|
|
POINT m_mouseHotSpot;
|
|
|
|
|
POINT m_mouseBackPos;
|
2017-01-22 00:10:12 +01:00
|
|
|
|
bool m_bMouseBack;
|
|
|
|
|
bool m_bMouseShow;
|
|
|
|
|
bool m_bBackDisplayed;
|
2017-01-21 17:27:46 +01:00
|
|
|
|
|
|
|
|
|
LPDIRECTDRAW m_lpDD; // DirectDraw object
|
|
|
|
|
LPDIRECTDRAWSURFACE m_lpDDSPrimary; // DirectDraw primary surface
|
2017-01-23 00:20:27 +01:00
|
|
|
|
SDL_Surface * m_lpSDLPrimary;
|
2017-01-21 17:27:46 +01:00
|
|
|
|
LPDIRECTDRAWSURFACE m_lpDDSBack; // DirectDraw back surface
|
2017-01-23 00:20:27 +01:00
|
|
|
|
SDL_Surface * m_lpSDLBack;
|
2017-01-21 17:27:46 +01:00
|
|
|
|
LPDIRECTDRAWSURFACE m_lpDDSMouse; // DirectDraw back surface
|
2017-01-23 00:20:27 +01:00
|
|
|
|
SDL_Surface * m_lpSDLMouse;
|
2017-01-21 17:27:46 +01:00
|
|
|
|
LPDIRECTDRAWPALETTE m_lpDDPal; // the primary surface palette
|
|
|
|
|
LPDIRECTDRAWSURFACE m_lpDDSurface[MAXIMAGE]; // offscreen surfaces
|
2017-01-23 00:20:27 +01:00
|
|
|
|
SDL_Surface * m_lpSDLSurface[MAXIMAGE];
|
2017-01-21 17:27:46 +01:00
|
|
|
|
LPDIRECTDRAWCLIPPER m_lpClipper;
|
|
|
|
|
PALETTEENTRY m_pal[256]; // sauvegarde palette
|
|
|
|
|
PALETTEENTRY m_sysPal[256]; // sauvegarde palette
|
|
|
|
|
COLORREF m_colorSurface[2*MAXIMAGE];
|
|
|
|
|
|
|
|
|
|
char m_filename[MAXIMAGE][20];
|
|
|
|
|
POINT m_totalDim[MAXIMAGE]; // dimensions totale image
|
|
|
|
|
POINT m_iconDim[MAXIMAGE]; // dimensions d'une ic<69>ne
|
|
|
|
|
DDBLTFX m_DDbltfx;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|