diff --git a/diylc/diylc-library/lib/diylc-core.jar b/diylc/diylc-library/lib/diylc-core.jar index 42c60e23..1fce68e2 100644 Binary files a/diylc/diylc-library/lib/diylc-core.jar and b/diylc/diylc-library/lib/diylc-core.jar differ diff --git a/diylc/diylc-library/src/org/diylc/awt/ShadedPaintContext.java b/diylc/diylc-library/src/org/diylc/awt/ShadedPaintContext.java index 6171b9b8..cf998554 100644 --- a/diylc/diylc-library/src/org/diylc/awt/ShadedPaintContext.java +++ b/diylc/diylc-library/src/org/diylc/awt/ShadedPaintContext.java @@ -29,10 +29,9 @@ import java.awt.geom.Point2D; import java.awt.image.ColorModel; import java.awt.image.DirectColorModel; import java.awt.image.Raster; +import java.awt.image.WritableRaster; import java.lang.ref.WeakReference; -import sun.awt.image.IntegerComponentRaster; - public class ShadedPaintContext implements PaintContext { static ColorModel xrgbmodel = @@ -222,17 +221,20 @@ public class ShadedPaintContext implements PaintContext { rast = getCachedRaster(model, w, h); saved = rast; } - IntegerComponentRaster irast = (IntegerComponentRaster) rast; - int off = irast.getDataOffset(0); - int adjust = irast.getScanlineStride() - w; - int[] pixels = irast.getDataStorage(); +// IntegerComponentRaster irast = (IntegerComponentRaster) rast; +// int off = irast.getDataOffset(0); +// int adjust = irast.getScanlineStride() - w; +// int[] pixels2 = irast.getDataStorage(); + + int[] pixels = new int[w * h * 3]; - clipFillRaster(pixels, off, adjust, w, h, rowrel, dx, dy); + clipFillRasterRGB(pixels, 0, 0, w, h, rowrel, dx, dy); + ((WritableRaster)rast).setPixels(rast.getMinX(), rast.getMinY(), w, h, pixels); // irast.markDirty(); return rast; - } + } void clipFillRaster(int[] pixels, int off, int adjust, int w, int h, double rowrel, double dx, double dy) { @@ -261,4 +263,48 @@ public class ShadedPaintContext implements PaintContext { rowrel += dy; } } + + void clipFillRasterRGB(int[] pixels, int off, int adjust, int w, int h, double rowrel, + double dx, double dy) { + while (--h >= 0) { + double colrel = rowrel; + int j = w; + if (colrel <= 0.0) { + int rgb = interp[0]; + do { + int red = (rgb >> 16) & 0xff; + int green = (rgb >> 8) & 0xff; + int blue = (rgb) & 0xff; + pixels[off++] = red; + pixels[off++] = green; + pixels[off++] = blue; + colrel += dx; + } while (--j > 0 && colrel <= 0.0); + } + while (colrel < 1.0 && --j >= 0) { + int rgb = interp[(int) (colrel < 0.5 ? colrel * 2 * 256 : (2 - colrel * 2) * 256)]; + int red = (rgb >> 16) & 0xff; + int green = (rgb >> 8) & 0xff; + int blue = (rgb) & 0xff; + pixels[off++] = red; + pixels[off++] = green; + pixels[off++] = blue; + colrel += dx; + } + if (j > 0) { + int rgb = interp[256]; + do { + int red = (rgb >> 16) & 0xff; + int green = (rgb >> 8) & 0xff; + int blue = (rgb) & 0xff; + pixels[off++] = red; + pixels[off++] = green; + pixels[off++] = blue; + } while (--j > 0); + } + + off += adjust; + rowrel += dy; + } + } } \ No newline at end of file diff --git a/diylc/diylc-swing/lib/diylc-core.jar b/diylc/diylc-swing/lib/diylc-core.jar index 42c60e23..1fce68e2 100644 Binary files a/diylc/diylc-swing/lib/diylc-core.jar and b/diylc/diylc-swing/lib/diylc-core.jar differ diff --git a/diylc/diylc-swing/library/main.jar b/diylc/diylc-swing/library/main.jar index 8195b171..af23d57e 100644 Binary files a/diylc/diylc-swing/library/main.jar and b/diylc/diylc-swing/library/main.jar differ