2 Copyright © 2013-2014, The AROS Development Team. All rights reserved.
6 #include <proto/cybergraphics.h>
8 #include <hidd/graphics.h>
9 #include <cybergraphx/cybergraphics.h>
10 #include <exec/types.h>
12 #include "cybergraphics_intern.h"
15 #include <aros/debug.h>
17 // function is used for both brighen and darken
18 void ProcessPixelArrayBrightnessFunc(struct RastPort
*opRast
, struct Rectangle
*opRect
, LONG value
, struct Library
*CyberGfxBase
)
20 D(bug("[Cgfx] %s(%d)\n", __PRETTY_FUNCTION__
, value
));
24 LONG alpha
, red
, green
, blue
;
28 if (GetBitMapAttr(opRast
->BitMap
, BMA_DEPTH
) < 15)
30 bug("[Cgfx] %s not possible for bitmap depth < 15\n", __PRETTY_FUNCTION__
);
34 width
= opRect
->MaxX
- opRect
->MinX
+ 1;
35 height
= opRect
->MaxY
- opRect
->MinY
+ 1;
37 ptr
= buffer
= AllocMem(width
* height
* 4, MEMF_ANY
);
38 ReadPixelArray(buffer
, 0, 0, width
* 4, opRast
, opRect
->MinX
, opRect
->MinY
, width
, height
, RECTFMT_ARGB
);
40 for (y
= 0; y
< height
; y
++)
42 for(x
= 0; x
< width
; x
++)
46 alpha
= (color
& 0xff);
47 red
= (color
& 0xff00) >> 8;
48 green
= (color
& 0xff0000) >> 16;
49 blue
= (color
& 0xff000000) >> 24;
51 D(bug("[Cgfx] %s x %d y %d old: alpha %d red %d green %d blue %d", __PRETTY_FUNCTION__
, x
, y
, alpha
, red
, green
, blue
));
70 D(bug(" new: alpha %d red %d green %d blue %d\n", alpha
, red
, green
, blue
));
72 color
= alpha
| (red
<< 8) | (green
<< 16) | (blue
<< 24);
79 WritePixelArray(buffer
, 0, 0, width
* 4, opRast
, opRect
->MinX
, opRect
->MinY
, width
, height
, RECTFMT_ARGB
);
80 FreeMem(buffer
, width
* height
* 4);