r4493@vps: verhaegs | 2007-04-19 14:44:00 -0400
[AROS.git] / rom / graphics / setabpendrmd.c
blob4ccb5868352ef4696bbb8e2bdc8df302337f1e1e
1 /*
2 Copyright © 1995-2001, 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
61 AROS_LIBBASE_EXT_DECL(struct GfxBase *,GfxBase)
63 struct gfx_driverdata *dd;
65 if (OBTAIN_DRIVERDATA(rp, GfxBase))
68 dd = GetDriverData(rp);
69 if (dd)
71 struct TagItem gc_tags[] =
73 { aHidd_GC_Foreground , 0 },
74 { aHidd_GC_Background , 0 },
75 { aHidd_GC_ColorExpansionMode , 0UL },
76 { aHidd_GC_DrawMode , vHidd_GC_DrawMode_Copy},
77 { TAG_DONE }
80 gc_tags[0].ti_Data = rp->BitMap ? BM_PIXEL(rp->BitMap, apen & PEN_MASK) : apen;
81 gc_tags[1].ti_Data = rp->BitMap ? BM_PIXEL(rp->BitMap, bpen & PEN_MASK) : bpen;
83 if (drawMode & JAM2)
85 gc_tags[2].ti_Data = vHidd_GC_ColExp_Opaque;
87 else if (drawMode & COMPLEMENT)
89 gc_tags[3].ti_Data = vHidd_GC_DrawMode_Invert;
91 else if ((drawMode & (~INVERSVID)) == JAM1)
93 gc_tags[2].ti_Data = vHidd_GC_ColExp_Transparent;
96 OOP_SetAttrs(dd->dd_GC, gc_tags);
100 RELEASE_DRIVERDATA(rp, GfxBase);
102 } /* if (OBTAIN_DRIVERDATA(rp, GfxBase)) */
104 /* Do it after the driver to allow it to inspect the previous value */
105 rp->FgPen = apen;
106 rp->BgPen = bpen;
107 rp->DrawMode = drawMode;
108 rp->linpatcnt = 15;
110 AROS_LIBFUNC_EXIT
111 } /* SetABPenDrMd */