Update to lasso handling. Adjust scroll amount based on difference between mouse...
[AROS.git] / rom / graphics / setabpendrmd.c
blob6aeb7cb1293294144eaee103696b3b271ad476cc
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$ $Log
5 Desc: Graphics function SetABPenDrMd()
6 Lang: english
7 */
8 #include "graphics_intern.h"
9 #include <proto/oop.h>
10 #include "gfxfuncsupport.h"
12 /*****************************************************************************
14 NAME */
15 #include <graphics/rastport.h>
16 #include <proto/graphics.h>
18 AROS_LH4(void, SetABPenDrMd,
20 /* SYNOPSIS */
21 AROS_LHA(struct RastPort *, rp, A1),
22 AROS_LHA(ULONG , apen, D0),
23 AROS_LHA(ULONG , bpen, D1),
24 AROS_LHA(ULONG , drawMode, D2),
26 /* LOCATION */
27 struct GfxBase *, GfxBase, 149, Graphics)
29 /* FUNCTION
30 Changes the foreground and background pen and the drawmode in one
31 step.
33 INPUTS
34 rp - Modify this RastPort
35 apen - The new foreground pen
36 bpen - The new background pen
37 drawmode - The new drawmode
39 RESULT
40 None.
42 NOTES
43 This function is faster than the sequence SetAPen(), SetBPen(),
44 SetDrMd().
46 EXAMPLE
48 BUGS
50 SEE ALSO
52 INTERNALS
54 HISTORY
55 29-10-95 digulla automatically created from
56 graphics_lib.fd and clib/graphics_protos.h
58 *****************************************************************************/
60 AROS_LIBFUNC_INIT
62 struct gfx_driverdata *dd;
64 if (OBTAIN_DRIVERDATA(rp, GfxBase))
67 dd = GetDriverData(rp);
68 if (dd)
70 struct TagItem gc_tags[] =
72 { aHidd_GC_Foreground , 0 },
73 { aHidd_GC_Background , 0 },
74 { aHidd_GC_ColorExpansionMode , 0UL },
75 { aHidd_GC_DrawMode , vHidd_GC_DrawMode_Copy},
76 { TAG_DONE }
79 gc_tags[0].ti_Data = rp->BitMap ? BM_PIXEL(rp->BitMap, apen & PEN_MASK) : apen;
80 gc_tags[1].ti_Data = rp->BitMap ? BM_PIXEL(rp->BitMap, bpen & PEN_MASK) : bpen;
82 if (drawMode & JAM2)
84 gc_tags[2].ti_Data = vHidd_GC_ColExp_Opaque;
86 else if (drawMode & COMPLEMENT)
88 gc_tags[3].ti_Data = vHidd_GC_DrawMode_Invert;
90 else if ((drawMode & (~INVERSVID)) == JAM1)
92 gc_tags[2].ti_Data = vHidd_GC_ColExp_Transparent;
95 OOP_SetAttrs(dd->dd_GC, gc_tags);
99 RELEASE_DRIVERDATA(rp, GfxBase);
101 } /* if (OBTAIN_DRIVERDATA(rp, GfxBase)) */
103 /* Do it after the driver to allow it to inspect the previous value */
104 rp->FgPen = apen;
105 rp->BgPen = bpen;
106 rp->DrawMode = drawMode;
107 rp->linpatcnt = 15;
109 AROS_LIBFUNC_EXIT
110 } /* SetABPenDrMd */