![]() |
![]() |
org.eclipse.swt.win32.win32.x86_3.7.2.v3740fmask = 65280 >>> bits; int val = from << 16; int inc = ((to << 16) - val) / steps + 1; if (vertical) { for (int dy = 0; dy < bandHeight; dp += bytesPerLine) { int dx = 0; for (int dptr = dp; dx < bandWidth; dptr += 4) { int thresh = DITHER_MATRIX[(dy & 0x7)][dx] >>> bits; int temp = val + thresh; if (temp > 16777215) { bitmapData[dptr] = -1; } else { bitmapData[dptr] = ((byte)(temp >>> 16 & mask)); } dx++; } val += inc;dy++; } } else { for (int dx = 0; dx < bandWidth; dp += 4) { int dy = 0; for (int dptr = dp; dy < bandHeight; dptr += bytesPerLine) { int thresh = DITHER_MATRIX[dy][(dx & 0x7)] >>> bits; int temp = val + thresh; if (temp > 16777215) { bitmapData[dptr] = -1; } else { bitmapData[dptr] = ((byte)(temp >>> 16 & mask)); } dy++; } val += inc;dx++; } } } static void fillGradientRectangle(GC gc, Device device, int x, int y, int width, int height, boolean vertical, RGB fromRGB, RGB toRGB, int redBits, int greenBits, int blueBits) { ImageData band = createGradientBand(width, height, vertical, fromRGB, toRGB, redBits, greenBits, blueBits); Image image = new Image(device, band); if ((width == 1) || (height == 1)) { gc.drawImage(image, 0, 0, width, height, x, y, width, height); } else if (vertical) { for (int dx = 0; dx < width; dx += width) { int blitWidth = width - dx; if (blitWidth > width) { blitWidth = width; } gc.drawImage(image, 0, 0, blitWidth, height, dx + x, y, blitWidth, height); } } else { for (int dy = 0; dy < height; dy += height) { int blitHeight = height - dy; if (blitHeight > height) { blitHeight = height; } gc.drawImage(image, 0, 0, width, blitHeight, x, dy + y, width, blitHeight); } } image.dispose(); } } /* Location: * Qualified Name: org.eclipse.swt.graphics.ImageData * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.swt.graphics; import java.io.InputStream; class ImageDataLoader { public static ImageData[] load(InputStream stream) { return new ImageLoader().load(stream); } public static ImageData[] load(String filename) { return new ImageLoader().load(filename); } } /* Location: * Qualified Name: org.eclipse.swt.graphics.ImageDataLoader * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.swt.graphics; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Vector; import org.eclipse.swt.SWT; import org.eclipse.swt.internal.Compatibility; import org.eclipse.swt.internal.image.FileFormat; public class ImageLoader { public ImageData[] data; public int logicalScreenWidth; public int logicalScreenHeight; public int backgroundPixel; public int repeatCount; Vector imageLoaderListeners; public ImageLoader() { reset(); } void reset() { data = null; logicalScreenWidth = 0; logicalScreenHeight = 0; backgroundPixel = -1; repeatCount = 1; } public ImageData[] load(InputStream stream) { if (stream == null) { SWT.error(4); } reset(); data = FileFormat.load(stream, this); return data; } public ImageData[] load(String filename) { if (filename == null) { SWT.error(4); } InputStream stream = null; try { stream = Compatibility.newFileInputStream(filename); return load(stream); } catch (IOException e) { SWT.error(39, e); } finally { try { if (stream != null) { stream.close(); } } catch (IOException localIOException3) {} } return null; } public void save(OutputStream stream, int format) { if (stream == null) { SWT.error(4); } FileFormat.save(stream, format, this); } public void save(String filename, int format) { if (filename == null) { SWT.error(4); } OutputStream stream = null; try { stream = Compatibility.newFileOutputStream(filename); } catch (IOException e) { SWT.error(39, e); } save(stream, format); try { stream.close(); } catch (IOException localIOException1) {} } public void addImageLoaderListener(ImageLoaderListener listener) { if (listener == null) { SWT.error(4); } if (imageLoaderListeners == null) { imageLoaderListeners = new Vector(); } imageLoaderListeners.addElement(listener); } public void removeImageLoaderListener(ImageLoaderListener listener) { if (listener == null) { SWT.error(4); } if (imageLoaderListeners == null) { return; } imageLoaderListeners.removeElement(listener); } public boolean hasListeners() { return (imageLoaderListeners != null) && (imageLoaderListeners.size() > 0); } public void notifyListeners(ImageLoaderEvent event) { if (!hasListeners()) { return; } int size = imageLoaderListeners.size(); for (int i = 0; i < size; i++) { ImageLoaderListener listener = (ImageLoaderListener)imageLoaderListeners.elementAt(i); listener.imageDataLoaded(event); } } } /* Location: * Qualified Name: org.eclipse.swt.graphics.ImageLoader * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.swt.graphics; import org.eclipse.swt.internal.SWTEventObject; public class ImageLoaderEvent extends SWTEventObject { public ImageData imageData; public int incrementCount; public boolean endOfImage; static final long serialVersionUID = 3257284738325558065L; public ImageLoaderEvent(ImageLoader source, ImageData imageData, int incrementCount, boolean endOfImage) { super(source); this.imageData = imageData; this.incrementCount = incrementCount; this.endOfImage = endOfImage; } public String toString() { return "ImageLoaderEvent {source=" + source + " imageData=" + imageData + " incrementCount=" + incrementCount + " endOfImage=" + endOfImage + "}"; } } /* Location: * Qualified Name: org.eclipse.swt.graphics.ImageLoaderEvent * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.swt.graphics; import org.eclipse.swt.internal.SWTEventListener; public abstract interface ImageLoaderListener extends SWTEventListener { public abstract void imageDataLoaded(ImageLoaderEvent paramImageLoaderEvent); } /* Location: * Qualified Name: org.eclipse.swt.graphics.ImageLoaderListener * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.swt.graphics; public class LineAttributes { public float width; public int style; public int cap; public int join; public float[] dash; public float dashOffset; public float miterLimit; public LineAttributes(float width) { this(width, 1, 1, 1, null, 0.0F, 10.0F); } public LineAttributes(float width, int cap, int join) { this(width, cap, join, 1, null, 0.0F, 10.0F); } public LineAttributes(float width, int cap, int join, int style, float[] dash, float dashOffset, float miterLimit) { this.width = width; this.cap = cap; this.join = join; this.style = style; this.dash = dash; this.dashOffset = dashOffset; this.miterLimit = miterLimit; } public boolean equals(Object object) { if (object == this) { return true; } if (!(object instanceof LineAttributes)) { return false; } LineAttributes p = (LineAttributes)object; if (width != width) { return false; } if (cap != cap) { return false; } if (join != join) { return false; } if (style != style) { return false; } if (dashOffset != dashOffset) { return false; } if (miterLimit != miterLimit) { return false; } if ((dash != null) && (dash != null)) { if (dash.length != dash.length) { return false; } for (int i = 0; i < dash.length; i++) { if (dash[i] != dash[i]) { return false; } } } else if ((dash != null) || (dash != null)) { return false; } return true; } public int hashCode() { int hashCode = Float.floatToIntBits(width); hashCode = 31 * hashCode + cap; hashCode = 31 * hashCode + join; hashCode = 31 * hashCode + style; hashCode = 31 * hashCode + Float.floatToIntBits(dashOffset); hashCode = 31 * hashCode + Float.floatToIntBits(miterLimit); if (dash != null) { for (int i = 0; i < dash.length; i++) { hashCode = 31 * hashCode + Float.floatToIntBits(dash[i]); } } return hashCode; } } /* Location: * Qualified Name: org.eclipse.swt.graphics.LineAttributes * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.swt.graphics; import org.eclipse.swt.SWT; public final class PaletteData { public boolean isDirect; public RGB[] colors; public int redMask; public int greenMask; public int blueMask; public int redShift; public int greenShift; public int blueShift; public PaletteData(RGB[] colors) { if (colors == null) { SWT.error(4); } this.colors = colors; isDirect = false; } public PaletteData(int redMask, int greenMask, int blueMask) { this.redMask = redMask; this.greenMask = greenMask; this.blueMask = blueMask; isDirect = true; redShift = shiftForMask(redMask); greenShift = shiftForMask(greenMask); blueShift = shiftForMask(blueMask); } public int getPixel(RGB rgb) { if (rgb == null) { SWT.error(4); } if (isDirect) { int pixel = 0; pixel |= (redShift < 0 ? red << -redShift : red >>> redShift) & redMask; pixel |= (greenShift < 0 ? green << -greenShift : green >>> greenShift) & greenMask; pixel |= (blueShift < 0 ? blue << -blueShift : blue >>> blueShift) & blueMask; return pixel; } for (int i = 0; i < colors.length; i++) { if (colors[i].equals(rgb)) { return i; } } SWT.error(5); return 0; } public RGB getRGB(int pixel) { if (isDirect) { int r = pixel & redMask; r = redShift < 0 ? r >>> -redShift : r << redShift; int g = pixel & greenMask; g = greenShift < 0 ? g >>> -greenShift : g << greenShift; int b = pixel & blueMask; b = blueShift < 0 ? b >>> -blueShift : b << blueShift; return new RGB(r, g, b); } if ((pixel < 0) || (pixel >= colors.length)) { SWT.error(5); } return colors[pixel]; } public RGB[] getRGBs() { return colors; } int shiftForMask(int mask) { for (int i = 31; i >= 0; i--) { if ((mask >> i & 0x1) != 0) { return 7 - i; } } return 32; } } /* Location: * Qualified Name: org.eclipse.swt.graphics.PaletteData * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.swt.graphics; import org.eclipse.swt.SWT; import org.eclipse.swt.internal.gdip.Gdip; import org.eclipse.swt.internal.gdip.PointF; import org.eclipse.swt.internal.gdip.RectF; import org.eclipse.swt.internal.win32.OS; public class Path extends Resource { PointF startPoint = new PointF(); PointF currentPoint = new PointF(); public int handle; public Path(Device device) { super(device); this.device.checkGDIP(); handle = Gdip.GraphicsPath_new(0); if (handle == 0) { SWT.error(2); } init(); } public Path(Device device, Path path, float flatness) { super(device); if (path == null) { SWT.error(4); } if (path.isDisposed()) { SWT.error(5); } flatness = Math.max(0.0F, flatness); handle = Gdip.GraphicsPath_Clone(handle); if (flatness != 0.0F) { Gdip.GraphicsPath_Flatten(handle, 0, flatness); } if (handle == 0) { SWT.error(2); } init(); } public Path(Device device, PathData data) { this(device); if (data == null) { SWT.error(4); } init(data); } public void addArc(float x, float y, float width, float height, float startAngle, float arcAngle) { if (isDisposed()) { SWT.error(44); } if (width < 0.0F) { x += width; width = -width; } if (height < 0.0F) { y += height; height = -height; } if ((width == 0.0F) || (height == 0.0F) || (arcAngle == 0.0F)) { return; } if (width == height) { Gdip.GraphicsPath_AddArc(handle, x, y, width, height, -startAngle, -arcAngle); } else { int path = Gdip.GraphicsPath_new(0); if (path == 0) { SWT.error(2); } int matrix = Gdip.Matrix_new(width, 0.0F, 0.0F, height, x, y); if (matrix == 0) { SWT.error(2); } Gdip.GraphicsPath_AddArc(path, 0.0F, 0.0F, 1.0F, 1.0F, -startAngle, -arcAngle); Gdip.GraphicsPath_Transform(path, matrix); Gdip.GraphicsPath_AddPath(handle, path, true); Gdip.Matrix_delete(matrix); Gdip.GraphicsPath_delete(path); } Gdip.GraphicsPath_GetLastPoint(handle, currentPoint); } public void addPath(Path path) { if (isDisposed()) { SWT.error(44); } if (path == null) { SWT.error(4); } if (path.isDisposed()) { SWT.error(5); } Gdip.GraphicsPath_AddPath(handle, handle, false); currentPoint.X = currentPoint.X; currentPoint.Y = currentPoint.Y; } public void addRectangle(float x, float y, float width, float height) { if (isDisposed()) { SWT.error(44); } RectF rect = new RectF(); X = x; Y = y; Width = width; Height = height; Gdip.GraphicsPath_AddRectangle(handle, rect); currentPoint.X = x; currentPoint.Y = y; } public void addString(String string, float x, float y, Font font) { if (isDisposed()) { SWT.error(44); } if (font == null) { SWT.error(4); } if (font.isDisposed()) { SWT.error(5); } int length = string.length(); char[] buffer = new char[length]; string.getChars(0, length, buffer, 0); int hDC = device.internal_new_GC(null); int[] family = new int[1]; int gdipFont = GC.createGdipFont(hDC, handle, 0, device.fontCollection, family, null); PointF point = new PointF(); X = (x - Gdip.Font_GetSize(gdipFont) / 6.0F); Y = y; int style = Gdip.Font_GetStyle(gdipFont); float size = Gdip.Font_GetSize(gdipFont); Gdip.GraphicsPath_AddString(handle, buffer, length, family[0], style, size, point, 0); Gdip.GraphicsPath_GetLastPoint(handle, currentPoint); Gdip.FontFamily_delete(family[0]); Gdip.Font_delete(gdipFont); device.internal_dispose_GC(hDC, null); } public void close() { if (isDisposed()) { SWT.error(44); } Gdip.GraphicsPath_CloseFigure(handle); currentPoint.X = startPoint.X; currentPoint.Y = startPoint.Y; } public boolean contains(float x, float y, GC gc, boolean outline) { if (isDisposed()) { SWT.error(44); } if (gc == null) { SWT.error(4); } if (gc.isDisposed()) { SWT.error(5); } gc.initGdip(); gc.checkGC(120); int mode = OS.GetPolyFillMode(handle) == 2 ? 1 : 0; Gdip.GraphicsPath_SetFillMode(handle, mode); if (outline) { return Gdip.GraphicsPath_IsOutlineVisible(handle, x, y, data.gdipPen, data.gdipGraphics); } return Gdip.GraphicsPath_IsVisible(handle, x, y, data.gdipGraphics); } public void cubicTo(float cx1, float cy1, float cx2, float cy2, float x, float y) { if (isDisposed()) { SWT.error(44); } Gdip.GraphicsPath_AddBezier(handle, currentPoint.X, currentPoint.Y, cx1, cy1, cx2, cy2, x, y); Gdip.GraphicsPath_GetLastPoint(handle, currentPoint); } void destroy() { Gdip.GraphicsPath_delete(handle); handle = 0; } public void getBounds(float[] bounds) { if (isDisposed()) { SWT.error(44); } if (bounds == null) { SWT.error(4); } if (bounds.length < 4) { SWT.error(5); } RectF rect = new RectF(); Gdip.GraphicsPath_GetBounds(handle, rect, 0, 0); bounds[0] = X; bounds[1] = Y; bounds[2] = Width; bounds[3] = Height; } public void getCurrentPoint(float[] point) { if (isDisposed()) { SWT.error(44); } if (point == null) { SWT.error(4); } if (point.length < 2) { SWT.error(5); } point[0] = currentPoint.X; point[1] = currentPoint.Y; } public PathData getPathData() { if (isDisposed()) { SWT.error(44); } int count = Gdip.GraphicsPath_GetPointCount(handle); byte[] gdipTypes = new byte[count]; float[] points = new float[count * 2]; Gdip.GraphicsPath_GetPathTypes(handle, gdipTypes, count); Gdip.GraphicsPath_GetPathPoints(handle, points, count); byte[] types = new byte[count * 2]; int index = 0;int typesIndex = 0; while (index < count) { byte type = gdipTypes[index]; boolean close = false; switch (type & 0x7) { case 0: types[(typesIndex++)] = 1; close = (type & 0x80) != 0; index++; break; case 1: types[(typesIndex++)] = 2; close = (type & 0x80) != 0; index++; break; case 3: types[(typesIndex++)] = 4; close = (gdipTypes[(index + 2)] & 0x80) != 0; index += 3; break; case 2: default: index++; } if (close) { types[(typesIndex++)] = 5; } } if (typesIndex != types.length) { byte[] newTypes = new byte[typesIndex]; System.arraycopy(types, 0, newTypes, 0, typesIndex); types = newTypes; } PathData result = new PathData(); types = types; points = points; return result; } public void lineTo(float x, float y) { if (isDisposed()) { SWT.error(44); } Gdip.GraphicsPath_AddLine(handle, currentPoint.X, currentPoint.Y, x, y); Gdip.GraphicsPath_GetLastPoint(handle, currentPoint); } void init(PathData data) { byte[] types = types; float[] points = points; int i = 0; for (int j = 0; i < types.length; i++) { switch (types[i]) { case 1: moveTo(points[(j++)], points[(j++)]); break; case 2: lineTo(points[(j++)], points[(j++)]); break; case 4: cubicTo(points[(j++)], points[(j++)], points[(j++)], points[(j++)], points[(j++)], points[(j++)]); break; case 3: quadTo(points[(j++)], points[(j++)], points[(j++)], points[(j++)]); break; case 5: close(); break; default: dispose(); SWT.error(5); } } } public boolean isDisposed() { return handle == 0; } public void moveTo(float x, float y) { if (isDisposed()) { SWT.error(44); } Gdip.GraphicsPath_StartFigure(handle); currentPoint.X = (startPoint.X = x); currentPoint.Y = (startPoint.Y = y); } public void quadTo(float cx, float cy, float x, float y) { if (isDisposed()) { SWT.error(44); } float cx1 = currentPoint.X + 2.0F * (cx - currentPoint.X) / 3.0F; float cy1 = currentPoint.Y + 2.0F * (cy - currentPoint.Y) / 3.0F; float cx2 = cx1 + (x - currentPoint.X) / 3.0F; float cy2 = cy1 + (y - currentPoint.Y) / 3.0F; Gdip.GraphicsPath_AddBezier(handle, currentPoint.X, currentPoint.Y, cx1, cy1, cx2, cy2, x, y); Gdip.GraphicsPath_GetLastPoint(handle, currentPoint); } public String toString() { if (isDisposed()) { return "Path {*DISPOSED*}"; } return "Path {" + handle + "}"; } } /* Location: * Qualified Name: org.eclipse.swt.graphics.Path * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.swt.graphics; public final class PathData { public byte[] types; public float[] points; } /* Location: * Qualified Name: org.eclipse.swt.graphics.PathData * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.swt.graphics; import org.eclipse.swt.SWT; import org.eclipse.swt.internal.gdip.Gdip; import org.eclipse.swt.internal.gdip.PointF; import org.eclipse.swt.internal.win32.OS; public class Pattern extends Resource { public int handle; public Pattern(Device device, Image image) { super(device); if (image == null) { SWT.error(4); } if (image.isDisposed()) { SWT.error(5); } this.device.checkGDIP(); int[] gdipImage = image.createGdipImage(); int img = gdipImage[0]; int width = Gdip.Image_GetWidth(img); int height = Gdip.Image_GetHeight(img); handle = Gdip.TextureBrush_new(img, 0, 0.0F, 0.0F, width, height); Gdip.Bitmap_delete(img); if (gdipImage[1] != 0) { int hHeap = OS.GetProcessHeap(); OS.HeapFree(hHeap, 0, gdipImage[1]); } if (handle == 0) { SWT.error(2); } init(); } public Pattern(Device device, float x1, float y1, float x2, float y2, Color color1, Color color2) { this(device, x1, y1, x2, y2, color1, 255, color2, 255); } public Pattern(Device device, float x1, float y1, float x2, float y2, Color color1, int alpha1, Color color2, int alpha2) { super(device); if (color1 == null) { SWT.error(4); } if (color1.isDisposed()) { SWT.error(5); } if (color2 == null) { SWT.error(4); } if (color2.isDisposed()) { SWT.error(5); } this.device.checkGDIP(); int colorRef1 = handle; int rgb = colorRef1 >> 16 & 0xFF | colorRef1 & 0xFF00 | (colorRef1 & 0xFF) << 16; int foreColor = Gdip.Color_new((alpha1 & 0xFF) << 24 | rgb); if ((x1 == x2) && (y1 == y2)) { handle = Gdip.SolidBrush_new(foreColor); if (handle == 0) { SWT.error(2); } } else { int colorRef2 = handle; rgb = colorRef2 >> 16 & 0xFF | colorRef2 & 0xFF00 | (colorRef2 & 0xFF) << 16; int backColor = Gdip.Color_new((alpha2 & 0xFF) << 24 | rgb); PointF p1 = new PointF(); X = x1; Y = y1; PointF p2 = new PointF(); X = x2; Y = y2; handle = Gdip.LinearGradientBrush_new(p1, p2, foreColor, backColor); if (handle == 0) { SWT.error(2); } if ((alpha1 != 255) || (alpha2 != 255)) { int a = (int)((alpha1 & 0xFF) * 0.5F + (alpha2 & 0xFF) * 0.5F); int r = (int)(((colorRef1 & 0xFF) >> 0) * 0.5F + ((colorRef2 & 0xFF) >> 0) * 0.5F); int g = (int)(((colorRef1 & 0xFF00) >> 8) * 0.5F + ((colorRef2 & 0xFF00) >> 8) * 0.5F); int b = (int)(((colorRef1 & 0xFF0000) >> 16) * 0.5F + ((colorRef2 & 0xFF0000) >> 16) * 0.5F); int midColor = Gdip.Color_new(a << 24 | r << 16 | g << 8 | b); Gdip.LinearGradientBrush_SetInterpolationColors(handle, new int[] { foreColor, midColor, backColor }, new float[] { 0.0F, 0.5F, 1.0F }, 3); Gdip.Color_delete(midColor); } Gdip.Color_delete(backColor); } Gdip.Color_delete(foreColor); init(); } void destroy() { int type = Gdip.Brush_GetType(handle); switch (type) { case 0: Gdip.SolidBrush_delete(handle); break; case 1: Gdip.HatchBrush_delete(handle); break; case 4: Gdip.LinearGradientBrush_delete(handle); break; case 2: Gdip.TextureBrush_delete(handle); } handle = 0; } public boolean isDisposed() { return handle == 0; } public String toString() { if (isDisposed()) { return "Pattern {*DISPOSED*}"; } return "Pattern {" + handle + "}"; } } /* Location: * Qualified Name: org.eclipse.swt.graphics.Pattern * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.swt.graphics; import org.eclipse.swt.internal.SerializableCompatibility; public final class Point implements SerializableCompatibility { public int x; public int y; static final long serialVersionUID = 3257002163938146354L; public Point(int x, int y) { this.x = x; this.y = y; } public boolean equals(Object object) { if (object == this) { return true; } if (!(object instanceof Point)) { return false; } Point p = (Point)object; return (x == x) && (y == y); } public int hashCode() { return x ^ y; } public String toString() { return "Point {" + x + ", " + y + "}"; } } /* Location: * Qualified Name: org.eclipse.swt.graphics.Point * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.swt.graphics; import org.eclipse.swt.SWT; import org.eclipse.swt.internal.SerializableCompatibility; public final class RGB implements SerializableCompatibility { public int red; public int green; public int blue; static final long serialVersionUID = 3258415023461249074L; public RGB(int red, int green, int blue) { if ((red > 255) || (red < 0) || (green > 255) || (green < 0) || (blue > 255) || (blue < 0)) { SWT.error(5); } this.red = red; this.green = green; this.blue = blue; } public RGB(float hue, float saturation, float brightness) { if ((hue < 0.0F) || (hue > 360.0F) || (saturation < 0.0F) || (saturation > 1.0F) || (brightness < 0.0F) || (brightness > 1.0F)) { SWT.error(5); } float r; float r; float g; float b; if (saturation == 0.0F) { float b; float g; r = g = b = brightness; } else { if (hue == 360.0F) { hue = 0.0F; } hue /= 60.0F; int i = (int)hue; float f = hue - i; float p = brightness * (1.0F - saturation); float q = brightness * (1.0F - saturation * f); float t = brightness * (1.0F - saturation * (1.0F - f)); float b; float b; float b; float b; float b; switch (i) { case 0: float r = brightness; float g = t; b = p; break; case 1: float r = q; float g = brightness; b = p; break; case 2: float r = p; float g = brightness; b = t; break; case 3: float r = p; float g = q; b = brightness; break; case 4: float r = t; float g = p; b = brightness; break; case 5: default: r = brightness; g = p; b = q; } } red = ((int)(r * 255.0F + 0.5D)); green = ((int)(g * 255.0F + 0.5D)); blue = ((int)(b * 255.0F + 0.5D)); } public float[] getHSB() { float r = red / 255.0F; float g = green / 255.0F; float b = blue / 255.0F; float max = Math.max(Math.max(r, g), b); float min = Math.min(Math.min(r, g), b); float delta = max - min; float hue = 0.0F; float brightness = max; float saturation = max == 0.0F ? 0.0F : (max - min) / max; if (delta != 0.0F) { if (r == max) { hue = (g - b) / delta; } else if (g == max) { hue = 2.0F + (b - r) / delta; } else { hue = 4.0F + (r - g) / delta; } hue *= 60.0F; if (hue < 0.0F) { hue += 360.0F; } } return new float[] { hue, saturation, brightness }; } public boolean equals(Object object) { if (object == this) { return true; } if (!(object instanceof RGB)) { return false; } RGB rgb = (RGB)object; return (red == red) && (green == green) && (blue == blue); } public int hashCode() { return blue << 16 | green << 8 | red; } public String toString() { return "RGB {" + red + ", " + green + ", " + blue + "}"; } } /* Location: * Qualified Name: org.eclipse.swt.graphics.RGB * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.swt.graphics; import org.eclipse.swt.SWT; import org.eclipse.swt.internal.SerializableCompatibility; public final class Rectangle implements SerializableCompatibility { public int x; public int y; public int width; public int height; static final long serialVersionUID = 3256439218279428914L; public Rectangle(int x, int y, int width, int height) { this.x = x; this.y = y; this.width = width; this.height = height; } public void add(Rectangle rect) { if (rect == null) { SWT.error(4); } int left = x < x ? x : x; int top = y < y ? y : y; int lhs = x + width; int rhs = x + width; int right = lhs > rhs ? lhs : rhs; lhs = y + height; rhs = y + height; int bottom = lhs > rhs ? lhs : rhs; x = left;y = top;width = (right - left);height = (bottom - top); } public boolean contains(int x, int y) { return (x >= this.x) && (y >= this.y) && (x < this.x + width) && (y < this.y + height); } public boolean contains(Point pt) { if (pt == null) { SWT.error(4); } return contains(x, y); } public boolean equals(Object object) { if (object == this) { return true; } if (!(object instanceof Rectangle)) { return false; } Rectangle r = (Rectangle)object; return (x == x) && (y == y) && (width == width) && (height == height); } public int hashCode() { return x ^ y ^ width ^ height; } public void intersect(Rectangle rect) { if (rect == null) { SWT.error(4); } if (this == rect) { return; } int left = x > x ? x : x; int top = y > y ? y : y; int lhs = x + width; int rhs = x + width; int right = lhs < rhs ? lhs : rhs; lhs = y + height; rhs = y + height; int bottom = lhs < rhs ? lhs : rhs; x = (right < left ? 0 : left); y = (bottom < top ? 0 : top); width = (right < left ? 0 : right - left); height = (bottom < top ? 0 : bottom - top); } public Rectangle intersection(Rectangle rect) { if (rect == null) { SWT.error(4); } if (this == rect) { return new Rectangle(x, y, width, height); } int left = x > x ? x : x; int top = y > y ? y : y; int lhs = x + width; int rhs = x + width; int right = lhs < rhs ? lhs : rhs; lhs = y + height; rhs = y + height; int bottom = lhs < rhs ? lhs : rhs; return new Rectangle( right < left ? 0 : left, bottom < top ? 0 : top, right < left ? 0 : right - left, bottom < top ? 0 : bottom - top); } public boolean intersects(int x, int y, int width, int height) { return (x < this.x + this.width) && (y < this.y + this.height) && (x + width > this.x) && (y + height > this.y); } public boolean intersects(Rectangle rect) { if (rect == null) { SWT.error(4); } return (rect == this) || (intersects(x, y, width, height)); } public boolean isEmpty() { return (width <= 0) || (height <= 0); } public String toString() { return "Rectangle {" + x + ", " + y + ", " + width + ", " + height + "}"; } public Rectangle union(Rectangle rect) { if (rect == null) { SWT.error(4); } int left = x < x ? x : x; int top = y < y ? y : y; int lhs = x + width; int rhs = x + width; int right = lhs > rhs ? lhs : rhs; lhs = y + height; rhs = y + height; int bottom = lhs > rhs ? lhs : rhs; return new Rectangle(left, top, right - left, bottom - top); } } /* Location: * Qualified Name: org.eclipse.swt.graphics.Rectangle * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.swt.graphics; import org.eclipse.swt.SWT; import org.eclipse.swt.internal.win32.OS; import org.eclipse.swt.internal.win32.RECT; public final class Region extends Resource { public int handle; public Region() { this(null); } public Region(Device device) { super(device); handle = OS.CreateRectRgn(0, 0, 0, 0); if (handle == 0) { SWT.error(2); } init(); } Region(Device device, int handle) { super(device); this.handle = handle; } public void add(int[] pointArray) { if (isDisposed()) { SWT.error(44); } if (pointArray == null) { SWT.error(4); } if (OS.IsWinCE) { SWT.error(20); } int polyRgn = OS.CreatePolygonRgn(pointArray, pointArray.length / 2, 1); OS.CombineRgn(handle, handle, polyRgn, 2); OS.DeleteObject(polyRgn); } public void add(Rectangle rect) { if (isDisposed()) { SWT.error(44); } if (rect == null) { SWT.error(4); } add(x, y, width, height); } public void add(int x, int y, int width, int height) { if (isDisposed()) { SWT.error(44); } if ((width < 0) || (height < 0)) { SWT.error(5); } int rectRgn = OS.CreateRectRgn(x, y, x + width, y + height); OS.CombineRgn(handle, handle, rectRgn, 2); OS.DeleteObject(rectRgn); } public void add(Region region) { if (isDisposed()) { SWT.error(44); } if (region == null) { SWT.error(4); } if (region.isDisposed()) { SWT.error(5); } OS.CombineRgn(handle, handle, handle, 2); } public boolean contains(int x, int y) { if (isDisposed()) { SWT.error(44); } return OS.PtInRegion(handle, x, y); } public boolean contains(Point pt) { if (isDisposed()) { SWT.error(44); } if (pt == null) { SWT.error(4); } return contains(x, y); } void destroy() { OS.DeleteObject(handle); handle = 0; } public boolean equals(Object object) { if (this == object) { return true; } if (!(object instanceof Region)) { return false; } Region rgn = (Region)object; return handle == handle; } public Rectangle getBounds() { if (isDisposed()) { SWT.error(44); } RECT rect = new RECT(); OS.GetRgnBox(handle, rect); return new Rectangle(left, top, right - left, bottom - top); } public int hashCode() { return handle; } public void intersect(Rectangle rect) { if (isDisposed()) { SWT.error(44); } if (rect == null) { SWT.error(4); } intersect(x, y, width, height); } public void intersect(int x, int y, int width, int height) { if (isDisposed()) { SWT.error(44); } if ((width < 0) || (height < 0)) { SWT.error(5); } int rectRgn = OS.CreateRectRgn(x, y, x + width, y + height); OS.CombineRgn(handle, handle, rectRgn, 1); OS.DeleteObject(rectRgn); } public void intersect(Region region) { if (isDisposed()) { SWT.error(44); } if (region == null) { SWT.error(4); } if (region.isDisposed()) { SWT.error(5); } OS.CombineRgn(handle, handle, handle, 1); } public boolean intersects(int x, int y, int width, int height) { if (isDisposed()) { SWT.error(44); } RECT r = new RECT(); OS.SetRect(r, x, y, x + width, y + height); return OS.RectInRegion(handle, r); } public boolean intersects(Rectangle rect) { if (isDisposed()) { SWT.error(44); } if (rect == null) { SWT.error(4); } return intersects(x, y, width, height); } public boolean isDisposed() { return handle == 0; } public boolean isEmpty() { if (isDisposed()) { SWT.error(44); } RECT rect = new RECT(); int result = OS.GetRgnBox(handle, rect); if (result == 1) { return true; } return (right - left <= 0) || (bottom - top <= 0); } public void subtract(int[] pointArray) { if (isDisposed()) { SWT.error(44); } if (pointArray == null) { SWT.error(4); } if (OS.IsWinCE) { SWT.error(20); } int polyRgn = OS.CreatePolygonRgn(pointArray, pointArray.length / 2, 1); OS.CombineRgn(handle, handle, polyRgn, 4); OS.DeleteObject(polyRgn); } public void subtract(Rectangle rect) { if (isDisposed()) { SWT.error(44); } if (rect == null) { SWT.error(4); } subtract(x, y, width, height); } public void subtract(int x, int y, int width, int height) { if (isDisposed()) { SWT.error(44); } if ((width < 0) || (height < 0)) { SWT.error(5); } int rectRgn = OS.CreateRectRgn(x, y, x + width, y + height); OS.CombineRgn(handle, handle, rectRgn, 4); OS.DeleteObject(rectRgn); } public void subtract(Region region) { if (isDisposed()) { SWT.error(44); } if (region == null) { SWT.error(4); } if (region.isDisposed()) { SWT.error(5); } OS.CombineRgn(handle, handle, handle, 4); } public void translate(int x, int y) { if (isDisposed()) { SWT.error(44); } OS.OffsetRgn(handle, x, y); } public void translate(Point pt) { if (isDisposed()) { SWT.error(44); } if (pt == null) { SWT.error(4); } translate(x, y); } public String toString() { if (isDisposed()) { return "Region {*DISPOSED*}"; } return "Region {" + handle + "}"; } public static Region win32_new(Device device, int handle) { return new Region(device, handle); } } /* Location: * Qualified Name: org.eclipse.swt.graphics.Region * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.swt.graphics; import org.eclipse.swt.SWT; public abstract class Resource { Device device; public Resource() {} Resource(Device device) { if (device == null) { device = Device.getDevice(); } if (device == null) { SWT.error(4); } this.device = device; } void destroy() {} public void dispose() { if (device == null) { return; } if (device.isDisposed()) { return; } destroy(); if (device.tracking) { device.dispose_Object(this); } device = null; } public Device getDevice() { Device device = this.device; if ((device == null) || (isDisposed())) { SWT.error(44); } return device; } void init() { if (device.tracking) { device.new_Object(this); } } public abstract boolean isDisposed(); } /* Location: * Qualified Name: org.eclipse.swt.graphics.Resource * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.swt.graphics; import org.eclipse.swt.internal.win32.EMR; import org.eclipse.swt.internal.win32.EMREXTCREATEFONTINDIRECTW; import org.eclipse.swt.internal.win32.OS; class TextLayout$1$MetaFileEnumProc { final TextLayout this$0; private final EMREXTCREATEFONTINDIRECTW val$emr; TextLayout$1$MetaFileEnumProc(TextLayout paramTextLayout, EMREXTCREATEFONTINDIRECTW paramEMREXTCREATEFONTINDIRECTW) { this$0 = paramTextLayout;val$emr = paramEMREXTCREATEFONTINDIRECTW; } int metaFileEnumProc(int hDC, int table, int record, int nObj, int lpData) { OS.MoveMemory(val$emr.emr, record, EMR.sizeof); switch (val$emr.emr.iType) { case 82: OS.MoveMemory(val$emr, record, EMREXTCREATEFONTINDIRECTW.sizeof); break; case 84: return 0; } return 1; } } /* Loc Further reading...For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.New!JAR listings
|