2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
9 #include <hidd/graphics.h>
10 #include <aros/debug.h>
12 #include "cybergraphics_intern.h"
19 static LONG
PixelHook(struct render_data
*data
, OOP_Object
*bm
, OOP_Object
*gc
,
20 LONG x
, LONG y
, struct GfxBase
*GfxBase
);
22 /*****************************************************************************
25 #include <proto/cybergraphics.h>
27 AROS_LH4(LONG
, WriteRGBPixel
,
30 AROS_LHA(struct RastPort
*, rp
, A1
),
31 AROS_LHA(UWORD
, x
, D0
),
32 AROS_LHA(UWORD
, y
, D1
),
33 AROS_LHA(ULONG
, pixel
, D2
),
36 struct Library
*, CyberGfxBase
, 19, Cybergraphics
)
39 Writes a new color value to a pixel in a RastPort.
42 rp - the RastPort to write to.
43 x, y - the coordinates of the pixel to write.
44 pixel - the pixel's new color value in 32-bit ARGB format: 1 byte
45 per component, in the order alpha, red, green, blue.
48 error - 0 if no error occurred, or -1 if (x, y) is outside the
61 *****************************************************************************/
65 struct render_data data
;
69 /* This is cybergraphx. We only work wih HIDD bitmaps */
70 if (!IS_HIDD_BM(rp
->BitMap
))
72 D(bug("!!!!! Trying to use CGFX call on non-hidd bitmap "
73 "in WriteRGBPixel() !!!\n"));
77 /* HIDDT_ColComp are 16 Bit */
79 col
.alpha
= (HIDDT_ColComp
)((pixel
>> 16) & 0x0000FF00);
80 col
.red
= (HIDDT_ColComp
)((pixel
>> 8) & 0x0000FF00);
81 col
.green
= (HIDDT_ColComp
)(pixel
& 0x0000FF00);
82 col
.blue
= (HIDDT_ColComp
)((pixel
<< 8) & 0x0000FF00);
84 data
.pixel
= HIDD_BM_MapColor(HIDD_BM_OBJ(rp
->BitMap
), &col
);
86 retval
= DoPixelFunc(rp
, x
, y
, PixelHook
, &data
, TRUE
);
93 static LONG
PixelHook(struct render_data
*data
, OOP_Object
*bm
, OOP_Object
*gc
,
94 LONG x
, LONG y
, struct GfxBase
*GfxBase
)
96 HIDD_BM_PutPixel(bm
, x
, y
, data
->pixel
);