XORPAINT.H
[目次 | 型・クラス・構造体 | マクロ]
1|/**************************************************************************
2|* 1. <<< 塗りつぶし (XorPaint) >>>
3|***************************************************************************/
4|
5|#ifndef __XORPAINT_H
6|#define __XORPAINT_H
7|
8|/*----------------------------------------------------------------------
9|[Module Property]
10|name = XorPaint
11|title = XOR による塗りつぶし
12|category = グラフィック
13|src = xorpaint.c
14|depend = Draw, DScreen, Screen
15|priority =
16|accord =
17|----------------------------------------------------------------------*/
18|
19|#ifndef USES_PRIORITY_HEADER
20|/*[START_OF_PRIORITY_HEADER]*/
21|
22|#define USES_XORPAINT
23|typedef struct _XorPaint XorPaint;
24|
25|/*[END_OF_PRIORITY_HEADER]*/
26|#endif /* USES_PRIORITY_HEADER */
27|
28|
29|#ifndef USES_DRAW
30|#error need DRAW
31|#endif
32|#include "draw.h"
33|#ifndef USES_DSCREEN
34|#error
35|#endif
36|#include "dscreen.h"
37|#ifndef USES_SCREEN
38|#error
39|#endif
40|#include "screen.h"
41|
42|/*------------------------------------------------------------------*/
43|/*--- Interface Area -----------------------------------------------*/
44|/*------------------------------------------------------------------*/
45|
46|/*********************************************************************
47|* 2. <<< 領域塗りつぶしツール [XorPaint] >>>
48|*【役割】
49|*・グラフィック画面中の特定の領域を塗りつぶします。
50|*【補足】
51|*・領域は、線分または曲線の集合で指定します。
52|*・境界線を描かない場合は、塗りつぶす色で境界線を描いた場合と同じです。
53|*・paintPattern == NULL にすると、width × height の矩形領域が黒くなって
54|* しまうので、Mask_A_initByPlain() 関数を用いて、明示的に色を指定して
55|* ください。
56|*【内部補足】
57|*・境界線を描く部分は、boundPlane と linePlane に描画し、
58|* 境界線を描かない部分は、boundPlane にのみ描画します。
59|*・bLine == false なら、linePlane, linePatern は無効になり、
60|* 境界線のプレーンのためのメモリ領域を確保する必要は無くなります。
61|*・マスク対応 Draw_line があれば、boundPlane と linePlane を
62|* 1つにしてメモリを節約することができます。(未定)
63|*・領域の座標範囲を用いて、塗りつぶしなどの処理を最適化します。
64|*・bNoBound = true なら、minX,maxX,minY,maxY は無効です。
65|*・minX と maxX は UINT32 アラインメントに揃えています。
66|*********************************************************************/
67|struct _XorPaint {
68|
69| /* ワーク用プレーン */
70| Draw paintPlane; /* 塗りつぶし領域のプレーン */
71| Screen paintPlaneX;
72| Draw boundPlane; /* 塗りつぶし境界のプレーン */
73| DScreen boundPlaneX;
74| bool bLine; /* 境界線を描く可能性があるかどうか */
75| Draw linePlane; /* 境界線のプレーン */
76| DScreen linePlaneX;
77|
78| /* 塗りつぶすパターン */
79| Mask_A* paintPattern; /* 塗りつぶすパターン */
80|
81| /* 領域の座標範囲 */
82| bool bNoBound; /* 最大最小の候補がまだ1つも無い = true */
83| int minX; int maxX; /* 領域の座標範囲 X */
84| int minY; int maxY; /* 領域の座標範囲 Y */
85|};
86|
87|/* 操作 */
88|void XorPaint_init( XorPaint*, char* buf, size_t buf_sizeof,
89| int width, int height, Mask_A* paintPattern );
90|void XorPaint_init2( XorPaint*, char* buf, size_t buf_sizeof,
91| int width, int height, Mask_A* paintPattern );
92|void XorPaint_clear( XorPaint* );
93|void XorPaint_flushTo( XorPaint*, DrawScr target, int x, int y );
94|void XorPaint_setBound( XorPaint*, int x1, int y1, int x2, int y2 );
95|void XorPaint_drawLine( XorPaint*, int x1, int y1, int x2, int y2,
96| int color );
97|#ifdef USES_SSTACK
98|void XorPaint_setBezierBound( XorPaint*, int x1, int y1, int x2, int y2,
99| int x3, int y3, int x4, int y4 );
100|void XorPaint_drawBezierLine( XorPaint*, int x1, int y1, int x2, int y2,
101| int x3, int y3, int x4, int y4, int color );
102|#endif /* USES_SSTACK */
103|
104|/* private */
105|void XorPaint_setRange( XorPaint*, int x, int y );
106|
107|#endif
108|
109|