define __KERNEL_STRICT_NAMES to avoid inclusion of kernel types on systems that carry...
[cake.git] / rom / graphics / writepixel.c
blobbf35b8f61fa763bf2010a3d3620de74078e95dca
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$ $Log
5 Desc: Graphics function WritePixel()
6 Lang: english
7 */
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 struct pix_render_data
18 HIDDT_Pixel pixel;
21 static LONG pix_write(APTR pr_data, OOP_Object *bm, OOP_Object *gc,
22 LONG x, LONG y, struct GfxBase *GfxBase);
24 /*****************************************************************************
26 NAME */
28 AROS_LH3(LONG, WritePixel,
30 /* SYNOPSIS */
31 AROS_LHA(struct RastPort *, rp, A1),
32 AROS_LHA(LONG , x, D0),
33 AROS_LHA(LONG , y, D1),
35 /* LOCATION */
36 struct GfxBase *, GfxBase, 54, Graphics)
38 /* FUNCTION
39 Change pen number of a pixel at given coordinate.
40 The pixel is drawn with the primary (A) pen.
42 INPUTS
43 rp - destination RastPort
44 x,y - coordinate
46 RESULT
47 0: pixel could be written
48 -1: coordinate was outside rastport
50 NOTES
52 EXAMPLE
54 BUGS
56 SEE ALSO
58 INTERNALS
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.
63 (No chunky pixels)
65 HISTORY
66 29-10-95 digulla automatically created from
67 graphics_lib.fd and clib/graphics_protos.h
69 *****************************************************************************/
71 AROS_LIBFUNC_INIT
73 struct pix_render_data prd;
74 LONG retval;
76 FIX_GFXCOORD(x);
77 FIX_GFXCOORD(y);
79 if(!OBTAIN_DRIVERDATA(rp, GfxBase))
80 return -1L;
82 prd.pixel = BM_PIXEL(rp->BitMap, (UBYTE)rp->FgPen);
83 retval = do_pixel_func(rp, x, y, pix_write, &prd, TRUE, GfxBase);
85 RELEASE_DRIVERDATA(rp, GfxBase);
87 return retval;
89 AROS_LIBFUNC_EXIT
90 } /* WritePixel */
93 static LONG pix_write(APTR pr_data, OOP_Object *bm, OOP_Object *gc,
94 LONG x, LONG y, struct GfxBase *GfxBase)
96 struct pix_render_data *prd;
98 prd = (struct pix_render_data *)pr_data;
100 HIDD_BM_PutPixel(bm, x, y, prd->pixel);
102 return 0;