SCREEN16.H
[目次 | 型・クラス・構造体 | マクロ]
1|/***********************************************************************
2|* 1. <<< 16bpp グラフィック画面 (Screen16) >>>
3|************************************************************************/
4|
5|#ifndef __SCREEN16_H
6|#define __SCREEN16_H
7|
8|/*----------------------------------------------------------------------
9|[Module Property]
10|name = Screen16
11|title = 16bpp グラフィック画面
12|category = グラフィック
13|src = screen16.c
14|depend = Types
15|priority =
16|accord =
17|----------------------------------------------------------------------*/
18|
19|#ifndef USES_PRIORITY_HEADER
20|/*[START_OF_PRIORITY_HEADER]*/
21|
22|#define USES_SCREEN16
23|struct _Screen16; typedef struct _Screen16 Screen16;
24|struct _Screen16_C; typedef struct _Screen16_C Screen16_C;
25|
26|/*[END_OF_PRIORITY_HEADER]*/
27|#endif /* USES_PRIORITY_HEADER */
28|
29|
30|
31|/*************************************************************************
32|* 2. <<< エラーコード >>>
33|**************************************************************************/
34|
35|#define Screen16_Err_WidthOver 810 /* [Compone_GID:Errors_Code] */
36|
37|/*-------------------------------------------------------------------*/
38|/* 3. <<< Interface Area ------------------------------------------ >>> */
39|/*-------------------------------------------------------------------*/
40|
41|#ifdef __cplusplus
42|extern "C" {
43|#endif
44|
45|
46|
47|/************************************************************************
48|* 4. <<< 16bpp グラフィック画面 [Screen16]★ >>>
49|*【補足】
50|*・int 型が 32bit の処理系のみ対応しています。
51|*************************************************************************/
52|struct _Screen16 {
53| char* adr; /* フレームバッファの先頭アドレス */
54| int width; int height; /* 大きさ */
55|};
56|
57|void Screen16_init( Screen16*, char* adr, int size, int width, int height );
58|int Screen16_getNeedMemSize( int width, int height );
59|void Screen16_print( Screen16*, const char* title );
60|void Screen16_clear( Screen16*, int color );
61|void Screen16_pset( Screen16*, int x, int y, int color );
62|void Screen16_pset_m( Screen16*, int x, int y, int color );
63|void Screen16_pset_f( Screen16*, int x, int y, int color );
64|int Screen16_pget( Screen16*, int x, int y );
65|char* Screen16_pgetAdr( Screen16*, int x, int y );
66|int Screen16_putZ( Screen16*, int x, int y, int z );
67|void Screen16_line( Screen16*, int x1, int y1, int x2, int y2, int color );
68|void Screen16_pline( Screen16*, int x1, int y1, int x2, int y2, int color,
69| void* pattern, int nPixel, int* iStartPixel );
70|void Screen16_drawImg( Screen16*, char* img_adr,
71| int img_width, int img_height, int this_x, int this_y );
72|void Screen16_drawImgTile( Screen16*, char* img_adr,
73| int img_width, int img_height );
74|#ifdef USES_BMPSRC
75| void Screen16_drawBmpSrc( Screen16*, int this_x, int this_y,
76| BmpSrc* bmp );
77| void Screen16_drawBmpSrcTile( Screen16*, BmpSrc* bmp );
78| void Screen16_printBmpSrc( Screen16*, int x, int y, int w, int h );
79|#endif
80|void Screen16_outBmp( Screen16*, char* buf, int width, int height, int bpp );
81|bool Screen16_isEqualFRB( Screen16*, Screen16* );
82|
83|#ifdef USES_MMPAINT
84|#ifdef USES_MASK
85|#ifdef USES_TYPEX
86|void Screen16_paintByMMPaint( Screen16*, MMPaint* paint, int color );
87|#endif /* USES_TYPEX */
88|#endif /* USES_MMPAINT */
89|#endif /* USES_MASK */
90|
91|#ifdef USES_MMPAINT2
92|#ifdef USES_D54SOFT
93|void Screen16_drawPolyByDDA( Screen16* screen, Screen16* zbuf,
94| MMPaint2* poly );
95|void Screen16_drawPolyByDDA_V( Screen16* screen, Screen16* zbuf,
96| MMPaint2_V* poly );
97|#endif
98|#endif
99|
100|#ifdef USES_DRAWSCR
101|DrawScr Screen16_inf_DrawScr( Screen16* );
102|Screen16* Screen16_by_DrawScr( DrawScr );
103|#endif
104|
105|#ifdef USES_DRAW2
106|void Screen16_psetForCircle( void* obj, int cx, int cy, int d1, int d2 );
107|void Screen16_psetForEllipse( void* obj, int cx, int cy, int d1, int d2 );
108|#endif
109|
110|/* マクロ定義*/
111|#ifdef USES_DRAWSCR
112|#ifdef NDEBUG
113|#define Screen16_by_DrawScr(inf) INF_SUB_MACRO( Screen16, DrawScr, Screen16_by_DrawScr )
114|#endif
115|#endif
116|
117|#ifdef __cplusplus
118|}
119|#endif
120|
121|
122|
123|/************************************************************************
124|* 5. <<< 16bpp グラフィック画面と描画属性 [Screen16_C]★ >>>
125|*************************************************************************/
126|struct _Screen16_C {
127| Screen16 scr;
128| int color1;
129| int color2;
130|};
131|
132|
133|/*-------------------------------------------------------------------*/
134|/* 6. <<< Mapping Area -------------------------------------------- >>> */
135|/*-------------------------------------------------------------------*/
136|
137|
138|
139|/*********************************************************************
140|* 7. <<< [Screen16_getNeedMemSize] バッファに必要なメモリサイズ(byte)を返す >>>
141|*【引数】
142|* ・int width, height; フレームバッファのサイズ
143|*********************************************************************/
144|#define Screen16_getNeedMemSize( width, height ) \
145| ((width) * (height) * 2)
146|
147|
148|
149|/************************************************************************
150|* 8. <<< [Screen16_pset, Screen16_pset_m] 点を描画する(マクロ版)>>>
151|*************************************************************************/
152|#ifdef NDEBUG
153| #define Screen16_pset Screen16_pset_m
154|#else
155| #define Screen16_pset Screen16_pset_f
156|#endif
157|
158|#define Screen16_pset_m( this, x, y, color ) \
159| ( *(unsigned short*)Screen16_pgetAdr( this, x, y ) = \
160| (unsigned short)(unsigned int) (color) )
161|
162|
163|
164|/************************************************************************
165|* 9. <<< [Screen16_pget] 指定座標の色を返す >>>
166|*************************************************************************/
167|#define Screen16_pget( this, x, y ) \
168| ((int)*(unsigned short*)Screen16_pgetAdr( this, x, y ))
169|
170|
171|
172|
173|
174|/************************************************************************
175|* 10. <<< [Screen16_pgetAdr] 指定座標のアドレスを返す >>>
176|*************************************************************************/
177|#define Screen16_pgetAdr( this, x, y ) \
178| ( (char*)((this)->adr) + ( ((x) + (y) * (this)->width) * 2) )
179|
180|
181|
182|/***********************************************************************
183|* 11. <<< [Screen16_drawBmpSrc] ビットマップ・ソースを画面に表示する >>>
184|* 12. <<< [Screen16_drawBmpSrcTile] ビットマップ・ソースを画面にタイル表示する >>>
185|*【引数】
186|* ・int this_x, this_y; 表示位置(RGB データの左上座標)
187|* ・BmpSrc* bmp; ビットマップ・ソース
188|*【補足】
189|*・bmp には、Bmp2Src ツールによって作られた ???_get() 関数の返り値を
190|* 指定してください。
191|************************************************************************/
192|#ifdef USES_BMPSRC
193| #define Screen16_drawBmpSrc( this, this_x, this_y, _bmp ) \
194| Screen16_drawImg( this, (char*)(_bmp)->bmp, (_bmp)->width, (_bmp)->height, this_x, this_y );
195| #define Screen16_drawBmpSrcTile( this, _bmp ) \
196| Screen16_drawImgTile( this, (char*)(_bmp)->bmp, (_bmp)->width, (_bmp)->height );
197|#endif
198|
199|#endif /* __SCREEN16_H */
200|
201|