1 /*****************************************************************************
2 * This file is part of gfxprim library. *
4 * Gfxprim is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
9 * Gfxprim is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with gfxprim; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17 * Boston, MA 02110-1301 USA *
19 * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos *
20 * <jiri.bluebear.dluhos@gmail.com> *
22 * Copyright (C) 2009-2011 Cyril Hrubis <metan@ucw.cz> *
24 *****************************************************************************/
28 void GP_RectXYXY_Raw(GP_Context
*context
, GP_Coord x0
, GP_Coord y0
,
29 GP_Coord x1
, GP_Coord y1
, GP_Pixel pixel
)
31 GP_HLine_Raw(context
, x0
, x1
, y0
, pixel
);
32 GP_HLine_Raw(context
, x0
, x1
, y1
, pixel
);
33 GP_VLine_Raw(context
, x0
, y0
, y1
, pixel
);
34 GP_VLine_Raw(context
, x1
, y0
, y1
, pixel
);
37 void GP_RectXYWH_Raw(GP_Context
*context
, GP_Coord x
, GP_Coord y
,
38 GP_Size w
, GP_Size h
, GP_Pixel pixel
)
40 GP_HLine_Raw(context
, x
, x
+ w
, y
, pixel
);
41 GP_HLine_Raw(context
, x
, x
+ w
, y
+ h
, pixel
);
42 GP_VLine_Raw(context
, x
, y
, y
+ h
, pixel
);
43 GP_VLine_Raw(context
, x
+ w
, y
, y
+ h
, pixel
);
46 void GP_RectXYXY(GP_Context
*context
, GP_Coord x0
, GP_Coord y0
,
47 GP_Coord x1
, GP_Coord y1
, GP_Pixel pixel
)
49 GP_CHECK_CONTEXT(context
);
51 GP_TRANSFORM_POINT(context
, x0
, y0
);
52 GP_TRANSFORM_POINT(context
, x1
, y1
);
54 GP_RectXYXY_Raw(context
, x0
, y0
, x1
, y1
, pixel
);
57 void GP_RectXYWH(GP_Context
*context
, GP_Coord x
, GP_Coord y
,
58 GP_Size w
, GP_Size h
, GP_Pixel pixel
)
60 GP_RectXYXY(context
, x
, y
, x
+ w
, y
+ h
, pixel
);
63 void GP_FillRectXYXY_Raw(GP_Context
*context
, GP_Coord x0
, GP_Coord y0
,
64 GP_Coord x1
, GP_Coord y1
, GP_Pixel pixel
)
66 GP_CHECK_CONTEXT(context
);
72 for (y
= y0
; y
<= y1
; y
++)
73 GP_HLine_Raw(context
, x0
, x1
, y
, pixel
);
76 void GP_FillRectXYWH_Raw(GP_Context
*context
, GP_Coord x
, GP_Coord y
,
77 GP_Size w
, GP_Size h
, GP_Pixel pixel
)
79 /* zero width/height: draw nothing */
83 GP_FillRectXYXY_Raw(context
, x
, y
, x
+ w
- 1, y
+ h
- 1, pixel
);
86 void GP_FillRectXYXY(GP_Context
*context
, GP_Coord x0
, GP_Coord y0
,
87 GP_Coord x1
, GP_Coord y1
, GP_Pixel pixel
)
89 GP_CHECK_CONTEXT(context
);
91 GP_TRANSFORM_POINT(context
, x0
, y0
);
92 GP_TRANSFORM_POINT(context
, x1
, y1
);
94 GP_FillRect_Raw(context
, x0
, y0
, x1
, y1
, pixel
);
97 void GP_FillRectXYWH(GP_Context
*context
, GP_Coord x
, GP_Coord y
,
98 GP_Size w
, GP_Size h
, GP_Pixel pixel
)
100 /* zero width/height: draw nothing */
101 if (w
== 0 || h
== 0)
104 GP_FillRectXYXY(context
, x
, y
, x
+ w
- 1, y
+ h
- 1, pixel
);