debug.library: use quick sort to sort the segments
[AROS.git] / rom / graphics / writepixel.c
blobe45a0193256150819234d1fece23dc45cf61ae9d
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
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 static LONG pix_write(APTR pr_data, OOP_Object *bm, OOP_Object *gc,
17 WORD x, WORD y, struct GfxBase *GfxBase);
19 /*****************************************************************************
21 NAME */
23 AROS_LH3(LONG, WritePixel,
25 /* SYNOPSIS */
26 AROS_LHA(struct RastPort *, rp, A1),
27 AROS_LHA(WORD , x, D0),
28 AROS_LHA(WORD , y, D1),
30 /* LOCATION */
31 struct GfxBase *, GfxBase, 54, Graphics)
33 /* FUNCTION
34 Write the primary (A) pen colour to the given coordinates of a
35 RastPort.
37 INPUTS
38 rp - destination RastPort
39 x,y - coordinate
41 RESULT
42 0: pixel could be written
43 -1: coordinate was outside rastport
45 NOTES
47 EXAMPLE
49 BUGS
51 SEE ALSO
53 INTERNALS
54 This function takes layers into account. Some pixel that is
55 being read is not found on the display-bitmap but in some
56 clipped rectangle (cliprect) in a layer structure.
58 *****************************************************************************/
60 AROS_LIBFUNC_INIT
62 IPTR pix;
64 FIX_GFXCOORD(x);
65 FIX_GFXCOORD(y);
67 if ((rp->Flags & RPF_NO_PENS) != 0)
68 pix = RP_FGCOLOR(rp);
69 else
70 pix = BM_PIXEL(rp->BitMap, (UBYTE)rp->FgPen);
72 return do_pixel_func(rp, x, y, pix_write, (APTR)pix, TRUE, GfxBase);
74 AROS_LIBFUNC_EXIT
75 } /* WritePixel */
78 static LONG pix_write(APTR pr_data, OOP_Object *bm, OOP_Object *gc,
79 WORD x, WORD y, struct GfxBase *GfxBase)
81 HIDD_BM_PutPixel(bm, x, y, (IPTR)pr_data);
83 return 0;