📄 prgfx.h
字号:
/*
PrGfx.h
Copyright (C) 2004-2005 CLife. All rights reserved.
*/
#ifndef _PrGFX_H_
#define _PrGFX_H_
#include "PrTypes.h"
typedef struct {
UINT8 b;
UINT8 g;
UINT8 r;
UINT8 unused;
}GFXColor;
typedef struct {
int ncolors;
GFXColor *colors;
}GFXPalette;
/* Everything in the pixel format structure is read-only */
typedef struct _GFXPixelFormat {
GFXPalette *palette;
UINT8 BitsPerPixel;
UINT8 BytesPerPixel;
UINT8 Rloss;
UINT8 Gloss;
UINT8 Bloss;
UINT8 Aloss;
UINT8 Rshift;
UINT8 Gshift;
UINT8 Bshift;
UINT8 Ashift;
UINT8 alpha;
UINT32 Rmask;
UINT32 Gmask;
UINT32 Bmask;
UINT32 Amask;
/* RGB color key information */
UINT32 colorkey;
/* Alpha value information (per-surface alpha) */
}GFXPixelFormat;
#define PIXEL_FROM_RGB(pixel, fmt, r, g, b) \
{ \
pixel = ((r>>fmt->Rloss)<<fmt->Rshift)| \
((g>>fmt->Gloss)<<fmt->Gshift)| \
((b>>fmt->Bloss)<<fmt->Bshift); \
}
#define RGB_FROM_PIXEL(pixel, fmt, r, g, b) \
{ \
r = (((pixel&fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss); \
g = (((pixel&fmt->Gmask)>>fmt->Gshift)<<fmt->Gloss); \
b = (((pixel&fmt->Bmask)>>fmt->Bshift)<<fmt->Bloss); \
}
PR_BEGIN_EXTERN_C
/* Ternary raster operations */
#define BLIT_SRCOOPY (DWORD)0x00CC0020 /* dest = source */
#define BLIT_SRCPAINT (DWORD)0x00EE0086 /* dest = source OR dest */
#define BLIT_SRCAND (DWORD)0x008800C6 /* dest = source AND dest */
#define BLIT_SRCINVERT (DWORD)0x00660046 /* dest = source XOR dest */
#define BLIT_RCERASE (DWORD)0x00440328 /* dest = source AND (NOT dest ) */
#define BLIT_NOTSRCCOPY (DWORD)0x00330008 /* dest = (NOT source) */
#define BLIT_NOTSRCERASE (DWORD)0x001100A6 /* dest = (NOT src) AND (NOT dest) */
#define BLIT_MERGECOPY (DWORD)0x00C000CA /* dest = (source AND pattern) */
#define BLIT_MERGEPAINT (DWORD)0x00BB0226 /* dest = (NOT source) OR dest */
#define BLIT_PATCOPY (DWORD)0x00F00021 /* dest = pattern */
#define BLIT_PATPAINT (DWORD)0x00FB0A09 /* dest = DPSnoo */
#define BLIT_PATINVERT (DWORD)0x005A0049 /* dest = pattern XOR dest */
#define BLIT_DSTINVERT (DWORD)0x00550009 /* dest = (NOT dest) */
#define BLIT_BLACKNESS (DWORD)0x00000042 /* dest = BLACK */
#define BLIT_WHITENESS (DWORD)0x00FF0062 /* dest = WHITE */
typedef struct _GFX GFX,*PGFX;
typedef int (*GfxGetPixel)(PGFX gfx,int x,int y);
typedef void (*GfxSetPixel)(PGFX gfx,int x,int y,UINT32 cc);
typedef void (*GfxHLine)(PGFX gfx,int x1,int x2,int y,UINT32 cc);
typedef INT32 (*GfxGetLine)(PGFX gfx,int x,int y,int w,void*buf);
typedef INT32 (*GfxPutLine)(PGFX gfx,int x,int y,int w,void*buf);
typedef INT32 (*GfxGetBox)(PGFX gfx,int x,int y,int w,int h,void*buf);
typedef INT32 (*GfxPutBox)(PGFX gfx,int x,int y,int w,int h,void*buf);
typedef INT32 (*GfxFillRect)(PGFX gfx,int x,int y,int w,int h,UINT32 cc);
typedef INT32 (*GfxBlit)(PGFX dst,int dx,int dy,int dw,int dh,PGFX src,int sx,int sy,int mode);
typedef INT32 (*GfxUpdateRect)(PGFX,int x,int y,int width,int height);
typedef INT32 (*GfxPalette)(PGFX,GFXColor*colors,int start,int count);//Palette Set and Get
typedef struct _SUBDRIVER{
GfxGetPixel GetPixel;
GfxSetPixel SetPixel;
GfxPalette SetPalette;
GfxPalette GetPalette;
GfxHLine HLine;
GfxGetLine GetLine;
GfxPutLine PutLine;
GfxGetBox GetBox;
GfxPutBox PutBox;
GfxFillRect FillRect;
GfxBlit Blit;
GfxUpdateRect UpdateRect;
}SUBDRIVER;
typedef PGFX (*GfxOpenGfx)(PGFX gfx,UINT8 bpp,UINT32 Rmask,UINT32 Gmask,UINT32 Bmask,UINT32 Amask);
typedef PGFX (*GfxAllocGfx)(UINT8 bpp,UINT32 Rmask,UINT32 Gmask,UINT32 Bmask,UINT32 Amask);
typedef void (*GfxFreeGfx)(PGFX gfx);
typedef int (*GfxMapMemGC)(PGFX gfx,int w,int h,int bpp,
int linelen,void *addr);
UINT32 GfxRGB2Pixel(PGFX gfx,UINT8 r,UINT8 g,UINT8 b,UINT8 a);
void GfxPixel2RGB(PGFX gfx,UINT32 pixel,UINT8*r,UINT8*g,UINT8*b,UINT8*a);
struct _GFX
{
UINT32 width;
UINT32 height;
UINT32 lPitch;
UINT32 bpp;//bitsPerPixel;
UINT8 alpha;
unsigned char*Buffer;
GfxOpenGfx OpenGfx;
GfxAllocGfx AllocGfx;
GfxMapMemGC MapMemGC;
GfxFreeGfx FreeGfx;
///////////////////////////////
GfxGetPixel GetPixel;
GfxSetPixel SetPixel;
GfxPalette SetPalette;
GfxPalette GetPalette;
GfxHLine HLine;
GfxGetLine GetLine;
GfxPutLine PutLine;
GfxGetBox GetBox;
GfxPutBox PutBox;
GfxFillRect FillRect;
GfxBlit Blit;
GfxUpdateRect UpdateRect;
GFXPixelFormat*PixFormat;
};
extern SUBDRIVER fb8,fb16,fb24;
extern GFX scrdev;
PR_END_EXTERN_C
#endif /* _PrGFX_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -