當前位置: 首頁>>代碼示例>>Java>>正文


Java CompositeContext類代碼示例

本文整理匯總了Java中java.awt.CompositeContext的典型用法代碼示例。如果您正苦於以下問題:Java CompositeContext類的具體用法?Java CompositeContext怎麽用?Java CompositeContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CompositeContext類屬於java.awt包,在下文中一共展示了CompositeContext類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Blit

import java.awt.CompositeContext; //導入依賴的package包/類
public void Blit(SurfaceData srcData,
                 SurfaceData dstData,
                 Composite comp,
                 Region clip,
                 int srcx, int srcy,
                 int dstx, int dsty,
                 int width, int height)
{
    ColorModel srcCM = srcData.getColorModel();
    ColorModel dstCM = dstData.getColorModel();
    // REMIND: Should get RenderingHints from sg2d
    CompositeContext ctx = comp.createContext(srcCM, dstCM,
                                              new RenderingHints(null));
    Raster srcRas = srcData.getRaster(srcx, srcy, width, height);
    WritableRaster dstRas =
        (WritableRaster) dstData.getRaster(dstx, dsty, width, height);

    if (clip == null) {
        clip = Region.getInstanceXYWH(dstx, dsty, width, height);
    }
    int span[] = {dstx, dsty, dstx+width, dsty+height};
    SpanIterator si = clip.getSpanIterator(span);
    srcx -= dstx;
    srcy -= dsty;
    while (si.nextSpan(span)) {
        int w = span[2] - span[0];
        int h = span[3] - span[1];
        Raster tmpSrcRas = srcRas.createChild(srcx + span[0], srcy + span[1],
                                              w, h, 0, 0, null);
        WritableRaster tmpDstRas = dstRas.createWritableChild(span[0], span[1],
                                                              w, h, 0, 0, null);
        ctx.compose(tmpSrcRas, tmpDstRas, tmpDstRas);
    }
    ctx.dispose();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:36,代碼來源:Blit.java

示例2: createContext

import java.awt.CompositeContext; //導入依賴的package包/類
@Override
public final CompositeContext createContext(final ColorModel srcColorModel,
		final ColorModel dstColorModel, final RenderingHints hints) {
	return new CompositeContext() {
		
		@Override
		public final void dispose() {
			// NOP
		}
		
		@Override
		public final void compose(final Raster src, final Raster dstIn, final WritableRaster dstOut) {
			final Rectangle inBounds = dstIn.getBounds();
			final Rectangle outBounds = dstOut.getBounds();
			
			for (int yIn = inBounds.y, yOut = outBounds.y; yIn < inBounds.y + inBounds.height; ++yIn, ++yOut) {
				for (int xIn = inBounds.x, xOut = outBounds.x; xIn < inBounds.x + inBounds.width; ++xIn, ++xOut) {
					final int[] datum = (int[]) dstIn.getDataElements(xIn, yIn, null);
					datum[0] = (datum[0] & 0xFF000000) | (~datum[0] & 0x00FFFFFF);
					dstOut.setDataElements(xOut, yOut, datum);
				}
			}
		}
		
	};
}
 
開發者ID:apgrgr,項目名稱:SyntheticWSI,代碼行數:27,代碼來源:ModelMaker.java

示例3: createContext

import java.awt.CompositeContext; //導入依賴的package包/類
@Override
public CompositeContext createContext(ColorModel srcColorModel,
		ColorModel dstColorModel,
		RenderingHints arg2) {
	switch (mode) {
	case MULTIPLY:
		return new MultiplyContext();
	// Modes with significant creation overhead (lookup tables). Cache those
	case SOFT_LIGHT:
		CompositeContext ctx = cache.get(Mode.SOFT_LIGHT);
		if (ctx == null) {
			ctx = new BlendContext(mode, color);
			cache.put(Mode.SOFT_LIGHT, ctx);
		}
		return ctx;
	default:
		return new BlendContext(mode, color);
	}
}
 
開發者ID:arianne,項目名稱:stendhal,代碼行數:20,代碼來源:Blend.java

示例4: startSequence

import java.awt.CompositeContext; //導入依賴的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

示例5: blendMode

import java.awt.CompositeContext; //導入依賴的package包/類
/**
 * ( begin auto-generated from blendMode.xml ) This is a new reference entry for Processing 2.0.
 * It will be updated shortly. ( end auto-generated )
 * 
 * @webref Rendering
 * @param mode
 *            the blending mode to use
 */
@Override
public void blendMode(final int mode) {
	if (mode == PConstants.BLEND) {
		g2.setComposite(defaultComposite);

	} else {
		g2.setComposite(new Composite() {

			@Override
			public CompositeContext createContext(final ColorModel srcColorModel, final ColorModel dstColorModel,
			        final RenderingHints hints) {
				return new BlendingContext(mode);
			}
		});
	}
}
 
開發者ID:aarongolliver,項目名稱:FractalFlameV3,代碼行數:25,代碼來源:PGraphicsJava2D.java

示例6: TileContext

import java.awt.CompositeContext; //導入依賴的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

示例7: startSequence

import java.awt.CompositeContext; //導入依賴的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

示例8: createContext

import java.awt.CompositeContext; //導入依賴的package包/類
@Override
public CompositeContext createContext(ColorModel srcColorModel,
                                      ColorModel dstColorModel,
                                      RenderingHints hints)
{
    return new CustomCompositeContext();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:8,代碼來源:OpenJDKFillBug.java

示例9: createContext

import java.awt.CompositeContext; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
public CompositeContext createContext(ColorModel srcColorModel,
                                      ColorModel dstColorModel,
                                      RenderingHints hints) {
    if (isRgbColorModel(srcColorModel) && isRgbColorModel(dstColorModel)) {
        return new BlendingRgbContext(this);
    } else if (isBgrColorModel(srcColorModel) && isBgrColorModel(dstColorModel)) {
        return new BlendingBgrContext(this);
    }

    throw new RasterFormatException("Incompatible color models");
}
 
開發者ID:teddyted,項目名稱:iSeleda,代碼行數:15,代碼來源:BlendComposite.java

示例10: createContext

import java.awt.CompositeContext; //導入依賴的package包/類
/**
 * Creates a context object for performing the compositing
 * operation. Several contexts may co-exist for one composite; each
 * context may simultaneously be called from concurrent threads.
 *
 * @param srcColorModel the color model of the source.
 * @param dstColorModel the color model of the destination.
 * @param hints hints for choosing between rendering alternatives.
 */
public CompositeContext createContext(ColorModel srcColorModel,
                                      ColorModel dstColorModel,
                                      RenderingHints hints)
{
  if (IntContext.isSupported(srcColorModel, dstColorModel, hints))
    return new IntContext(srcColorModel, xorColor);

  return new GeneralContext(srcColorModel, dstColorModel, xorColor);
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:19,代碼來源:BitwiseXORComposite.java

示例11: FilterContext

import java.awt.CompositeContext; //導入依賴的package包/類
public FilterContext(ColorModel dstModel, CompositeContext ctx, BufferedImageOp filter) {
    Contract.asNotNull(dstModel, "dstModel cannot be null");
    Contract.asNotNull(ctx, "context cannot be null");
    this.dstModel = dstModel;
    this.ctx = ctx;
    this.filter = filter;
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:8,代碼來源:FilterComposite.java

示例12: createContext

import java.awt.CompositeContext; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public CompositeContext createContext(ColorModel srcColorModel,
                                      ColorModel dstColorModel,
                                      RenderingHints hints) {
    if (isRgbColorModel(srcColorModel) && isRgbColorModel(dstColorModel)) {
        return new BlendingRgbContext(this);
    } else if (isBgrColorModel(srcColorModel) && isBgrColorModel(dstColorModel)) {
        return new BlendingBgrContext(this);
    }

    throw new RasterFormatException("Incompatible color models:\n  " + srcColorModel + "\n  " + dstColorModel);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:16,代碼來源:BlendComposite.java

示例13: init

import java.awt.CompositeContext; //導入依賴的package包/類
void init(SunGraphics2D sg, PaintContext pCtx,
          CompositeContext cCtx, ColorModel cModel,
          boolean blendComposite, boolean extraAlpha)
{
    sunG2D = sg;
    paintCtxt = pCtx;
    compCtxt = cCtx;
    compModel = cModel;
    isBlendComposite = blendComposite;
    hasExtraAlpha = extraAlpha;
}
 
開發者ID:bourgesl,項目名稱:marlin-graphics,代碼行數:12,代碼來源:GammaCompositePipe.java

示例14: createContext

import java.awt.CompositeContext; //導入依賴的package包/類
@Override
public CompositeContext createContext(ColorModel srcColorModel,
                                      ColorModel dstColorModel, RenderingHints hints) {

    // use ThreadLocal (to reduce memory footprint):
    final BlendingContext bc = blendContextThreadLocal.get();
    bc.init(this);
    return bc;

}
 
開發者ID:bourgesl,項目名稱:marlin-graphics,代碼行數:11,代碼來源:BlendComposite.java

示例15: createContext

import java.awt.CompositeContext; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
public CompositeContext createContext(ColorModel srcColorModel,
                                      ColorModel dstColorModel,
                                      RenderingHints hints) {
    if (!checkComponentsOrder(srcColorModel) ||
            !checkComponentsOrder(dstColorModel)) {
        throw new RasterFormatException("Incompatible color models");
    }
    
    return new BlendingContext(this);
}
 
開發者ID:romainguy,項目名稱:filthy-rich-clients,代碼行數:14,代碼來源:BlendComposite.java


注:本文中的java.awt.CompositeContext類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。