2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
9 #include <aros/debug.h>
10 #include <graphics/rastport.h>
11 #include <hidd/graphics.h>
13 #include "cybergraphics_intern.h"
14 #include "gfxfuncsupport.h"
16 /*****************************************************************************
19 #include <proto/cybergraphics.h>
21 AROS_LH11(LONG
, WriteLUTPixelArray
,
24 AROS_LHA(APTR
, srcRect
, A0
),
25 AROS_LHA(UWORD
, SrcX
, D0
),
26 AROS_LHA(UWORD
, SrcY
, D1
),
27 AROS_LHA(UWORD
, SrcMod
, D2
),
28 AROS_LHA(struct RastPort
*, rp
, A1
),
29 AROS_LHA(APTR
, CTable
, A2
),
30 AROS_LHA(UWORD
, DestX
, D3
),
31 AROS_LHA(UWORD
, DestY
, D4
),
32 AROS_LHA(UWORD
, SizeX
, D5
),
33 AROS_LHA(UWORD
, SizeY
, D6
),
34 AROS_LHA(UBYTE
, CTabFormat
, D7
),
37 struct Library
*, CyberGfxBase
, 33, Cybergraphics
)
40 Copies all or part of a rectangular block of raw pen values to a
41 RastPort. The pen values are converted to the RastPort's native pixel
45 srcRect - pointer to the pixel values.
46 SrcX, SrcY - top-lefthand corner of portion of source rectangle to
48 SrcMod - the number of bytes in each row of the source rectangle.
49 rp - the RastPort to write to.
50 CTable - the color table that maps the source pen values.
51 DestX, DestY - top-lefthand corner of portion of destination RastPort
52 to write to (in pixels).
53 SizeX, SizeY - size of the area to copy (in pixels).
54 CTabFormat - format of the color table. Only one format type is
56 CTABFMT_XRGB8 - the colour table is an array of 256 ULONGs.
57 Each entry begins with an unused byte, followed by 1 byte
58 for each component, in the order red, green, blue.
61 count - the number of pixels written to.
73 *****************************************************************************/
79 HIDDT_PixelLUT pixlut
;
80 HIDDT_Pixel pixtab
[256];
84 /* This is cybergraphx. We only work wih HIDD bitmaps */
85 if (!IS_HIDD_BM(rp
->BitMap
)) {
86 D(bug("!!!!! Trying to use CGFX call on non-hidd bitmap in WriteLUTPixelArray()!!!\n"));
91 pixlut
.pixels
= pixtab
;
93 depth
= GetBitMapAttr(rp
->BitMap
, BMA_DEPTH
);
95 /* This call does only support bitmaps with depth > 8. Use WritePixelArray8
100 D(bug("!!! TRYING TO USE WriteLUTPixelArray() ON BITMAP WITH DEPTH <= 8\n"));
104 /* Curently only one format is supported */
105 if (CTABFMT_XRGB8
!= CTabFormat
) {
106 D(bug("!!! WriteLUTPixelArray() CALLED WITH UNSUPPORTED CTAB FORMAT %d\n"
111 /* Convert the coltab into native pixels */
113 for (i
= 0; i
< 256; i
++)
115 register ULONG rgb
= ((ULONG
*)CTable
)[i
];
117 col
.red
= (HIDDT_ColComp
)((rgb
& 0x00FF0000) >> 8);
118 col
.green
= (HIDDT_ColComp
)(rgb
& 0x0000FF00);
119 col
.blue
= (HIDDT_ColComp
)((rgb
& 0x000000FF) << 8);
121 pixtab
[i
] = HIDD_BM_MapColor(HIDD_BM_OBJ(rp
->BitMap
), &col
);
124 /* Now blit the colors on to the screen */
125 return WritePixels8(rp
, srcRect
+ CHUNKY8_COORD_TO_BYTEIDX(SrcX
, SrcY
, SrcMod
), SrcMod
,
126 DestX
, DestY
, DestX
+ SizeX
- 1, DestY
+ SizeY
- 1, &pixlut
, TRUE
);
129 } /* WriteLUTPixelArray */