summaryrefslogtreecommitdiff
path: root/iup/src/iup_draw.h
blob: b4d08e375e0fe54c158f7d23dba447b378b23318 (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
/** \file
 * \brief Simple Draw API.
 *
 * See Copyright Notice in "iup.h"
 */
 
#ifndef __IUP_DRAW_H 
#define __IUP_DRAW_H

#ifdef __cplusplus
extern "C"
{
#endif

/** \defgroup draw Simple Draw API
 * \par
 * See \ref iup_draw.h
 * \ingroup util */



struct _IdrawCanvas;
typedef struct _IdrawCanvas IdrawCanvas;


/** Creates a draw canvas based on an IupCanvas.
 * This will create an image for offscreen drawing.
 * \ingroup draw */
IdrawCanvas* iupDrawCreateCanvas(Ihandle* ih);

/** Destroys the IdrawCanvas.
 * \ingroup draw */
void iupDrawKillCanvas(IdrawCanvas* dc);

/** Draws the ofscreen image on the screen.
 * \ingroup draw */
void iupDrawFlush(IdrawCanvas* dc);

/** Rebuild the offscreen image if the canvas size has changed.
 * Automatically done in iupDrawCreateCanvas.
 * \ingroup draw */
void iupDrawUpdateSize(IdrawCanvas* dc);

/** Returns the canvas size available for drawing.
 * \ingroup draw */
void iupDrawGetSize(IdrawCanvas* dc, int *w, int *h);

/** Draws the parent background.
 * \ingroup draw */
void iupDrawParentBackground(IdrawCanvas* dc);

/** Draws a line.
 * \ingroup draw */
void iupDrawLine(IdrawCanvas* dc, int x1, int y1, int x2, int y2, unsigned char r, unsigned char g, unsigned char b);

/** Draws a filled/hollow rectangle.
 * \ingroup draw */
void iupDrawRectangle(IdrawCanvas* dc, int x1, int y1, int x2, int y2, unsigned char r, unsigned char g, unsigned char b, int filled);

/** Draws a filled/hollow arc.
 * \ingroup draw */
void iupDrawArc(IdrawCanvas* dc, int x1, int y1, int x2, int y2, double a1, double a2, unsigned char r, unsigned char g, unsigned char b, int filled);

/** Draws a filled/hollow polygon.
 * points are arranged xyxyxy...
 * \ingroup draw */
void iupDrawPolygon(IdrawCanvas* dc, int* points, int count, unsigned char r, unsigned char g, unsigned char b, int filled);

/** Draws a text.
 * x,y is at left,top corner of the text.
 * \ingroup draw */
void iupDrawText(IdrawCanvas* dc, const char* text, int len, int x, int y, unsigned char r, unsigned char g, unsigned char b);

/** Draws an image.
 * x,y is at left,top corner of the image.
 * \ingroup draw */
void iupDrawImage(IdrawCanvas* dc, const char* name, int make_inactive, int x, int y);

/** Sets a rectangle clipping area.
 * \ingroup draw */
void iupDrawSetClipRect(IdrawCanvas* dc, int x1, int y1, int x2, int y2);

/** Removes clipping.
 * \ingroup draw */
void iupDrawResetClip(IdrawCanvas* dc);

/*
TO DO:
- check position and size of primitives
*/


#ifdef __cplusplus
}
#endif

#endif