2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
9 #include <aros/debug.h>
10 #include <proto/graphics.h>
11 #include <proto/oop.h>
13 #include "graphics_intern.h"
14 #include "gfxfuncsupport.h"
16 /****************************************************************************************/
20 HIDDT_PixelLUT pixlut
;
31 static ULONG
bltpattern_render(APTR bpr_data
, WORD srcx
, WORD srcy
,
32 OOP_Object
*dstbm_obj
, OOP_Object
*dst_gc
,
33 struct Rectangle
*rect
, struct GfxBase
*GfxBase
)
35 struct bp_render_data
*bprd
= bpr_data
;
36 WORD width
= rect
->MaxX
- rect
->MinX
+ 1;
37 WORD height
= rect
->MaxY
- rect
->MinY
+ 1;
38 UBYTE
*mask
= bprd
->mask
+ bprd
->maskmodulo
* srcy
;
39 WORD patsrcx
= (srcx
+ bprd
->renderx1
) % 16;
40 WORD patsrcy
= (srcy
+ bprd
->rendery1
) % bprd
->patternheight
;
45 patsrcy
+= bprd
->patternheight
;
47 HIDD_BM_PutPattern(dstbm_obj
, dst_gc
, bprd
->pattern
,
48 patsrcx
, patsrcy
, bprd
->patternheight
, bprd
->patterndepth
,
49 &bprd
->pixlut
, bprd
->invertpattern
, mask
, bprd
->maskmodulo
,
50 srcx
, rect
->MinX
, rect
->MinY
, width
, height
);
52 return width
* height
;
55 /*****************************************************************************
58 #include <clib/graphics_protos.h>
60 AROS_LH7(void, BltPattern
,
63 AROS_LHA(struct RastPort
*, rp
, A1
),
64 AROS_LHA(PLANEPTR
, mask
, A0
),
65 AROS_LHA(WORD
, xMin
, D0
),
66 AROS_LHA(WORD
, yMin
, D1
),
67 AROS_LHA(WORD
, xMax
, D2
),
68 AROS_LHA(WORD
, yMax
, D3
),
69 AROS_LHA(ULONG
, byteCnt
, D4
),
72 struct GfxBase
*, GfxBase
, 52, Graphics
)
75 Blit using drawmode, areafill pattern and mask.
78 rp - destination RastPort for blit.
79 mask - Mask bitplane. Set this to NULL for a rectangle.
80 xMin, yMin - upper left corner.
81 xMax, yMax - lower right corner.
82 byteCnt - BytesPerRow for mask.
97 27-11-96 digulla automatically created from
98 graphics_lib.fd and clib/graphics_protos.h
100 *****************************************************************************/
106 struct bp_render_data bprd
;
112 bprd
.pattern
= (UBYTE
*)rp
->AreaPtrn
;
114 bprd
.maskmodulo
= byteCnt
;
115 bprd
.patterndepth
= (rp
->AreaPtSz
>= 0) ? 1 : rp
->BitMap
->Depth
;
116 bprd
.patternheight
= 1L << ((rp
->AreaPtSz
>= 0) ? rp
->AreaPtSz
: -rp
->AreaPtSz
);
117 bprd
.renderx1
= xMin
;
118 bprd
.rendery1
= yMin
;
119 bprd
.invertpattern
= (rp
->DrawMode
& INVERSVID
) ? TRUE
: FALSE
;
120 bprd
.pixlut
.entries
= bprd
.patterndepth
;
121 bprd
.pixlut
.pixels
= IS_HIDD_BM(rp
->BitMap
) ? HIDD_BM_PIXTAB(rp
->BitMap
) : NULL
;
128 do_render_func(rp
, NULL
, &rr
, bltpattern_render
, &bprd
, TRUE
, FALSE
, GfxBase
);
134 ULONG old_drawmode
= GetDrMd(rp
);
136 if ((old_drawmode
& ~INVERSVID
) == JAM2
)
137 SetDrMd(rp
, JAM1
| (old_drawmode
& INVERSVID
));
139 BltTemplate(mask
, 0, byteCnt
, rp
, xMin
, yMin
, xMax
- xMin
+ 1, yMax
- yMin
+ 1);
141 SetDrMd(rp
, old_drawmode
);
145 RectFill(rp
, xMin
, yMin
, xMax
, yMax
);