Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / cgfx / fillpixelarray.c
blob780532ad44ae53f87cda8c0da1ae914b7045a3c8
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <hidd/graphics.h>
10 #include <aros/debug.h>
12 #include "cybergraphics_intern.h"
14 /*****************************************************************************
16 NAME */
17 #include <proto/cybergraphics.h>
19 AROS_LH6(ULONG, FillPixelArray,
21 /* SYNOPSIS */
22 AROS_LHA(struct RastPort *, rp , A1),
23 AROS_LHA(UWORD , destx , D0),
24 AROS_LHA(UWORD , desty , D1),
25 AROS_LHA(UWORD , width , D2),
26 AROS_LHA(UWORD , height , D3),
27 AROS_LHA(ULONG , pixel , D4),
29 /* LOCATION */
30 struct Library *, CyberGfxBase, 25, Cybergraphics)
32 /* FUNCTION
33 Writes the same color value to all pixels in a rectangular region of
34 a RastPort.
36 INPUTS
37 rp - the RastPort to write to.
38 destx, desty - top-lefthand corner of portion of destination RastPort
39 to write to (in pixels).
40 width, height - size of the affected area (in pixels).
41 pixel - the color value to use, in 32-bit ARGB format: 1 byte per
42 component, in the order alpha, red, green, blue.
44 RESULT
45 count - the number of pixels filled.
47 NOTES
49 EXAMPLE
51 BUGS
53 SEE ALSO
55 INTERNALS
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
61 HIDDT_Color col;
62 HIDDT_Pixel pix;
64 /* HIDDT_ColComp are 16 Bit */
65 col.alpha = (HIDDT_ColComp)((pixel >> 16) & 0x0000FF00);
66 col.red = (HIDDT_ColComp)((pixel >> 8) & 0x0000FF00);
67 col.green = (HIDDT_ColComp)(pixel & 0x0000FF00);
68 col.blue = (HIDDT_ColComp)((pixel << 8) & 0x0000FF00);
70 pix = HIDD_BM_MapColor(HIDD_BM_OBJ(rp->BitMap), &col);
72 return (LONG)FillRectPenDrMd(rp, destx, desty, destx + width - 1,
73 desty + height - 1, pix, vHidd_GC_DrawMode_Copy, TRUE);
75 AROS_LIBFUNC_EXIT
76 } /* FillPixelArray */