grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / cgfx / processpixelarray.c
blob43dfea5c1012e188853841b7a94ee0e4f5056324
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
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 /*****************************************************************************
20 NAME */
21 #include <proto/cybergraphics.h>
23 AROS_LH8(VOID, ProcessPixelArray,
25 /* SYNOPSIS */
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),
35 /* LOCATION */
36 struct Library *, CyberGfxBase, 38, Cybergraphics)
38 /* FUNCTION
39 Applies one of a variety of transformations to a rectangular portion
40 of a RastPort.
42 INPUTS
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
51 the range 0 to 255.
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
54 range 0 to 255.
55 POP_SETALPHA - set the alpha channel value for all pixels in the
56 rectangle to that specified in the 'value' input. The valid
57 range is 0 to 255.
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
66 PPAOPTAG_GRADOFFSET
68 RESULT
69 count - the number of pixels processed.
71 NOTES
73 EXAMPLE
75 BUGS
76 This function is not implemented.
78 SEE ALSO
80 INTERNALS
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 *****************************************************************************/
87 AROS_LIBFUNC_INIT
89 struct Rectangle opRect;
91 opRect.MinX = destX;
92 opRect.MinY = destY;
93 opRect.MaxX = opRect.MinX + sizeX - 1;
94 opRect.MaxY = opRect.MinY + sizeY - 1;
96 switch (operation)
98 case POP_BRIGHTEN:
99 ProcessPixelArrayBrightnessFunc(rp, &opRect, value, CyberGfxBase);
100 break;
101 case POP_DARKEN:
102 ProcessPixelArrayBrightnessFunc(rp, &opRect, -value, CyberGfxBase);
103 break;
104 case POP_SETALPHA:
105 ProcessPixelArrayAlphaFunc(rp, &opRect, value, CyberGfxBase);
106 break;
107 case POP_TINT:
108 ProcessPixelArrayTintFunc(rp, &opRect, value, CyberGfxBase);
109 break;
110 case POP_BLUR:
111 ProcessPixelArrayBlurFunc(rp, &opRect, CyberGfxBase);
112 break;
113 case POP_COLOR2GREY:
114 ProcessPixelArrayColor2GreyFunc(rp, &opRect, CyberGfxBase);
115 break;
116 case POP_NEGATIVE:
117 ProcessPixelArrayNegativeFunc(rp, &opRect, CyberGfxBase);
118 break;
119 case POP_NEGFADE:
120 ProcessPixelArrayNegativeFadeFunc(rp, &opRect, CyberGfxBase);
121 break;
122 case POP_TINTFADE:
123 ProcessPixelArrayTintFadeFunc(rp, &opRect, CyberGfxBase);
124 break;
125 case POP_GRADIENT:
127 struct TagItem *tstate;
128 struct TagItem *tag;
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)
137 gradHoriz = FALSE;
138 break;
139 case PPAOPTAG_GRADCOLOR1:
140 gradCol1 = tag->ti_Data;
141 break;
142 case PPAOPTAG_GRADCOLOR2:
143 gradCol2 = tag->ti_Data;
144 break;
145 case PPAOPTAG_GRADFULLSCALE:
146 break;
147 case PPAOPTAG_GRADOFFSET:
148 break;
149 default:
150 D(bug("[Cgfx] %s: Unknown POP_GRADIENT TAG 0x%08x\n", __PRETTY_FUNCTION__, tag->ti_Tag));
151 break;
154 ProcessPixelArrayGradientFunc(rp, &opRect, gradHoriz, gradOffset, gradCol1, gradCol2, gradFull, CyberGfxBase);
155 break;
157 case POP_SHIFTRGB:
158 ProcessPixelArrayShiftRGBFunc(rp, &opRect, CyberGfxBase);
159 break;
160 default:
161 D(bug("[Cgfx] %s: Unhandled operation %d\n", __PRETTY_FUNCTION__, operation));
162 break;
164 AROS_LIBFUNC_EXIT