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_LH3(ULONG
, ReadRGBPixel
,
30 AROS_LHA(struct RastPort
*, rp
, A1
),
31 AROS_LHA(UWORD
, x
, D0
),
32 AROS_LHA(UWORD
, y
, D1
),
35 struct Library
*, CyberGfxBase
, 18, Cybergraphics
)
38 Reads a particular pixel's color value from a RastPort.
41 rp - the RastPort to read from.
42 x, y - the coordinates of the pixel to read.
45 color - the pixel's color value in 32-bit ARGB format: 1 byte
46 per component, in the order alpha, red, green, blue.
58 *****************************************************************************/
62 struct render_data data
;
67 /* This is cybergraphx. We only work wih HIDD bitmaps */
68 if (!IS_HIDD_BM(rp
->BitMap
))
70 D(bug("!!!!! Trying to use CGFX call on non-hidd bitmap "
71 "in ReadRGBPixel()!!!\n"));
75 /* Get the HIDD pixel val */
76 ret
= DoPixelFunc(rp
, x
, y
, PixelHook
, &data
, FALSE
);
81 HIDD_BM_UnmapPixel(HIDD_BM_OBJ(rp
->BitMap
), data
.pixel
, &col
);
83 /* HIDDT_ColComp are 16 Bit */
85 pix
= ((col
.alpha
& 0xFF00) << 16)
86 | ((col
.red
& 0xFF00) << 8)
87 | (col
.green
& 0xFF00)
88 | ((col
.blue
& 0xFF00) >> 8);
95 static LONG
PixelHook(struct render_data
*data
, OOP_Object
*bm
, OOP_Object
*gc
,
96 LONG x
, LONG y
, struct GfxBase
*GfxBase
)
98 data
->pixel
= HIDD_BM_GetPixel(bm
, x
, y
);