当前位置: 首页>>代码示例>>Java>>正文


Java PaintContext类代码示例

本文整理汇总了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;
}
 
开发者ID:havkarl,项目名称:gogui2,代码行数:24,代码来源:RadialGradientPaint.java

示例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;
}
 
开发者ID:mickleness,项目名称:pumpernickel,代码行数:23,代码来源:HalftoneGradient.java

示例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);
}
 
开发者ID:sechel,项目名称:jtem-halfedgetools,代码行数:21,代码来源:AffineTexturePaint.java

示例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);
}
 
开发者ID:jhkst,项目名称:pdf-renderer-noawt,代码行数:20,代码来源:ShaderType2.java

示例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;
}
 
开发者ID:ryanbhayward,项目名称:hexgui,代码行数:20,代码来源:RadialGradientPaint.java

示例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();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:28,代码来源:CommonGraphics2D.java

示例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;
}
 
开发者ID:bourgesl,项目名称:marlin-renderer,代码行数:23,代码来源:GeneralCompositePipe.java

示例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);
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:22,代码来源:ParamGradientMapPaint.java

示例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;
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:AlphaPaintPipe.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:AlphaPaintPipe.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:GeneralCompositePipe.java

示例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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:GeneralCompositePipe.java

示例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);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:PgramUserBoundsTest.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:CrashPaintTest.java

示例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 );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:TriColorRoundGradientPaint.java


注:本文中的java.awt.PaintContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。