sun.java2d.loops.CompositeType Java Examples
The following examples show how to use
sun.java2d.loops.CompositeType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DrawImage.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
protected boolean scaleSurfaceData(SunGraphics2D sg, Region clipRegion, SurfaceData srcData, SurfaceData dstData, SurfaceType srcType, SurfaceType dstType, int sx1, int sy1, int sx2, int sy2, double dx1, double dy1, double dx2, double dy2) { CompositeType comp = sg.imageComp; if (CompositeType.SrcOverNoEa.equals(comp) && (srcData.getTransparency() == Transparency.OPAQUE)) { comp = CompositeType.SrcNoEa; } ScaledBlit blit = ScaledBlit.getFromCache(srcType, comp, dstType); if (blit != null) { blit.Scale(srcData, dstData, sg.composite, clipRegion, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2); return true; } return false; }
Example #2
Source File: BufImgSurfaceData.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public static synchronized RenderLoops getSolidLoops(SurfaceType type) { for (int i = CACHE_SIZE - 1; i >= 0; i--) { SurfaceType t = typecache[i]; if (t == type) { return loopcache[i]; } else if (t == null) { break; } } RenderLoops l = makeRenderLoops(SurfaceType.OpaqueColor, CompositeType.SrcNoEa, type); System.arraycopy(loopcache, 1, loopcache, 0, CACHE_SIZE-1); System.arraycopy(typecache, 1, typecache, 0, CACHE_SIZE-1); loopcache[CACHE_SIZE - 1] = l; typecache[CACHE_SIZE - 1] = type; return l; }
Example #3
Source File: BufImgSurfaceData.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public static synchronized RenderLoops getSolidLoops(SurfaceType type) { for (int i = CACHE_SIZE - 1; i >= 0; i--) { SurfaceType t = typecache[i]; if (t == type) { return loopcache[i]; } else if (t == null) { break; } } RenderLoops l = makeRenderLoops(SurfaceType.OpaqueColor, CompositeType.SrcNoEa, type); System.arraycopy(loopcache, 1, loopcache, 0, CACHE_SIZE-1); System.arraycopy(typecache, 1, typecache, 0, CACHE_SIZE-1); loopcache[CACHE_SIZE - 1] = l; typecache[CACHE_SIZE - 1] = type; return l; }
Example #4
Source File: D3DBlitLoops.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public synchronized void Transform(SurfaceData src, SurfaceData dst, Composite comp, Region clip, AffineTransform at, int hint, int srcx, int srcy, int dstx, int dsty, int width, int height){ Blit convertsrc = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, SurfaceType.IntArgbPre); // use cached intermediate surface, if available final SurfaceData cachedSrc = srcTmp != null ? srcTmp.get() : null; // convert source to IntArgbPre src = convertFrom(convertsrc, src, srcx, srcy, width, height, cachedSrc, BufferedImage.TYPE_INT_ARGB_PRE); // transform IntArgbPre intermediate surface to D3D surface performop.Transform(src, dst, comp, clip, at, hint, 0, 0, dstx, dsty, width, height); if (src != cachedSrc) { // cache the intermediate surface srcTmp = new WeakReference<>(src); } }
Example #5
Source File: SurfaceDataProxy.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * This is the default implementation for updating the cached * SurfaceData from the source (primary) SurfaceData. * A simple Blit is used to copy the pixels from the source to * the destination SurfaceData. * A subclass can override this implementation if a more complex * operation is required to update its cached copies. */ public void updateSurfaceData(SurfaceData srcData, SurfaceData dstData, int w, int h) { SurfaceType srcType = srcData.getSurfaceType(); SurfaceType dstType = dstData.getSurfaceType(); Blit blit = Blit.getFromCache(srcType, CompositeType.SrcNoEa, dstType); blit.Blit(srcData, dstData, AlphaComposite.Src, null, 0, 0, 0, 0, w, h); dstData.markDirty(); }
Example #6
Source File: SurfaceDataProxy.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public boolean isSupportedOperation(SurfaceData srcData, int txtype, CompositeType comp, Color bgColor) { return false; }
Example #7
Source File: GDIBlitLoops.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * This constructor sets mask for this primitive which can be * retrieved in native code to set the appropriate values for GDI. */ public GDIBlitLoops(SurfaceType srcType, SurfaceType dstType, int rmask, int gmask, int bmask) { super(srcType, CompositeType.SrcNoEa, dstType); this.rmask = rmask; this.gmask = gmask; this.bmask = bmask; }
Example #8
Source File: SurfaceData.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Return a RenderLoops object containing all of the basic * GraphicsPrimitive objects for rendering to the destination * surface with the current attributes of the given SunGraphics2D. */ public RenderLoops getRenderLoops(SunGraphics2D sg2d) { SurfaceType src = getPaintSurfaceType(sg2d); CompositeType comp = getFillCompositeType(sg2d); SurfaceType dst = sg2d.getSurfaceData().getSurfaceType(); Object o = loopcache.get(src, comp, dst); if (o != null) { return (RenderLoops) o; } RenderLoops loops = makeRenderLoops(src, comp, dst); loopcache.put(src, comp, dst, loops); return loops; }
Example #9
Source File: SurfaceDataProxy.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override public boolean isSupportedOperation(SurfaceData srcData, int txtype, CompositeType comp, Color bgColor) { return false; }
Example #10
Source File: D3DSurfaceDataProxy.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public boolean isSupportedOperation(SurfaceData srcData, int txtype, CompositeType comp, Color bgColor) { return (bgColor == null || transparency == Transparency.OPAQUE); }
Example #11
Source File: SurfaceData.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static CompositeType getFillCompositeType(SunGraphics2D sg2d) { CompositeType compType = sg2d.imageComp; if (sg2d.compositeState == SunGraphics2D.COMP_ISCOPY) { if (compType == CompositeType.SrcOverNoEa) { compType = CompositeType.OpaqueSrcOverNoEa; } else { compType = CompositeType.SrcNoEa; } } return compType; }
Example #12
Source File: Win32GraphicsConfig.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public synchronized RenderLoops getSolidLoops(SurfaceType stype) { if (solidloops == null || sTypeOrig != stype) { solidloops = SurfaceData.makeRenderLoops(SurfaceType.OpaqueColor, CompositeType.SrcNoEa, stype); sTypeOrig = stype; } return solidloops; }
Example #13
Source File: SurfaceDataProxy.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public boolean isSupportedOperation(SurfaceData srcData, int txtype, CompositeType comp, Color bgColor) { return false; }
Example #14
Source File: X11SurfaceDataProxy.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override public boolean isSupportedOperation(SurfaceData srcData, int txtype, CompositeType comp, Color bgColor) { // These could probably be combined into a single // nested if, but the logic is easier to follow this way. // we don't have X11 scale loops, so always use // software surface in case of scaling if (txtype >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { return false; } if (bgColor != null && bgColor.getTransparency() != Transparency.OPAQUE) { return false; } // for transparent images SrcNoEa+bgColor has the // same effect as SrcOverNoEa+bgColor, so we allow // copying from pixmap SD using accelerated blitbg loops: // SrcOver will be changed to SrcNoEa in DrawImage.blitSD if (CompositeType.SrcOverNoEa.equals(comp) || (CompositeType.SrcNoEa.equals(comp) && bgColor != null)) { return true; } return false; }
Example #15
Source File: SunGraphics2D.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Sets the Paint in the current graphics state. * @param paint The Paint object to be used to generate color in * the rendering process. * @see java.awt.Graphics#setColor * @see GradientPaint * @see TexturePaint */ public void setPaint(Paint paint) { if (paint instanceof Color) { setColor((Color) paint); return; } if (paint == null || this.paint == paint) { return; } this.paint = paint; if (imageComp == CompositeType.SrcOverNoEa) { // special case where compState depends on opacity of paint if (paint.getTransparency() == Transparency.OPAQUE) { if (compositeState != COMP_ISCOPY) { compositeState = COMP_ISCOPY; } } else { if (compositeState == COMP_ISCOPY) { compositeState = COMP_ALPHA; } } } Class<? extends Paint> paintClass = paint.getClass(); if (paintClass == GradientPaint.class) { paintState = PAINT_GRADIENT; } else if (paintClass == LinearGradientPaint.class) { paintState = PAINT_LIN_GRADIENT; } else if (paintClass == RadialGradientPaint.class) { paintState = PAINT_RAD_GRADIENT; } else if (paintClass == TexturePaint.class) { paintState = PAINT_TEXTURE; } else { paintState = PAINT_CUSTOM; } validFontInfo = false; invalidatePipe(); }
Example #16
Source File: GDIBlitLoops.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * This constructor sets mask for this primitive which can be * retrieved in native code to set the appropriate values for GDI. */ public GDIBlitLoops(SurfaceType srcType, SurfaceType dstType, int rmask, int gmask, int bmask) { super(srcType, CompositeType.SrcNoEa, dstType); this.rmask = rmask; this.gmask = gmask; this.bmask = bmask; }
Example #17
Source File: X11PMBlitLoops.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public void Blit(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx, int sy, int dx, int dy, int w, int h) { Blit blit = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, dstType); blit.Blit(src, dst, comp, clip, sx, sy, dx, dy, w, h); updateBitmask(src, dst, src.getColorModel() instanceof IndexColorModel); }
Example #18
Source File: SunGraphics2D.java From Bytecoder with Apache License 2.0 | 5 votes |
public void setColor(Color color) { if (color == null || color == paint) { return; } this.paint = foregroundColor = color; validateColor(); if ((eargb >> 24) == -1) { if (paintState == PAINT_OPAQUECOLOR) { return; } paintState = PAINT_OPAQUECOLOR; if (imageComp == CompositeType.SrcOverNoEa) { // special case where compState depends on opacity of paint compositeState = COMP_ISCOPY; } } else { if (paintState == PAINT_ALPHACOLOR) { return; } paintState = PAINT_ALPHACOLOR; if (imageComp == CompositeType.SrcOverNoEa) { // special case where compState depends on opacity of paint compositeState = COMP_ALPHA; } } validFontInfo = false; invalidatePipe(); }
Example #19
Source File: SunCompositeContext.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public SunCompositeContext(AlphaComposite ac, ColorModel s, ColorModel d) { if (s == null) { throw new NullPointerException("Source color model cannot be null"); } if (d == null) { throw new NullPointerException("Destination color model cannot be null"); } srcCM = s; dstCM = d; this.composite = ac; this.comptype = CompositeType.forAlphaComposite(ac); }
Example #20
Source File: SunGraphics2D.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public SunGraphics2D(SurfaceData sd, Color fg, Color bg, Font f) { surfaceData = sd; foregroundColor = fg; backgroundColor = bg; transform = new AffineTransform(); stroke = defaultStroke; composite = defaultComposite; paint = foregroundColor; imageComp = CompositeType.SrcOverNoEa; renderHint = SunHints.INTVAL_RENDER_DEFAULT; antialiasHint = SunHints.INTVAL_ANTIALIAS_OFF; textAntialiasHint = SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT; fractionalMetricsHint = SunHints.INTVAL_FRACTIONALMETRICS_OFF; lcdTextContrast = lcdTextContrastDefaultValue; interpolationHint = -1; strokeHint = SunHints.INTVAL_STROKE_DEFAULT; resolutionVariantHint = SunHints.INTVAL_RESOLUTION_VARIANT_DEFAULT; interpolationType = AffineTransformOp.TYPE_NEAREST_NEIGHBOR; validateColor(); devScale = sd.getDefaultScale(); if (devScale != 1) { transform.setToScale(devScale, devScale); invalidateTransform(); } font = f; if (font == null) { font = defaultFont; } setDevClip(sd.getBounds()); invalidatePipe(); }
Example #21
Source File: SurfaceDataProxy.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * This is the default implementation for updating the cached * SurfaceData from the source (primary) SurfaceData. * A simple Blit is used to copy the pixels from the source to * the destination SurfaceData. * A subclass can override this implementation if a more complex * operation is required to update its cached copies. */ public void updateSurfaceData(SurfaceData srcData, SurfaceData dstData, int w, int h) { SurfaceType srcType = srcData.getSurfaceType(); SurfaceType dstType = dstData.getSurfaceType(); Blit blit = Blit.getFromCache(srcType, CompositeType.SrcNoEa, dstType); blit.Blit(srcData, dstData, AlphaComposite.Src, null, 0, 0, 0, 0, w, h); dstData.markDirty(); }
Example #22
Source File: SurfaceDataProxy.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * This is an alternate implementation for updating the cached * SurfaceData from the source (primary) SurfaceData using a * background color for transparent pixels. * A simple BlitBg is used to copy the pixels from the source to * the destination SurfaceData with the specified bgColor. * A subclass can override the normal updateSurfaceData method * and call this implementation instead if it wants to use color * keying for bitmask images. */ public void updateSurfaceDataBg(SurfaceData srcData, SurfaceData dstData, int w, int h, Color bgColor) { SurfaceType srcType = srcData.getSurfaceType(); SurfaceType dstType = dstData.getSurfaceType(); BlitBg blitbg = BlitBg.getFromCache(srcType, CompositeType.SrcNoEa, dstType); blitbg.BlitBg(srcData, dstData, AlphaComposite.Src, null, bgColor.getRGB(), 0, 0, 0, 0, w, h); dstData.markDirty(); }
Example #23
Source File: SurfaceDataProxy.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * This is an alternate implementation for updating the cached * SurfaceData from the source (primary) SurfaceData using a * background color for transparent pixels. * A simple BlitBg is used to copy the pixels from the source to * the destination SurfaceData with the specified bgColor. * A subclass can override the normal updateSurfaceData method * and call this implementation instead if it wants to use color * keying for bitmask images. */ public void updateSurfaceDataBg(SurfaceData srcData, SurfaceData dstData, int w, int h, Color bgColor) { SurfaceType srcType = srcData.getSurfaceType(); SurfaceType dstType = dstData.getSurfaceType(); BlitBg blitbg = BlitBg.getFromCache(srcType, CompositeType.SrcNoEa, dstType); blitbg.BlitBg(srcData, dstData, AlphaComposite.Src, null, bgColor.getRGB(), 0, 0, 0, 0, w, h); dstData.markDirty(); }
Example #24
Source File: X11SurfaceDataProxy.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public boolean isSupportedOperation(SurfaceData srcData, int txtype, CompositeType comp, Color bgColor) { // These could probably be combined into a single // nested if, but the logic is easier to follow this way. // we don't have X11 scale loops, so always use // software surface in case of scaling if (txtype >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { return false; } if (bgColor != null && bgColor.getTransparency() != Transparency.OPAQUE) { return false; } // for transparent images SrcNoEa+bgColor has the // same effect as SrcOverNoEa+bgColor, so we allow // copying from pixmap SD using accelerated blitbg loops: // SrcOver will be changed to SrcNoEa in DrawImage.blitSD if (CompositeType.SrcOverNoEa.equals(comp) || (CompositeType.SrcNoEa.equals(comp) && bgColor != null)) { return true; } return false; }
Example #25
Source File: SunCompositeContext.java From Bytecoder with Apache License 2.0 | 5 votes |
public SunCompositeContext(XORComposite xc, ColorModel s, ColorModel d) { if (s == null) { throw new NullPointerException("Source color model cannot be null"); } if (d == null) { throw new NullPointerException("Destination color model cannot be null"); } srcCM = s; dstCM = d; this.composite = xc; this.comptype = CompositeType.Xor; }
Example #26
Source File: OGLBlitLoops.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
OGLAnyCompositeBlit(SurfaceType srctype, Blit convertsrc, Blit convertdst, Blit convertresult) { super(srctype, CompositeType.Any, OGLSurfaceData.OpenGLSurface); this.convertsrc = convertsrc; this.convertdst = convertdst; this.convertresult = convertresult; }
Example #27
Source File: SunCompositeContext.java From Bytecoder with Apache License 2.0 | 5 votes |
public SunCompositeContext(AlphaComposite ac, ColorModel s, ColorModel d) { if (s == null) { throw new NullPointerException("Source color model cannot be null"); } if (d == null) { throw new NullPointerException("Destination color model cannot be null"); } srcCM = s; dstCM = d; this.composite = ac; this.comptype = CompositeType.forAlphaComposite(ac); }
Example #28
Source File: SunCompositeContext.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public SunCompositeContext(AlphaComposite ac, ColorModel s, ColorModel d) { if (s == null) { throw new NullPointerException("Source color model cannot be null"); } if (d == null) { throw new NullPointerException("Destination color model cannot be null"); } srcCM = s; dstCM = d; this.composite = ac; this.comptype = CompositeType.forAlphaComposite(ac); }
Example #29
Source File: OGLBlitLoops.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
OGLSwToSurfaceTransform(SurfaceType srcType, int typeval) { super(srcType, CompositeType.AnyAlpha, OGLSurfaceData.OpenGLSurface); this.typeval = typeval; }
Example #30
Source File: X11PMBlitBgLoops.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public X11PMBlitBgLoops(SurfaceType srcType, SurfaceType dstType) { super(srcType, CompositeType.SrcNoEa, dstType); }