2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
9 #include <aros/debug.h>
10 #include <hidd/graphics.h>
11 #include <proto/cybergraphics.h>
13 #include "cybergraphics_intern.h"
22 static ULONG
RenderHook(struct render_data
*data
, LONG srcx
, LONG srcy
,
23 OOP_Object
*dstbm_obj
, OOP_Object
*dst_gc
, struct Rectangle
*rect
,
24 struct GfxBase
*GfxBase
);
26 /*****************************************************************************
29 #include <proto/cybergraphics.h>
31 AROS_LH8(void, BltTemplateAlpha
,
34 AROS_LHA(APTR
, src
, A0
),
35 AROS_LHA(LONG
, srcx
, D0
),
36 AROS_LHA(LONG
, srcmod
, D1
),
37 AROS_LHA(struct RastPort
*, rp
, A1
),
38 AROS_LHA(LONG
, destx
, D2
),
39 AROS_LHA(LONG
, desty
, D3
),
40 AROS_LHA(LONG
, width
, D4
),
41 AROS_LHA(LONG
, height
, D5
),
44 struct Library
*, CyberGfxBase
, 37, Cybergraphics
)
47 Alpha blends the current foreground colour into a rectangular portion
48 of a RastPort. The source alpha channel to use for each pixel is taken
49 from an array of 8-bit alpha values. This alpha template may be any
50 rectangle within a larger array/rectangle of alpha values.
53 src - pointer to an array of source alpha values.
54 srcx - byte/pixel offset of top-lefthand corner of alpha template.
55 srcmod - the number of bytes in each row of the source array.
56 rp - the RastPort to write to.
57 destx, desty - top-lefthand corner of portion of destination RastPort
58 to write to (in pixels).
59 width, height - size of the area to copy (in pixels).
65 The size and destination coordinates may be outside the RastPort
66 boundaries, in which case the affected area is safely truncated.
76 *****************************************************************************/
80 struct render_data data
;
83 if (width
== 0 || height
== 0)
86 /* This is cybergraphx. We only work wih HIDD bitmaps */
87 if (!IS_HIDD_BM(rp
->BitMap
)) {
88 D(bug("!!!!! Trying to use CGFX call on non-hidd bitmap "
89 "in BltTemplateAlpha() !!!\n"));
93 /* Compute the start of the array */
95 data
.array
= src
+ srcx
;
97 data
.invertalpha
= (rp
->DrawMode
& INVERSVID
) ? TRUE
: FALSE
;
100 rr
.MaxX
= destx
+ width
- 1;
101 rr
.MaxY
= desty
+ height
- 1;
103 DoRenderFunc(rp
, NULL
, &rr
, RenderHook
, &data
, TRUE
);
106 } /* BltTemplateAlpha */
108 static ULONG
RenderHook(struct render_data
*data
, LONG srcx
, LONG srcy
,
109 OOP_Object
*dstbm_obj
, OOP_Object
*dst_gc
, struct Rectangle
*rect
,
110 struct GfxBase
*GfxBase
)
112 ULONG width
= rect
->MaxX
- rect
->MinX
+ 1;
113 ULONG height
= rect
->MaxY
- rect
->MinY
+ 1;
114 UBYTE
*array
= data
->array
+ data
->modulo
* srcy
+ srcx
;
116 HIDD_BM_PutAlphaTemplate(dstbm_obj
, dst_gc
, array
, data
->modulo
,
117 rect
->MinX
, rect
->MinY
, width
, height
, data
->invertalpha
);
119 return width
* height
;