Basically it is function which calculates the gradient shades, but probably in a different way than OS4's DrawGradient() function. Basic parameters are the same more or less on both systems, but probably with different calculation, and so final result (the visible one) can be pretty different.
@all Combined from AROS sources something (Mazze, you are author seems so ?), which probably should work. Maybe will be in interst of someone to copy+paste someday :) For me only POP_DARKEN and POP_BRIGHTEN need it, and they implemented on AROS:
/*
NOTE: TAKEN FROM AROS.
FUNCTION
Applies one of a variety of transformations to a rectangular portion
of a RastPort.
INPUTS
rp - the RastPort to process.
destX, destY - top-lefthand corner of portion of RastPort to process.
sizeX, sizeY - size of the affected area.
operation - one of the following transformation types:
POP_TINT - tint the rectangle with an ARGB32 color ('value' input).
POP_BLUR - blur the rectangle.
POP_BRIGHTEN - brighten the rectangle. The amount of brightening
to be done is defined by the 'value' input, which must be in
the range 0 to 255.
POP_DARKEN - darken the rectangle. The amount of darkening to be
done is defined by the 'value' input, which must be in the
range 0 to 255.
POP_SETALPHA - set the alpha channel value for all pixels in the
rectangle to that specified in the 'value' input. The valid
range is 0 to 255.
POP_GRADIENT - apply a gradient to the rectangle. Gradient
parameters are supplied through the taglist.
value - see description of 'operation' input.
taglist - currently describes gradient parameters, as follows:
PPAOPTAG_GRADIENTTYPE - GRADTYPE_HORIZONTAL or GRADTYPE_VERTICAL.
PPAOPTAG_GRADCOLOR1 - The starting color of the gradient (ARGB32).
PPAOPTAG_GRADCOLOR2 - The ending color of the gradient (ARGB32).
PPAOPTAG_GRADFULLSCALE
PPAOPTAG_GRADOFFSET
LONG x, y;
ULONG color;
LONG alpha, red, green, blue;
if (GetBitMapAttr(opRast->BitMap, BMA_DEPTH) < 15)
{
//kprintf("[Cgfx] %s not possible for bitmap depth < 15\n", __PRETTY_FUNCTION__);
return;
}
for(x = opRect->MinX; x <= opRect->MaxX; x++)
{
for (y = opRect->MinY; y <= opRect->MaxY; y++)
{
color = ReadRGBPixel(opRast, x, y);
alpha = (color & 0xff);
red = (color & 0xff00) >> 8;
green = (color & 0xff0000) >> 16;
blue = (color & 0xff000000) >> 24;
//kprintf("[Cgfx] %s x %d y %d old: alpha %d red %d green %d blue %d", __PRETTY_FUNCTION__, x, y, alpha, red, green, blue);
red += value;
green += value;
blue += value;
if (red > 255)
red = 255;
else if (red < 0)
red = 0;
if (green > 255)
green = 255;
else if (green < 0)
green = 0;
if (blue > 255)
blue = 255;
else if (blue < 0)
blue = 0;
//kprintf(" new: alpha %d red %d green %d blue %d\n", alpha, red, green, blue);
switch (operation)
{
case POP_BRIGHTEN:
ProcessPixelArrayBrightnessFunc(rp, &opRect, value);
break;
case POP_DARKEN:
ProcessPixelArrayBrightnessFunc(rp, &opRect, -value);
break;
case POP_SETALPHA:
break;
case POP_TINT:
break;
case POP_BLUR:
break;
case POP_COLOR2GREY:
break;
case POP_NEGATIVE:
break;
case POP_NEGFADE:
break;
case POP_TINTFADE:
break;
case POP_GRADIENT:
break;
case POP_SHIFTRGB:
break;
default:
//kprintf("[Cgfx] %s: Unhandled operation %d\n", __PRETTY_FUNCTION__, operation);
break;
}
}
Edited by kas1e on 2017/1/13 20:27:24 Edited by kas1e on 2017/1/14 8:46:58