import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.PaletteData;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
import org.tizen.emulator.skin.log.SkinLogger;
int patchedImageWidth = (patchWidth * 2) + centerPatchWidth;
int patchedImageHeight = (patchHeight * 2) + centerPatchHeight;
- Image patchedImage = new Image(display,
- patchedImageWidth, patchedImageHeight);
+ ImageData imageData = new ImageData(
+ patchedImageWidth, patchedImageHeight, 32,
+ new PaletteData(0xFF000000, 0x00FF0000, 0x0000FF00));
+ imageData.transparentPixel = 0;
+ Image patchedImage = new Image(display, imageData);
GC gc = new GC(patchedImage);
- if (SwtUtil.isLinuxPlatform() == true) {
- /*
- * Bug in Cairo. When drawing the image stretched with an interpolation
- * algorithm, the edges of the image are faded. This is not a bug, but
- * it is not desired. To avoid the faded edges, it should be possible to
- * use cairo_pattern_set_extend() to set the pattern extend to either
- * CAIRO_EXTEND_REFLECT or CAIRO_EXTEND_PAD, but these are not implemented
- * in some versions of cairo (1.2.x) and have bugs in others (in 1.4.2 it
- * draws with black edges). The fix is to implement CAIRO_EXTEND_REFLECT
- * by creating an image that is 3 times bigger than the original, drawing
- * the original image in every quadrant (with an appropriate transform) and
- * use this image as the pattern.
- */
- gc.setInterpolation(SWT.NONE);
+ if (SwtUtil.isLinuxPlatform() == false) {
+ /* SWT works differently. So, we need a color key */
+ gc.setBackground(display.getSystemColor(SWT.COLOR_MAGENTA));
+ gc.fillRectangle(0, 0, patchedImageWidth, patchedImageHeight);
}
- gc.setBackground(display.getSystemColor(SWT.COLOR_MAGENTA));
- gc.fillRectangle(0, 0, patchedImageWidth, patchedImageHeight);
-
/* top side */
// TODO: copy alphaData
gc.drawImage(imageLT, 0, 0);