diff options
author | Silenio Quarti <silenio> | 2005-05-19 19:29:16 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2005-05-19 19:29:16 +0000 |
commit | 1b465b15aa64364a5371d454f521be3cc25ef675 (patch) | |
tree | 296f965cc1e5814be2c0425540e3f7f7e483f2d0 | |
parent | 6079b58ee7045c020f911594524a48a4bc5cb888 (diff) | |
download | eclipse.platform.swt-1b465b15aa64364a5371d454f521be3cc25ef675.tar.gz eclipse.platform.swt-1b465b15aa64364a5371d454f521be3cc25ef675.tar.xz eclipse.platform.swt-1b465b15aa64364a5371d454f521be3cc25ef675.zip |
adding get/setAdvanced()
4 files changed, 71 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java index 62bb7609f3..0606d1b462 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java @@ -1505,6 +1505,11 @@ public Pattern getBackgroundPattern() { return data.backgroundPattern; } +boolean getAdvanced() { + if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return data.advanced; +} + /** * WARNING API STILL UNDER CONSTRUCTION AND SUBJECT TO CHANGE */ @@ -1922,6 +1927,22 @@ boolean isIdentity(float[] transform) { && transform[3] == 1 && transform[4] == 0 && transform[5] == 0; } +void setAdvanced(boolean advanced) { + if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (advanced && data.advanced) return; + data.advanced = advanced; + if (!advanced) { + setAlpha(0xFF); + setAntialias(SWT.DEFAULT); + setBackgroundPattern(null); + setClipping(0); + setForegroundPattern(null); + setInterpolation(SWT.DEFAULT); + setTextAntialias(SWT.DEFAULT); + setTransform(null); + } +} + /** * WARNING API STILL UNDER CONSTRUCTION AND SUBJECT TO CHANGE */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GCData.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GCData.java index 899661c018..86eb398fc3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GCData.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GCData.java @@ -47,6 +47,7 @@ public final class GCData { public int antialias = SWT.DEFAULT; public int textAntialias = SWT.DEFAULT; public int fillRule = SWT.FILL_EVEN_ODD; + public boolean advanced; public Font font; public int fontAscent; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java index 78a26d3c30..6163798faf 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java @@ -1628,6 +1628,11 @@ public int getAdvanceWidth(char ch) { return stringExtent(new String(new char[]{ch})).x; } +boolean getAdvanced() { + if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return data.cairo != 0; +} + /** * WARNING API STILL UNDER CONSTRUCTION AND SUBJECT TO CHANGE */ @@ -2166,6 +2171,27 @@ boolean isIdentity(int /*long*/ matrix) { return a[0] == 1 && b[0] == 0 && c[0] == 0 && d[0] == 1 && tx[0] == 0 && ty[0] == 0; } +void setAdvanced(boolean advanced) { + if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (advanced && data.cairo != 0) return; + if (advanced) { + try { + initCairo(); + } catch (SWTException e) {} + } else { + int /*long*/ cairo = data.cairo; + if (cairo != 0) Cairo.cairo_destroy(cairo); + int /*long*/ matrix = data.matrix; + if (matrix != 0) Cairo.cairo_matrix_destroy(matrix); + int /*long*/ inverseMatrix = data.inverseMatrix; + if (inverseMatrix != 0) Cairo.cairo_matrix_destroy(inverseMatrix); + data.cairo = data.matrix = data.inverseMatrix = 0; + data.antialias = data.textAntialias = data.interpolation = SWT.DEFAULT; + data.backgroundPattern = data.foregroundPattern = null; + setClipping(0); + } +} + /** * WARNING API STILL UNDER CONSTRUCTION AND SUBJECT TO CHANGE */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java index 2da812dd31..dd87f460e0 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java @@ -2328,6 +2328,11 @@ public int getAdvanceWidth(char ch) { return width[0]; } +boolean getAdvanced() { + if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return data.gdipGraphics != 0; +} + /** * Returns the receiver's alpha value. * @@ -3080,6 +3085,24 @@ float measureSpace(int font, int format) { return bounds.Width; } +void setAdvanced(boolean advanced) { + if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (advanced && data.gdipGraphics != 0) return; + if (advanced) { + try { + initGdip(false, false); + } catch (SWTException e) {} + } else { + if (data.gdipGraphics != 0) Gdip.Graphics_delete(data.gdipGraphics); + if (data.gdipPen != 0) Gdip.Pen_delete(data.gdipPen); + if (data.gdipBrush != 0) destroyGdipBrush(data.gdipBrush); + data.gdipGraphics = data.gdipBrush = data.gdipPen = 0; + data.alpha = 0xFF; + data.backgroundPattern = data.foregroundPattern = null; + setClipping(0); + } +} + /** * Sets the receiver's anti-aliasing value to the parameter, * which must be one of <code>SWT.DEFAULT</code>, <code>SWT.OFF</code> |