2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Code for miscellaneous operations needed bz graphics
9 #include <proto/exec.h>
10 #include <proto/graphics.h>
11 #include <clib/macros.h>
12 #include <exec/memory.h>
13 #include <graphics/text.h>
14 #include <graphics/rastport.h>
15 #include "graphics_intern.h"
19 BOOL
pattern_pen(struct RastPort
*rp
, WORD x
, WORD y
, ULONG apen
, ULONG bpen
, ULONG
*pixval_ptr
, struct GfxBase
*GfxBase
)
22 ULONG set_pixel
, pixval
= 0;
24 ULONG drmd
= GetDrMd(rp
);
25 ULONG pattern_height
= 1L << ABS(rp
->AreaPtSz
);
26 const UBYTE
*apt
= (UBYTE
*)rp
->AreaPtrn
;
29 idx
= COORD_TO_BYTEIDX(x
& 0x0F, y
& (pattern_height
- 1), 2);
30 mask
= XCOORD_TO_MASK( x
);
32 /* kprintf("palette_pen: idx=%d, mask=%d,apen=%d, bpen=%d, drmd=%d, apt[idx]=%d\n"
33 , idx, mask, apen, bpen, drmd, apt[idx]);
35 /* Mono- or multicolor ? */
39 set_pixel
= apt
[idx
] & mask
;
41 set_pixel
= ((set_pixel
!= 0) ? 0UL : 1UL );
45 /* Use FGPen to render */
47 /* kprintf("use apen\n");
51 if ((drmd
& JAM2
) != 0)
55 /* kprintf("use bpen\n");
59 /* Do not set pixel */
70 ULONG plane_size
, pen_mask
= 0;
73 plane_size
= (/* bytesperrow = */ 2 ) * pattern_height
;
74 depth
= GetBitMapAttr(rp
->BitMap
, BMA_DEPTH
);
78 /* multicolored pattern, get pixel from all planes */
79 for (i
= 0; i
< depth
; i
++)
84 if ((plane
[idx
] & mask
) != 0)