|
Lines 12-17
Link Here
|
| 12 |
|
12 |
|
| 13 |
import org.eclipse.swt.SWT; |
13 |
import org.eclipse.swt.SWT; |
| 14 |
import org.eclipse.swt.graphics.*; |
14 |
import org.eclipse.swt.graphics.*; |
|
|
15 |
import org.eclipse.swt.widgets.Display; |
| 15 |
|
16 |
|
| 16 |
/** |
17 |
/** |
| 17 |
* Abstract base class for image descriptors that synthesize |
18 |
* Abstract base class for image descriptors that synthesize |
|
Lines 91-96
Link Here
|
| 91 |
|
92 |
|
| 92 |
PaletteData palette = src.palette; |
93 |
PaletteData palette = src.palette; |
| 93 |
if (palette.isDirect) { |
94 |
if (palette.isDirect) { |
|
|
95 |
Display display = Display.getCurrent(); |
| 96 |
RGB bckRGB = display != null |
| 97 |
? display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB() |
| 98 |
: new RGB(0xff, 0xff, 0xff); |
| 94 |
|
99 |
|
| 95 |
ImageData mask = src.getTransparencyMask(); |
100 |
ImageData mask = src.getTransparencyMask(); |
| 96 |
|
101 |
|
|
Lines 110-118
Link Here
|
| 110 |
int b = pixel & palette.blueMask; |
115 |
int b = pixel & palette.blueMask; |
| 111 |
b = (palette.blueShift < 0) ? b >>> -palette.blueShift : b << palette.blueShift; |
116 |
b = (palette.blueShift < 0) ? b >>> -palette.blueShift : b << palette.blueShift; |
| 112 |
|
117 |
|
| 113 |
pixel = alloc(out, r, g, b); |
118 |
int a = src.getAlpha(x, y); |
| 114 |
|
119 |
if (a != 0) { |
| 115 |
imageData.setPixel(xx, yy, pixel); |
120 |
if (a != 0xff) { |
|
|
121 |
int ap = 0xff - a; |
| 122 |
int dPixel = imageData.getPixel(xx, yy); |
| 123 |
RGB dRGB = dPixel != 0 ? out[dPixel] : bckRGB; |
| 124 |
r = (dRGB.red * ap + r * a) / 256; |
| 125 |
g = (dRGB.green * ap + g * a) / 256; |
| 126 |
b = (dRGB.blue * ap + b * a) / 256; |
| 127 |
} |
| 128 |
pixel = alloc(out, r, g, b); |
| 129 |
imageData.setPixel(xx, yy, pixel); |
| 130 |
} |
| 116 |
} |
131 |
} |
| 117 |
} |
132 |
} |
| 118 |
} |
133 |
} |