aboutsummaryrefslogtreecommitdiff
path: root/backends/gp32/h/gpgraphic.h
blob: f1ead3c59c6043dce4910663cebe17c31cd9287e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#ifndef 	__GRAPHIC_H__
#define		__GRAPHIC_H__

#define GPC_DRAW_OK				0
#define	GPC_DRAW_ERR_FULL		1
#define GPC_DRAW_ERR_PARAM		2
#define GPC_DRAW_ERR_UNKNOWN	3
#define GPC_DRAW_ERR_OUTOFMEM	4

#define GPC_LCD_ON_BIT			0x80
#define GPC_LCD_VACTIVE			0x40
#define GPC_LCD_HACTIVE			0x20

typedef struct tagGPLCDINFO{
	union{
		int U32_lcd;
		struct{
			char clk_value;
			char lcd_buf_count;
			char bpp;
			char b_lcd_on;
		}U8_lcd;
	}lcd_global;
	unsigned int buffer_size;
	unsigned int * buf_addr[4];
	unsigned int * r_palette;
	unsigned int * m_palette;
}GPLCDINFO;

typedef struct tagGPDRAWTAG{
	int restoreflag;
	short clip_x;
	short clip_y;
	short clip_w;
	short clip_h;
}GPDRAWTAG;

typedef struct tagGPDRAWSURFACE{
	unsigned char * ptbuffer;
	int bpp;	/*reserved*/
	int buf_w;
	int buf_h;
	int ox;
	int oy;
	unsigned char * o_buffer;
} GPDRAWSURFACE;

#define GPC_DFLAG_1BPP	1
#define GPC_DFLAG_2BPP	2
#define GPC_DFLAG_4BPP	4
#define GPC_DFLAG_8BPP	8
#define GPC_DFLAG_16BPP	16

int GpGraphicModeSet(int gd_bpp, int * gp_pal);
void GpLcdInfoGet(GPLCDINFO * p_info);
void GpLcdEnable(void);
void GpLcdDisable(void);
int GpLcdStatusGet(void);
int GpLcdSurfaceGet(GPDRAWSURFACE * ptgpds, int idx);
int GpMemSurfaceGet(GPDRAWSURFACE * ptgpds);
extern void (*GpSurfaceSet)(GPDRAWSURFACE * ptgpds);
extern void (*GpSurfaceFlip)(GPDRAWSURFACE * ptgpds);
unsigned char * GpLcdLock(void);
void GpLcdUnlock(void);

#define GPC_PAL_RED_MASK	0xf800
#define GPC_PAL_GREEN_MASK	0x07c0
#define GPC_PAL_BLUE_MASK	0x003e
#define GPC_PALCHAN_RED_BIT		0x4
#define GPC_PALCHAN_GREEN_BIT	0x2
#define GPC_PALCHAN_BLUE_BIT	0x1

typedef unsigned short GP_PALETTEENTRY;
typedef struct tag_GP_LOGPALENTRY{
	unsigned char peRed;
	unsigned char peGreen;
	unsigned char peBlue;
	unsigned char peFlags;
}GP_LOGPALENTRY;

typedef unsigned long * GP_HPALETTE;
GP_HPALETTE GpPaletteCreate (int entry_num, GP_PALETTEENTRY * pal_entry);
GP_HPALETTE GpPaletteCreateEx (int entry_num, GP_LOGPALENTRY * pal_entry);

GP_HPALETTE GpPaletteSelect(GP_HPALETTE h_new);

unsigned int GpPaletteRealize (void);
int GpPaletteDelete (GP_HPALETTE hPal);
#define GPC_PAL_SYNC_REALIZE	0
#define GPC_PAL_ASYNC_REALIZE	1
#define GPC_PAL_NO_REALIZE		2
int GpPaletteEntryChange (int pal_offset, int entry_num, GP_PALETTEENTRY * pal_entry, int flag);
int GpPaletteEntryChangeEx (int pal_offset, int entry_num, GP_LOGPALENTRY * pal_entry, int flag);

GP_HPALETTE GpRegPalGet (void);
GP_HPALETTE GpLogPalGet (void);

int GpLcdFade (int fade_step, GP_HPALETTE old_pal);
void GpLcdNoFade (GP_HPALETTE old_pal);
int GpLcdChanFade (int fade_step, int chan, GP_HPALETTE old_pal);
int GpLcdFadeNormalize (GP_HPALETTE basic_pal);

int GpBitBlt (GPDRAWTAG * gptag,GPDRAWSURFACE * ptgpds,int dx,int dy,int width,int height,unsigned char * src, int sx,int sy,int imgw,int imgh);
int GpTransBlt (GPDRAWTAG * gptag,GPDRAWSURFACE * ptgpds,int dx,int dy,int width,int height,unsigned char *src,int sx,int sy,int imgw,int imgh,unsigned char color);
int GpBitLRBlt (GPDRAWTAG * gptag,GPDRAWSURFACE * ptgpds,int dx,int dy,int width,int height,unsigned char * src,int sx,int sy,int imgw,int imgh);
int GpTransLRBlt (GPDRAWTAG * gptag,GPDRAWSURFACE * ptgpds,int dx,int dy,int width,int height,unsigned char* src,int sx,int sy,int imgw,int imgh,unsigned char color);
int GpBitUDBlt (GPDRAWTAG * gptag,GPDRAWSURFACE * ptgpds,int dx,int dy,int width,int height,unsigned char * src,int sx,int sy,int imgw,int imgh);
int GpTransUDBlt(GPDRAWTAG * gptag,GPDRAWSURFACE * ptgpds,int dx,int dy,int width,int height,unsigned char* src,int sx,int sy,int imgw,int imgh,unsigned char color);
int GpRectFill(GPDRAWTAG * gptag,GPDRAWSURFACE * ptgpds,int dx,int dy,int width,int height,unsigned char color);

void GpPointSet(GPDRAWSURFACE * ptgpds,int x, int y, unsigned char color);
void GpLineDraw(GPDRAWSURFACE * ptgpds,int xS,int yS,int xE,int yE,unsigned char color);
void GpRectDraw(GPDRAWSURFACE * ptgpds,int left,int top,int right,int bottom,unsigned char color);
void GpEllipseDraw(GPDRAWSURFACE * ptgpds,int xS,int yS,int w,int h,unsigned char color);

/*************************************************************************************************

GPGRAPHIC Effect API

	You must import libgpg_ex??.a for using the following:


CURRENTLY, THE FOLLOWING ARE ALLOWED

  GPC_GDFX_COPY
  GPC_GDFX_TRANS
  GPC_GDFX_EASYBLEND
  GPC_GDFX_TRANS | GPC_GDFX_EASYBLEND
  GPC_GDFX_BLEND
  GPC_GDFX_TRANS | GPC_GDFX_BLEND
  GPC_GDFX_INVERT
  GPC_GDFX_TRANS | GPC_GDFX_INVERT
  GPC_GDFX_LRFLIP
  GPC_GDFX_UDFLIP
  GPC_GDFX_TRANS | GPC_GDFX_LRFLIP
  GPC_GDFX_TRANS | GPC_GDFX_UDFLIP
  GPC_GDFX_RAYPLUS
  GPC_GDFX_TRANS | GPC_GDFX_RAYPLUS
  GPC_GDFX_TRANS | GPC_GDFX_MASKING
  GPC_GDFX_MASKING | GPC_GDFX_RAYPLUS
  GPC_GDFX_TRANS | GPC_GDFX_CHRAYPLUS
  GPC_GDFX_TRANS | GPC_GDFX_PART_RAY
  GPC_GDFX_RAYMINUS
  GPC_GDFX_TRANS | GPC_GDFX_RAYMINUS
  GPC_GDFX_MASKING | GPC_GDFX_RAYMINUS
*****************************************************************************************************/

#define GPC_GDFX_NOEFFECT	0x00
#define GPC_GDFX_COPY		0x01
#define GPC_GDFX_TRANS		0x02
#define GPC_GDFX_EASYBLEND	0x04
#define GPC_GDFX_BLEND		0x08
#define GPC_GDFX_EXCHANGE	0x10
#define GPC_GDFX_INVERT		0x20
#define GPC_GDFX_LRFLIP		0x40
#define GPC_GDFX_UDFLIP		0x80
#define GPC_GDFX_RAYPLUS	0x100
#define GPC_GDFX_MASKING	0x200
#define GPC_GDFX_CHRAYPLUS	0x400
#define GPC_GDFX_PART_RAY	0x800
#define GPC_GDFX_RAYMINUS	0x1000
#define GPC_GDFX_SRC_RPLUS	0x2000

typedef struct tagGPGD_FX{
	int fx_flag;		/*effect option*/
	int v_default;		/*default value*/
	int v_tmp;		/*temporary value*/
	int * v_list;		/*value list (not yet used)*/
}GPGD_FX;

int GpFxBlt(GPDRAWTAG *gptag, GPDRAWSURFACE *tggpds, int dx, int dy, int width, int height, GPDRAWSURFACE *srcgpds, GPGD_FX *gpfx);

#endif /*__gpgraphic_h__*/