2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
9 #include <aros/debug.h>
10 #include <cybergraphx/cybergraphics.h>
11 #include <exec/types.h>
12 #include <proto/cybergraphics.h>
13 #include <proto/utility.h>
15 #include "cybergraphics_intern.h"
16 #include "processpixelarray_ops.h"
18 /*****************************************************************************
21 #include <proto/cybergraphics.h>
23 AROS_LH8(VOID
, ProcessPixelArray
,
26 AROS_LHA(struct RastPort
*, rp
, A1
),
27 AROS_LHA(ULONG
, destX
, D0
),
28 AROS_LHA(ULONG
, destY
, D1
),
29 AROS_LHA(ULONG
, sizeX
, D2
),
30 AROS_LHA(ULONG
, sizeY
, D3
),
31 AROS_LHA(ULONG
, operation
, D4
),
32 AROS_LHA(LONG
, value
, D5
),
33 AROS_LHA(struct TagItem
*, taglist
, A2
),
36 struct Library
*, CyberGfxBase
, 38, Cybergraphics
)
39 Applies one of a variety of transformations to a rectangular portion
43 rp - the RastPort to process.
44 destX, destY - top-lefthand corner of portion of RastPort to process.
45 sizeX, sizeY - size of the affected area.
46 operation - one of the following transformation types:
47 POP_TINT - tint the rectangle with an ARGB32 color ('value' input).
48 POP_BLUR - blur the rectangle.
49 POP_BRIGHTEN - brighten the rectangle. The amount of brightening
50 to be done is defined by the 'value' input, which must be in
52 POP_DARKEN - darken the rectangle. The amount of darkening to be
53 done is defined by the 'value' input, which must be in the
55 POP_SETALPHA - set the alpha channel value for all pixels in the
56 rectangle to that specified in the 'value' input. The valid
58 POP_GRADIENT - apply a gradient to the rectangle. Gradient
59 parameters are supplied through the taglist.
60 value - see description of 'operation' input.
61 taglist - currently describes gradient parameters, as follows:
62 PPAOPTAG_GRADIENTTYPE - GRADTYPE_HORIZONTAL or GRADTYPE_VERTICAL.
63 PPAOPTAG_GRADCOLOR1 - The starting color of the gradient (ARGB32).
64 PPAOPTAG_GRADCOLOR2 - The ending color of the gradient (ARGB32).
65 PPAOPTAG_GRADFULLSCALE
69 count - the number of pixels processed.
76 This function is not implemented.
81 This function exists to get Scalos compiled. Because Scalos
82 has its own fallback code for the case that lib_Version < 50
83 it's not so urgent to implement it.
85 *****************************************************************************/
89 struct Rectangle opRect
;
93 opRect
.MaxX
= opRect
.MinX
+ sizeX
- 1;
94 opRect
.MaxY
= opRect
.MinY
+ sizeY
- 1;
99 ProcessPixelArrayBrightnessFunc(rp
, &opRect
, value
, CyberGfxBase
);
102 ProcessPixelArrayBrightnessFunc(rp
, &opRect
, -value
, CyberGfxBase
);
105 ProcessPixelArrayAlphaFunc(rp
, &opRect
, value
, CyberGfxBase
);
108 ProcessPixelArrayTintFunc(rp
, &opRect
, value
, CyberGfxBase
);
111 ProcessPixelArrayBlurFunc(rp
, &opRect
, CyberGfxBase
);
114 ProcessPixelArrayColor2GreyFunc(rp
, &opRect
, CyberGfxBase
);
117 ProcessPixelArrayNegativeFunc(rp
, &opRect
, CyberGfxBase
);
120 ProcessPixelArrayNegativeFadeFunc(rp
, &opRect
, CyberGfxBase
);
123 ProcessPixelArrayTintFadeFunc(rp
, &opRect
, CyberGfxBase
);
127 struct TagItem
*tstate
;
129 BOOL gradHoriz
= TRUE
, gradFull
= FALSE
;
130 ULONG gradCol1
= 0, gradCol2
= 0xFFFFFF;
131 ULONG gradOffset
= 0;
133 for (tstate
= taglist
; (tag
= NextTagItem(&tstate
)); ) {
134 switch (tag
->ti_Tag
) {
135 case PPAOPTAG_GRADIENTTYPE
:
136 if (tag
->ti_Data
== GRADTYPE_VERTICAL
)
139 case PPAOPTAG_GRADCOLOR1
:
140 gradCol1
= tag
->ti_Data
;
142 case PPAOPTAG_GRADCOLOR2
:
143 gradCol2
= tag
->ti_Data
;
145 case PPAOPTAG_GRADFULLSCALE
:
147 case PPAOPTAG_GRADOFFSET
:
150 D(bug("[Cgfx] %s: Unknown POP_GRADIENT TAG 0x%08x\n", __PRETTY_FUNCTION__
, tag
->ti_Tag
));
154 ProcessPixelArrayGradientFunc(rp
, &opRect
, gradHoriz
, gradOffset
, gradCol1
, gradCol2
, gradFull
, CyberGfxBase
);
158 ProcessPixelArrayShiftRGBFunc(rp
, &opRect
, CyberGfxBase
);
161 D(bug("[Cgfx] %s: Unhandled operation %d\n", __PRETTY_FUNCTION__
, operation
));