2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Graphics function ReadPixel()
9 #include <graphics/rastport.h>
10 #include <graphics/clip.h>
11 #include <proto/graphics.h>
13 #include "graphics_intern.h"
14 #include "gfxfuncsupport.h"
16 #include <aros/debug.h>
18 struct prlut8_render_data
21 HIDDT_PixelLUT
*pixlut
;
24 static LONG
pix_read_lut8(APTR prlr_data
, OOP_Object
*bm
, OOP_Object
*gc
,
25 LONG x
, LONG y
, struct GfxBase
*GfxBase
);
27 /*****************************************************************************
31 AROS_LH3(LONG
, ReadPixel
,
34 AROS_LHA(struct RastPort
*, rp
, A1
),
35 AROS_LHA(LONG
, x
, D0
),
36 AROS_LHA(LONG
, y
, D1
),
39 struct GfxBase
*, GfxBase
, 53, Graphics
)
42 Read the pen number of the given x,y coordinate.
59 This function takes layers into account. Some pixel that is
60 being read is not found on the display-bitmap but in some
61 clipped rectangle (cliprect) in a layer structure.
62 There is no support of anything else than bitplanes now.
64 This function resembles very much the function WritePixel()!!
67 29-10-95 digulla automatically created from
68 graphics_lib.fd and clib/graphics_protos.h
70 *****************************************************************************/
74 struct prlut8_render_data prlrd
;
77 HIDDT_PixelLUT pixlut
= { AROS_PALETTE_SIZE
, HIDD_BM_PIXTAB(rp
->BitMap
) };
82 if(!OBTAIN_DRIVERDATA(rp
, GfxBase
))
85 if (IS_HIDD_BM(rp
->BitMap
))
86 prlrd
.pixlut
= &pixlut
;
92 ret
= do_pixel_func(rp
, x
, y
, pix_read_lut8
, &prlrd
, GfxBase
);
94 RELEASE_DRIVERDATA(rp
, GfxBase
);
96 if (-1 == ret
|| -1 == (LONG
)prlrd
.pen
)
98 D(bug("ReadPixel(), COULD NOT GET PEN. TRYING TO READ FROM SimpleRefresh cliprect ??"));
108 static LONG
pix_read_lut8(APTR prlr_data
, OOP_Object
*bm
, OOP_Object
*gc
,
109 LONG x
, LONG y
, struct GfxBase
*GfxBase
)
111 struct prlut8_render_data
*prlrd
;
113 prlrd
= (struct prlut8_render_data
*)prlr_data
;
115 if (NULL
!= prlrd
->pixlut
)
117 HIDD_BM_GetImageLUT(bm
, (UBYTE
*)&prlrd
->pen
, 1, x
, y
, 1, 1, prlrd
->pixlut
);
121 prlrd
->pen
= HIDD_BM_GetPixel(bm
, x
, y
);