use of sun.java2d.loops.XORComposite in project jdk8u_jdk by JetBrains.
the class BufferedContext method setComposite.
private void setComposite(Composite comp, int flags) {
// assert rq.lock.isHeldByCurrentThread();
if (comp instanceof AlphaComposite) {
AlphaComposite ac = (AlphaComposite) comp;
rq.ensureCapacity(16);
buf.putInt(SET_ALPHA_COMPOSITE);
buf.putInt(ac.getRule());
buf.putFloat(ac.getAlpha());
buf.putInt(flags);
} else if (comp instanceof XORComposite) {
int xorPixel = ((XORComposite) comp).getXorPixel();
rq.ensureCapacity(8);
buf.putInt(SET_XOR_COMPOSITE);
buf.putInt(xorPixel);
} else {
throw new InternalError("not yet implemented");
}
}
use of sun.java2d.loops.XORComposite in project jdk8u_jdk by JetBrains.
the class SunGraphics2D method setComposite.
/**
* Sets the Composite in the current graphics state. Composite is used
* in all drawing methods such as drawImage, drawString, drawPath,
* and fillPath. It specifies how new pixels are to be combined with
* the existing pixels on the graphics device in the rendering process.
* @param comp The Composite object to be used for drawing.
* @see java.awt.Graphics#setXORMode
* @see java.awt.Graphics#setPaintMode
* @see AlphaComposite
*/
public void setComposite(Composite comp) {
if (composite == comp) {
return;
}
int newCompState;
CompositeType newCompType;
if (comp instanceof AlphaComposite) {
AlphaComposite alphacomp = (AlphaComposite) comp;
newCompType = CompositeType.forAlphaComposite(alphacomp);
if (newCompType == CompositeType.SrcOverNoEa) {
if (paintState == PAINT_OPAQUECOLOR || (paintState > PAINT_ALPHACOLOR && paint.getTransparency() == Transparency.OPAQUE)) {
newCompState = COMP_ISCOPY;
} else {
newCompState = COMP_ALPHA;
}
} else if (newCompType == CompositeType.SrcNoEa || newCompType == CompositeType.Src || newCompType == CompositeType.Clear) {
newCompState = COMP_ISCOPY;
} else if (surfaceData.getTransparency() == Transparency.OPAQUE && newCompType == CompositeType.SrcIn) {
newCompState = COMP_ISCOPY;
} else {
newCompState = COMP_ALPHA;
}
} else if (comp instanceof XORComposite) {
newCompState = COMP_XOR;
newCompType = CompositeType.Xor;
} else if (comp == null) {
throw new IllegalArgumentException("null Composite");
} else {
surfaceData.checkCustomComposite();
newCompState = COMP_CUSTOM;
newCompType = CompositeType.General;
}
if (compositeState != newCompState || imageComp != newCompType) {
compositeState = newCompState;
imageComp = newCompType;
invalidatePipe();
validFontInfo = false;
}
composite = comp;
if (paintState <= PAINT_ALPHACOLOR) {
validateColor();
}
}
use of sun.java2d.loops.XORComposite in project jdk8u_jdk by JetBrains.
the class SunGraphics2D method revalidateAll.
private void revalidateAll() {
try {
// REMIND: This locking needs to be done around the
// caller of this method so that the pipe stays valid
// long enough to call the new primitive.
// REMIND: No locking yet in screen SurfaceData objects!
// surfaceData.lock();
surfaceData = surfaceData.getReplacement();
if (surfaceData == null) {
surfaceData = NullSurfaceData.theInstance;
}
invalidatePipe();
// this will recalculate the composite clip
setDevClip(surfaceData.getBounds());
if (paintState <= PAINT_ALPHACOLOR) {
validateColor();
}
if (composite instanceof XORComposite) {
Color c = ((XORComposite) composite).getXorColor();
setComposite(new XORComposite(c, surfaceData));
}
validatePipe();
} finally {
// REMIND: No locking yet in screen SurfaceData objects!
// surfaceData.unlock();
}
}
Aggregations