本文整理汇总了Java中sun.java2d.SunGraphics2D.getComposite方法的典型用法代码示例。如果您正苦于以下问题:Java SunGraphics2D.getComposite方法的具体用法?Java SunGraphics2D.getComposite怎么用?Java SunGraphics2D.getComposite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.java2d.SunGraphics2D
的用法示例。
在下文中一共展示了SunGraphics2D.getComposite方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createXorPixelWriter
import sun.java2d.SunGraphics2D; //导入方法依赖的package包/类
static PixelWriter createXorPixelWriter(SunGraphics2D sg2d,
SurfaceData sData)
{
ColorModel dstCM = sData.getColorModel();
Object srcPixel = dstCM.getDataElements(sg2d.eargb, null);
XORComposite comp = (XORComposite)sg2d.getComposite();
int xorrgb = comp.getXorColor().getRGB();
Object xorPixel = dstCM.getDataElements(xorrgb, null);
switch (dstCM.getTransferType()) {
case DataBuffer.TYPE_BYTE:
return new XorPixelWriter.ByteData(srcPixel, xorPixel);
case DataBuffer.TYPE_SHORT:
case DataBuffer.TYPE_USHORT:
return new XorPixelWriter.ShortData(srcPixel, xorPixel);
case DataBuffer.TYPE_INT:
return new XorPixelWriter.IntData(srcPixel, xorPixel);
case DataBuffer.TYPE_FLOAT:
return new XorPixelWriter.FloatData(srcPixel, xorPixel);
case DataBuffer.TYPE_DOUBLE:
return new XorPixelWriter.DoubleData(srcPixel, xorPixel);
default:
throw new InternalError("Unsupported XOR pixel type");
}
}
示例2: validateAsDestination
import sun.java2d.SunGraphics2D; //导入方法依赖的package包/类
/**
* Validates the Surface when used as destination.
*/
public void validateAsDestination(SunGraphics2D sg2d, Region clip) {
if (!isValid()) {
throw new InvalidPipeException("bounds changed");
}
boolean updateGCClip = false;
if (clip != validatedClip) {
renderQueue.setClipRectangles(picture, clip);
validatedClip = clip;
updateGCClip = true;
}
if (sg2d != null && sg2d.compositeState == SunGraphics2D.COMP_XOR) {
if (validatedXorComp != sg2d.getComposite()) {
validatedXorComp = (XORComposite) sg2d.getComposite();
renderQueue.setGCMode(xgc, false);
}
// validate pixel
int pixel = sg2d.pixel;
if (validatedGCForegroundPixel != pixel) {
int xorpixelmod = validatedXorComp.getXorPixel();
renderQueue.setGCForeground(xgc, pixel ^ xorpixelmod);
validatedGCForegroundPixel = pixel;
}
if (updateGCClip) {
renderQueue.setGCClipRectangles(xgc, clip);
}
}
}