diff options
| author | Mario Torre <neugens@limasoftware.net> | 2008-05-29 16:41:39 +0000 |
|---|---|---|
| committer | Mario Torre <neugens@limasoftware.net> | 2008-05-29 16:41:39 +0000 |
| commit | c191297d1febe4e68c77215726c451c095d9c954 (patch) | |
| tree | e8c9585dd1ab0ad6353c50e9d4a7f08f7075fa5b /java/awt | |
| parent | 1a8cbdd821fd0bcd92cd104abc091ababd777973 (diff) | |
| download | classpath-c191297d1febe4e68c77215726c451c095d9c954.tar.gz | |
2008-05-29 Mario Torre <neugens@aicas.com>
* gnu/java/awt/java2d/AbstractGraphics2D.java (setColor): now set directly
the foreground color the application wants to use to draw. On null, behave
like OpenJDK, drawing black.
(renderScanline): fixed NPE, paintContext never initialized. Correctely
retrieve destination raster
(getColor): Return the correct type.
(static initializer): HashMap now typed.
(background): now defaults to black and not null.
(getPaintContext): new method. Initialize lazily the PaintContext.
(foreground): new field.
(isForegroundColorNull): likewise.
(getDeviceBounds): made abstract.
* gnu/java/awt/java2d/RasterGraphics.java (getDeviceBounds): new method.
* gnu/java/awt/java2d/ScanlineConverter.java (renderShape): pass correct
value of Y to doScanline.
* gnu/java/awt/peer/x/GLGraphics.java (getDeviceBounds): new method.
(setBackground): synch with new Escher 2.0 API.
* gnu/java/awt/peer/x/XGraphicsConfiguration.java (getDefaultTransform):
implemented.
(getBounds): new method.
* java/awt/AlphaComposite.java (derive(int) and derive(float)):
new methods.
* java/awt/image/WritableRaster.java (createWritableTranslatedChild):
now call createWritableChild.
(createWritableChild): reformatted.
Diffstat (limited to 'java/awt')
| -rw-r--r-- | java/awt/AlphaComposite.java | 35 | ||||
| -rw-r--r-- | java/awt/image/WritableRaster.java | 23 |
2 files changed, 45 insertions, 13 deletions
diff --git a/java/awt/AlphaComposite.java b/java/awt/AlphaComposite.java index addd1e713..a668fdae6 100644 --- a/java/awt/AlphaComposite.java +++ b/java/awt/AlphaComposite.java @@ -158,18 +158,53 @@ public final class AlphaComposite implements Composite return new AlphaCompositeContext(this, srcColorModel, dstColorModel); } + /** + * Return an <code>AlphaComposite</code> similar to <code>this</code>, + * that uses the specified rule. If <code>rule</code> is the same as + * <code>this.rule</code>, then <code>this</code> is returned. + * + * @since 1.6 + */ + public AlphaComposite derive(int rule) + { + if (this.rule == rule) + return this; + else + return AlphaComposite.getInstance(rule, this.getAlpha()); + } + + /** + * Return an <code>AlphaComposite</code> similar to <code>this</code>, + * that uses the specified <code>alpha</code>. + * + * If <code>alph</code> is the same as <code>this.alpha</code>, + * then <code>this</code> is returned. + * + * @since 1.6 + */ + public AlphaComposite derive(float alpha) + { + if (this.getAlpha() == alpha) + return this; + else + return AlphaComposite.getInstance(this.getRule(), alpha); + } + public float getAlpha() { return alpha; } + public int getRule() { return rule; } + public int hashCode() { return 31 * Float.floatToIntBits(alpha) + rule; } + public boolean equals(Object o) { if (! (o instanceof AlphaComposite)) diff --git a/java/awt/image/WritableRaster.java b/java/awt/image/WritableRaster.java index bf8db140c..02789a3d1 100644 --- a/java/awt/image/WritableRaster.java +++ b/java/awt/image/WritableRaster.java @@ -111,13 +111,8 @@ public class WritableRaster extends Raster public WritableRaster createWritableTranslatedChild(int childMinX, int childMinY) { - // This mirrors the code from the super class - int tcx = sampleModelTranslateX - minX + childMinX; - int tcy = sampleModelTranslateY - minY + childMinY; - - return new WritableRaster(sampleModel, dataBuffer, - new Rectangle(childMinX, childMinY, width, height), - new Point(tcx, tcy), this); + return createWritableChild(minX, minY, width, height, + childMinX, childMinY, null); } /** @@ -143,12 +138,14 @@ public class WritableRaster extends Raster SampleModel sm = (bandList == null) ? sampleModel : sampleModel.createSubsetSampleModel(bandList); - - return new WritableRaster(sm, dataBuffer, - new Rectangle(childMinX, childMinY, w, h), - new Point(sampleModelTranslateX + childMinX - parentX, - sampleModelTranslateY + childMinY - parentY), - this); + + return new WritableRaster(sm, getDataBuffer(), + new Rectangle(childMinX, childMinY, w, h), + new Point(sampleModelTranslateX + childMinX - + parentX, + sampleModelTranslateY + childMinY - + parentY), + this); } public Raster createChild(int parentX, int parentY, int width, |
