本文整理汇总了Java中java.awt.PaintContext类的典型用法代码示例。如果您正苦于以下问题:Java PaintContext类的具体用法?Java PaintContext怎么用?Java PaintContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PaintContext类属于java.awt包,在下文中一共展示了PaintContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createContext
import java.awt.PaintContext; //导入依赖的package包/类
public PaintContext createContext(ColorModel colorModel,
Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform xform,
RenderingHints hints)
{
Point2D transformedCenter = xform.transform(m_center, null);
Point2D transformedRadius1 = xform.deltaTransform(m_radius1, null);
Point2D transformedRadius2 = xform.deltaTransform(m_radius2, null);
if (m_cachedContext != null
&& transformedCenter.equals(m_transformedCenter)
&& transformedRadius1.equals(m_transformedRadius1)
&& transformedRadius2.equals(m_transformedRadius2))
return m_cachedContext;
m_transformedCenter = (Point2D)transformedCenter.clone();
m_transformedRadius1 = (Point2D)transformedRadius1.clone();
m_transformedRadius2 = (Point2D)transformedRadius2.clone();
m_cachedContext =
new RadialGradientContext(transformedCenter, transformedRadius1,
transformedRadius2, m_focus,
m_color1, m_color2);
return m_cachedContext;
}
示例2: createContext
import java.awt.PaintContext; //导入依赖的package包/类
@Override
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) {
if(QUALITY_HINTS==null) {
QUALITY_HINTS = new RenderingHints(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
QUALITY_HINTS.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
QUALITY_HINTS.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
}
PaintContext context = super.createContext(cm, deviceBounds, userBounds, xform, QUALITY_HINTS);
if(cycle) {
return context;
}
AffineTransform newCopy = new AffineTransform();
if(xform!=null)
newCopy.concatenate(xform);
context = new CoveredContext(context,x1,y1,color1,x2,y2,color2,newCopy);
return context;
}
示例3: createContext
import java.awt.PaintContext; //导入依赖的package包/类
@Override
public PaintContext createContext(
ColorModel cm,
Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform xform,
RenderingHints hints
) {
AffineTransform T = getTextureTransform();
try {
T.invert();
} catch (NoninvertibleTransformException e) { }
if (xform == null) {
xform = T;
} else {
xform = (AffineTransform) xform.clone();
xform.concatenate(T);
}
return super.createContext(cm, deviceBounds, userBounds, xform, hints);
}
示例4: createContext
import java.awt.PaintContext; //导入依赖的package包/类
/** create a paint context */
public PaintContext createContext(ColorModel cm,
Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform xform,
RenderingHints hints)
{
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
ColorModel model = new ComponentColorModel(cs,
true,
false,
Transparency.TRANSLUCENT,
DataBuffer.TYPE_BYTE);
Point2D devStart = xform.transform(getAxisStart(), null);
Point2D devEnd = xform.transform(getAxisEnd(), null);
return new Type2PaintContext(model, devStart, devEnd);
}
示例5: createContext
import java.awt.PaintContext; //导入依赖的package包/类
public PaintContext createContext(ColorModel colorModel,
Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform xform,
RenderingHints hints)
{
Point2D transformedPoint = xform.transform(m_point, null);
Point2D transformedRadius = xform.deltaTransform(m_radius, null);
if (m_cachedContext != null
&& transformedPoint.equals(m_transformedPoint)
&& transformedRadius.equals(m_transformedRadius))
return m_cachedContext;
m_transformedPoint = (Point2D)transformedPoint.clone();
m_transformedRadius = (Point2D)transformedRadius.clone();
m_cachedContext =
new RadialGradientContext(transformedPoint, m_pointColor,
transformedRadius, m_backgroundColor);
return m_cachedContext;
}
示例6: fillMultiRectAreaPaint
import java.awt.PaintContext; //导入依赖的package包/类
/**
* This method fills the given MultiRectArea with any paint.
* @param mra MultiRectArea to fill
*/
protected void fillMultiRectAreaPaint(MultiRectArea mra) {
Rectangle rec = mra.getBounds();
int x = rec.x;
int y = rec.y;
int w = rec.width;
int h = rec.height;
if(w <= 0 || h <= 0) {
return;
}
PaintContext pc = paint.createContext(null, rec, rec, transform, hints);
Raster r = pc.getRaster(x, y, w, h);
WritableRaster wr;
if(r instanceof WritableRaster){
wr = (WritableRaster) r;
}else{
wr = r.createCompatibleWritableRaster();
wr.setRect(r);
}
Surface srcSurf = new ImageSurface(pc.getColorModel(), wr);
blitter.blit(0, 0, srcSurf, x, y, dstSurf, w, h,
composite, null, mra);
srcSurf.dispose();
}
示例7: startSequence
import java.awt.PaintContext; //导入依赖的package包/类
@Override
public Object startSequence(SunGraphics2D sg, Shape s, Rectangle devR,
int[] abox) {
// warning: clone map:
RenderingHints hints = sg.getRenderingHints();
ColorModel model = sg.getDeviceColorModel();
PaintContext paintContext =
sg.paint.createContext(model, devR, s.getBounds2D(),
sg.cloneTransform(),
hints);
CompositeContext compositeContext =
sg.composite.createContext(paintContext.getColorModel(), model,
hints);
// BlendComposite matcher: classpath independent so use String.equals()
boolean blendComposite = "sun.java2d.pipe.BlendComposite".equals(sg.composite.getClass().getName());
// use ThreadLocal (to reduce memory footprint):
final TileContext tc = tileContextThreadLocal.get();
tc.init(sg, paintContext, compositeContext, model, blendComposite);
return tc;
}
示例8: createContext
import java.awt.PaintContext; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public PaintContext createContext(ColorModel cm,
Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform transform,
RenderingHints hints) {
// avoid modifying the user's transform...
transform = new AffineTransform(transform);
// incorporate the gradient transform
transform.concatenate(gradientTransform);
return new ParamGradientMapPaintContext(this, cm,
deviceBounds, userBounds,
transform, hints,
origin, majorAxis, minorAxis, startParam, endParam,
fractions, colors,
cycleMethod, colorSpace);
}
示例9: TileContext
import java.awt.PaintContext; //导入依赖的package包/类
public TileContext(SunGraphics2D sg, PaintContext pc) {
sunG2D = sg;
paintCtxt = pc;
paintModel = pc.getColorModel();
dstData = sg.getSurfaceData();
synchronized (AlphaPaintPipe.class) {
if (cachedLastColorModel != null &&
cachedLastColorModel.get() == paintModel)
{
this.lastRaster = cachedLastRaster;
this.lastData = cachedLastData;
}
}
}
示例10: startSequence
import java.awt.PaintContext; //导入依赖的package包/类
public Object startSequence(SunGraphics2D sg, Shape s, Rectangle devR,
int[] abox) {
PaintContext paintContext =
sg.paint.createContext(sg.getDeviceColorModel(),
devR,
s.getBounds2D(),
sg.cloneTransform(),
sg.getRenderingHints());
return new TileContext(sg, paintContext);
}
示例11: TileContext
import java.awt.PaintContext; //导入依赖的package包/类
public TileContext(SunGraphics2D sg, PaintContext pCtx,
CompositeContext cCtx, ColorModel cModel) {
sunG2D = sg;
paintCtxt = pCtx;
compCtxt = cCtx;
compModel = cModel;
}
示例12: startSequence
import java.awt.PaintContext; //导入依赖的package包/类
public Object startSequence(SunGraphics2D sg, Shape s, Rectangle devR,
int[] abox) {
RenderingHints hints = sg.getRenderingHints();
ColorModel model = sg.getDeviceColorModel();
PaintContext paintContext =
sg.paint.createContext(model, devR, s.getBounds2D(),
sg.cloneTransform(),
hints);
CompositeContext compositeContext =
sg.composite.createContext(paintContext.getColorModel(), model,
hints);
return new TileContext(sg, paintContext, compositeContext, model);
}
示例13: createContext
import java.awt.PaintContext; //导入依赖的package包/类
public PaintContext createContext(ColorModel cm,
Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform xform,
RenderingHints hints)
{
System.out.println("user bounds = "+userBounds);
if (!userBounds.equals(expectedBounds)) {
throw new RuntimeException("bounds fail to match");
}
return c.createContext(cm, deviceBounds, userBounds, xform, hints);
}
示例14: createContext
import java.awt.PaintContext; //导入依赖的package包/类
@Override
public PaintContext createContext(ColorModel cm,
Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform at,
RenderingHints hints) {
// Fill bufferedImage using
final Graphics2D g2d = (Graphics2D) getImage().getGraphics();
try {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setBackground(Color.PINK);
g2d.clearRect(0, 0, size, size);
g2d.setColor(Color.BLUE);
g2d.drawRect(0, 0, size, size);
g2d.fillOval(size / 10, size / 10,
size * 8 / 10, size * 8 / 10);
} finally {
g2d.dispose();
}
return super.createContext(cm, deviceBounds, userBounds, at, hints);
}
示例15: createContext
import java.awt.PaintContext; //导入依赖的package包/类
/**
* See Paint.createContext
*/
public PaintContext createContext( ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints ) {
Point2D transformedCenter = xform.transform( center, null );
//Transform from user space to device space and create the gradient context
double transformedInnerMiddleSpan = xform.deltaTransform( new Point2D.Double( innerMiddleSpan, 0 ), null ).getX();
double transformedMiddleOuterSpan = xform.deltaTransform( new Point2D.Double( middleOuterSpan, 0 ), null ).getX();
return new TriColorRoundGradientContext( innerColor, middleColor, outerColor, transformedCenter, transformedInnerMiddleSpan, transformedMiddleOuterSpan );
}