微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java.awt.Transparency的实例源码

项目:openjdk-jdk10    文件TIFFDecompressor.java   
/**
 * Create a {@code ComponentColorModel} for use in creating
 * an {@code Imagetypespecifier}.
 */
// This code was inspired by the method of the same name in
// javax.imageio.Imagetypespecifier
static ColorModel createComponentCM(ColorSpace colorSpace,int numBands,int[] bitsPerSample,int dataType,boolean hasAlpha,boolean isAlphaPremultiplied) {
    int transparency =
        hasAlpha ? Transparency.TRANSLUCENT : Transparency.OPAQUE;

    return new ComponentColorModel(colorSpace,bitsPerSample,hasAlpha,isAlphaPremultiplied,transparency,dataType);
}
项目:jdk8u-jdk    文件D3DVolatileSurfaceManager.java   
public D3DVolatileSurfaceManager(SunVolatileImage vImg,Object context) {
    super(vImg,context);

    /*
     * We will attempt to accelerate this image only under the
     * following conditions:
     *   - the image is opaque OR
     *   - the image is translucent AND
     *       - the GraphicsConfig supports the FBO extension OR
     *       - the GraphicsConfig has a stored alpha channel
     */
    int transparency = vImg.getTransparency();
    D3DGraphicsDevice gd = (D3DGraphicsDevice)
        vImg.getGraphicsConfig().getDevice();
    accelerationEnabled =
        (transparency == Transparency.OPAQUE) ||
        (transparency == Transparency.TRANSLUCENT &&
         (gd.isCapPresent(CAPS_RT_PLAIN_ALPHA) ||
          gd.isCapPresent(CAPS_RT_TEXTURE_ALPHA)));
}
项目:jdk8u-jdk    文件D3DSurfaceData.java   
private boolean initSurfaceNow() {
    boolean isOpaque = (getTransparency() == Transparency.OPAQUE);
    switch (type) {
        case RT_PLAIN:
            return initRTSurface(getNativeOps(),isOpaque);
        case TEXTURE:
            return initTexture(getNativeOps(),false/*isRTT*/,isOpaque);
        case RT_TEXTURE:
            return initTexture(getNativeOps(),true/*isRTT*/,isOpaque);
        // REMIND: we may want to pass the exact type to the native
        // level here so that we Could choose the right presentation
        // interval for the frontbuffer (immediate vs v-synced)
        case WINDOW:
        case FLIP_BACKBUFFER:
            return initFlipBackbuffer(getNativeOps(),peer.getData(),backBuffersNum,swapEffect,syncType.id());
        default:
            return false;
    }
}
项目:openjdk-jdk10    文件D3DSurfaceData.java   
private boolean initSurfaceNow() {
    boolean isOpaque = (getTransparency() == Transparency.OPAQUE);
    switch (type) {
        case RT_PLAIN:
            return initRTSurface(getNativeOps(),syncType.id());
        default:
            return false;
    }
}
项目:jdk8u-jdk    文件SourceClippingBlitTest.java   
static void initimage(GraphicsConfiguration gc,Image image) {
    Graphics g = image.getGraphics();
    g.setColor(Color.RED);
    int w = image.getWidth(null);
    int h = image.getHeight(null);
    g.fillRect(0,w,h);
    g.dispose();

    // need to 'accelerate' the image
    if (dstimage == null) {
        dstimage =
            gc.createCompatibleVolatileImage(TESTW,TESTH,Transparency.OPAQUE);
    }
    dstimage.validate(gc);
    g = dstimage.getGraphics();
    g.drawImage(image,null);
    g.drawImage(image,null);
}
项目:jdk8u-jdk    文件D3DGraphicsConfig.java   
@Override
public ColorModel getColorModel(int transparency) {
    switch (transparency) {
    case Transparency.OPAQUE:
        // REMIND: once the ColorModel spec is changed,this should be
        //         an opaque premultiplied DCM...
        return new DirectColorModel(24,0xff0000,0xff00,0xff);
    case Transparency.BITMASK:
        return new DirectColorModel(25,0xff,0x1000000);
    case Transparency.TRANSLUCENT:
        ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
        return new DirectColorModel(cs,32,0xff000000,true,DataBuffer.TYPE_INT);
    default:
        return null;
    }
}
项目:jdk8u-jdk    文件X11VolatileSurfaceManager.java   
public X11VolatileSurfaceManager(SunVolatileImage vImg,context);

    // We only accelerated opaque vImages currently
    accelerationEnabled = X11SurfaceData.isaccelerationEnabled() &&
        (vImg.getTransparency() == Transparency.OPAQUE);

    if ((context != null) && !accelerationEnabled) {
        // if we're wrapping a backbuffer drawable,we must ensure that
        // the accelerated surface is initialized up front,regardless
        // of whether acceleration is enabled. But we need to set
        // the  accelerationEnabled field to true to reflect that this
        // SM is actually accelerated.
        accelerationEnabled = true;
        sdAccel = initacceleratedSurface();
        sdCurrent = sdAccel;

        if (sdBackup != null) {
            // release the system memory backup surface,as we won't be
            // needing it in this case
            sdBackup = null;
        }
    }
}
项目:Openjsharp    文件DrawImage.java   
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;
}
项目:jdk8u-jdk    文件D3DRenderer.java   
void copyArea(SunGraphics2D sg2d,int x,int y,int w,int h,int dx,int dy)
{
    rq.lock();
    try {
        int ctxflags =
            sg2d.surfaceData.getTransparency() == Transparency.OPAQUE ?
                D3DContext.SRC_IS_OPAQUE : D3DContext.NO_CONTEXT_FLAGS;
        D3DSurfaceData dstData;
        try {
            dstData = (D3DSurfaceData)sg2d.surfaceData;
        } catch (ClassCastException e) {
            throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
        }
        D3DContext.validateContext(dstData,sg2d.getCompClip(),sg2d.composite,null,ctxflags);

        rq.ensureCapacity(28);
        buf.putInt(copY_AREA);
        buf.putInt(x).putInt(y).putInt(w).putInt(h);
        buf.putInt(dx).putInt(dy);
    } finally {
        rq.unlock();
    }
}
项目:openjdk-jdk10    文件ComponentColorModelEqualsTest.java   
private static void testConstructor2() {
    /*
     * verify equality with constructor
     * ComponentColorModel(ColorSpace colorSpace,*                  boolean hasAlpha,*                  boolean isAlphaPremultiplied,*                  int transparency,*                  int transferType)
     */
    ComponentColorModel model1 =
        new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),false,Transparency.OPAQUE,DataBuffer.TYPE_BYTE);
    ComponentColorModel model2 =
        new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),DataBuffer.TYPE_BYTE);
    verifyEquals(model1,model2);
}
项目:Openjsharp    文件Oglrenderer.java   
void copyArea(SunGraphics2D sg2d,int dy)
{
    rq.lock();
    try {
        int ctxflags =
            sg2d.surfaceData.getTransparency() == Transparency.OPAQUE ?
                OGLContext.SRC_IS_OPAQUE : OGLContext.NO_CONTEXT_FLAGS;
        OGLSurfaceData dstData;
        try {
            dstData = (OGLSurfaceData)sg2d.surfaceData;
        } catch (ClassCastException e) {
            throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
        }
        OGLContext.validateContext(dstData,ctxflags);

        rq.ensureCapacity(28);
        buf.putInt(copY_AREA);
        buf.putInt(x).putInt(y).putInt(w).putInt(h);
        buf.putInt(dx).putInt(dy);
    } finally {
        rq.unlock();
    }
}
项目:jdk8u-jdk    文件CGLGraphicsConfig.java   
@Override
public ColorModel getColorModel(int transparency) {
    switch (transparency) {
    case Transparency.OPAQUE:
        // REMIND: once the ColorModel spec is changed,DataBuffer.TYPE_INT);
    default:
        return null;
    }
}
项目:openjdk-jdk10    文件ComponentColorModelEqualsTest.java   
private static void testConstructor1() {
    /*
     * verify equality with constructor
     * ComponentColorModel(ColorSpace colorSpace,*                  int[] bits,new int[] {8,8,8},model2);
}
项目:Openjsharp    文件CGLVolatileSurfaceManager.java   
public CGLVolatileSurfaceManager(SunVolatileImage vImg,context);

    /*
     * We will attempt to accelerate this image only under the
     * following conditions:
     *   - the image is opaque OR
     *   - the image is translucent AND
     *       - the GraphicsConfig supports the FBO extension OR
     *       - the GraphicsConfig has a stored alpha channel
     */
    int transparency = vImg.getTransparency();
    CGLGraphicsConfig gc = (CGLGraphicsConfig)vImg.getGraphicsConfig();
    accelerationEnabled =
        (transparency == Transparency.OPAQUE) ||
        ((transparency == Transparency.TRANSLUCENT) &&
         (gc.isCapPresent(CAPS_EXT_FBOBJECT) ||
          gc.isCapPresent(CAPS_STORED_ALPHA)));
}
项目:Openjsharp    文件WGLVolatileSurfaceManager.java   
public WGLVolatileSurfaceManager(SunVolatileImage vImg,context);

    /*
     * We will attempt to accelerate this image only under the
     * following conditions:
     *   - the image is opaque OR
     *   - the image is translucent AND
     *       - the GraphicsConfig supports the FBO extension OR
     *       - the GraphicsConfig has a stored alpha channel
     */
    int transparency = vImg.getTransparency();
    WGLGraphicsConfig gc = (WGLGraphicsConfig)vImg.getGraphicsConfig();
    accelerationEnabled =
        (transparency == Transparency.OPAQUE) ||
        ((transparency == Transparency.TRANSLUCENT) &&
         (gc.isCapPresent(CAPS_EXT_FBOBJECT) ||
          gc.isCapPresent(CAPS_STORED_ALPHA)));
}
项目:Openjsharp    文件GLXGraphicsConfig.java   
@Override
public ColorModel getColorModel(int transparency) {
    switch (transparency) {
    case Transparency.OPAQUE:
        // REMIND: once the ColorModel spec is changed,DataBuffer.TYPE_INT);
    default:
        return null;
    }
}
项目:jdk8u-jdk    文件CGLVolatileSurfaceManager.java   
public CGLVolatileSurfaceManager(SunVolatileImage vImg,context);

    /*
     * We will attempt to accelerate this image only under the
     * following conditions:
     *   - the image is opaque OR
     *   - the image is translucent AND
     *       - the GraphicsConfig supports the FBO extension OR
     *       - the GraphicsConfig has a stored alpha channel
     */
    int transparency = vImg.getTransparency();
    CGLGraphicsConfig gc = (CGLGraphicsConfig)vImg.getGraphicsConfig();
    accelerationEnabled =
        (transparency == Transparency.OPAQUE) ||
        ((transparency == Transparency.TRANSLUCENT) &&
         (gc.isCapPresent(CAPS_EXT_FBOBJECT) ||
          gc.isCapPresent(CAPS_STORED_ALPHA)));
}
项目:Openjsharp    文件GLXVolatileSurfaceManager.java   
public GLXVolatileSurfaceManager(SunVolatileImage vImg,context);

    /*
     * We will attempt to accelerate this image only under the
     * following conditions:
     *   - the image is opaque OR
     *   - the image is translucent AND
     *       - the GraphicsConfig supports the FBO extension OR
     *       - the GraphicsConfig has a stored alpha channel
     */
    int transparency = vImg.getTransparency();
    GLXGraphicsConfig gc = (GLXGraphicsConfig)vImg.getGraphicsConfig();
    accelerationEnabled =
        (transparency == Transparency.OPAQUE) ||
        ((transparency == Transparency.TRANSLUCENT) &&
         (gc.isCapPresent(CAPS_EXT_FBOBJECT) ||
          gc.isCapPresent(CAPS_STORED_ALPHA)));
}
项目:jdk8u-jdk    文件WGLGraphicsConfig.java   
@Override
public ColorModel getColorModel(int transparency) {
    switch (transparency) {
    case Transparency.OPAQUE:
        // REMIND: once the ColorModel spec is changed,DataBuffer.TYPE_INT);
    default:
        return null;
    }
}
项目:DicomViewer    文件OpenCLWithJOCL.java   
BufferedImage createFloatBufferedImage(int w,int bands) {
    // Define dimensions and layout of the image
    //int bands = 4; // 4 bands for ARGB,3 for RGB etc
    int[] bandOffsets = {0,1,2,3}; // length == bands,0 == R,1 == G,2 == B and 3 == A

    // Create a TYPE_FLOAT sample model (specifying how the pixels are stored)
    SampleModel sampleModel = new PixelInterleavedSampleModel(DataBuffer.TYPE_FLOAT,h,bands,w  * bands,bandOffsets);
    // ...and data buffer (where the pixels are stored)
    DataBuffer buffer = new DataBufferFloat(w * h * bands);

    // Wrap it in a writable raster
    WritableRaster raster = Raster.createWritableRaster(sampleModel,buffer,null);

    // Create a color model compatible with this sample model/raster (TYPE_FLOAT)
    // Note that the number of bands must equal the number of color components in the 
    // color space (3 for RGB) + 1 extra band if the color model contains alpha 
    ColorSpace colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    ColorModel colorModel = new ComponentColorModel(colorSpace,Transparency.TRANSLUCENT,DataBuffer.TYPE_FLOAT);

    // And finally create an image with this raster
    return new BufferedImage(colorModel,raster,colorModel.isAlphaPremultiplied(),null);
}
项目:JuggleMasterPro    文件ColorChooserDropDownJButton.java   
@Override final public void paintComponent(Graphics objPgraphics) {

        // Draw a colored rectangle in place of the button :
        final BufferedImage imgLbuffer =
                                            Constants.objS_GRAPHICS_CONfigURATION.createCompatibleImage(ColorChooserDropDownJButton.intS_SIZE,ColorChooserDropDownJButton.intS_SIZE,Transparency.OPAQUE);
        final Graphics2D objLgraphics2D = (Graphics2D) imgLbuffer.getGraphics();
        final Color objLcolor = this.getGammaColor();
        objLgraphics2D.setColor(objLcolor);
        objLgraphics2D.fillRect(1,ColorChooserDropDownJButton.intS_SIZE - 2,ColorChooserDropDownJButton.intS_SIZE - 2);
        if (this.isEnabled()) {
            final Image imgL =
                                Tools.isLightColor(objLcolor) ? (this.objGjWindow.isVisible() ? this.imgGupB : this.imgGdownB)
                                                                : (this.objGjWindow.isVisible() ? this.imgGupW : this.imgGdownW);
            if (imgL != null) {
                objLgraphics2D.drawImage(imgL,null);
            }
        }
        objLgraphics2D.setColor(this.isEnabled() ? Color.DARK_GRAY : Color.LIGHT_GRAY);
        objLgraphics2D.drawRect(0,ColorChooserDropDownJButton.intS_SIZE);
        objLgraphics2D.dispose();
        objPgraphics.drawImage(imgLbuffer,null);
    }
项目:openjdk-jdk10    文件Win32GraphicsConfig.java   
/**
 * Returns the color model associated with this configuration that
 * supports the specified transparency.
 */
public ColorModel getColorModel(int transparency) {
    switch (transparency) {
    case Transparency.OPAQUE:
        return getColorModel();
    case Transparency.BITMASK:
        return new DirectColorModel(25,0x1000000);
    case Transparency.TRANSLUCENT:
        return ColorModel.getRGBdefault();
    default:
        return null;
    }
}
项目:incubator-netbeans    文件ImageUtilities.java   
/** Creates BufferedImage with Transparency.TRANSLUCENT */
static final java.awt.image.BufferedImage createBufferedImage(int width,int height) {
    if (Utilities.isMac()) {
        return new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB_PRE);
    }

    ColorModel model = colorModel(java.awt.Transparency.TRANSLUCENT);
    java.awt.image.BufferedImage buffImage = new java.awt.image.BufferedImage(
            model,model.createCompatibleWritableRaster(width,height),model.isAlphaPremultiplied(),null
        );

    return buffImage;
}
项目:incubator-netbeans    文件ComboTest.java   
/** Creates BufferedImage 16x16 and Transparency.BITMASK */
private static final BufferedImage createBufferedImage(int width,int height) {
    ColorModel model = GraphicsEnvironment.getLocalGraphicsEnvironment().
            getDefaultScreenDevice().getDefaultConfiguration().getColorModel(Transparency.BITMASK);
    BufferedImage buffImage = new BufferedImage(model,null);
    return buffImage;
}
项目:incubator-netbeans    文件EditabledisplayerTest.java   
/** Creates BufferedImage 16x16 and Transparency.BITMASK */
private static final BufferedImage createBufferedImage(int width,null);
    return buffImage;
}
项目:openjdk-jdk10    文件X11SurfaceDataProxy.java   
@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;
}
项目:jdk8u-jdk    文件DrawImage.java   
protected static boolean isBgOperation(SurfaceData srcData,Color bgColor) {
    // If we cannot get the srcData,then cannot assume anything about
    // the image
    return ((srcData == null) ||
            ((bgColor != null) &&
             (srcData.getTransparency() != Transparency.OPAQUE)));
}
项目:BrainControl    文件BgRenderer.java   
public BgRenderer(Level level,GraphicsConfiguration graphicsConfiguration,int width,int height,int distance) {
    this.distance = distance;
    this.width = width;
    this.height = height;

    this.level = level;
    image = graphicsConfiguration.createCompatibleImage(width,Transparency.TRANSLUCENT);
    g = (Graphics2D) image.getGraphics();
    g.setComposite(AlphaComposite.Src);

    updateArea(0,width,height);
}
项目:openjdk-jdk10    文件D3DGraphicsConfig.java   
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width,int transparency,int type)
{
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }
    boolean isOpaque = transparency == Transparency.OPAQUE;
    if (type == RT_TEXTURE) {
        int cap = isOpaque ? CAPS_RT_TEXTURE_OPAQUE : CAPS_RT_TEXTURE_ALPHA;
        if (!device.isCapPresent(cap)) {
            return null;
        }
    } else if (type == RT_PLAIN) {
        if (!isOpaque && !device.isCapPresent(CAPS_RT_PLAIN_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this,type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
项目:opentest    文件ImageUtil.java   
public static BufferedImage cloneImageRegion(BufferedImage srcImg,int height) {
    int imgType = (srcImg.getTransparency() == Transparency.OPAQUE)
            ? BufferedImage.TYPE_INT_RGB
            : BufferedImage.TYPE_INT_ARGB;
    BufferedImage newImage = new BufferedImage(width,imgType);
    Graphics2D g2 = newImage.createGraphics();
    g2.drawImage(srcImg.getSubimage(x,y,null);
    g2.dispose();

    return newImage;
}
项目:jdk8u-jdk    文件BMPsubsamplingTest.java   
private BufferedImage create3ByteImage(int[] nBits,int[] bOffs) {
    ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    ColorModel colorModel =
        new ComponentColorModel(cs,nBits,DataBuffer.TYPE_BYTE);
    WritableRaster raster =
        Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,w*3,3,bOffs,null);
    return new BufferedImage(colorModel,null);
}
项目:openjdk-jdk10    文件GLXGraphicsConfig.java   
/**
 * Creates a new hidden-acceleration image of the given width and height
 * that is associated with the target Component.
 */
@Override
public Image createAcceleratedImage(Component target,int height)
{
    ColorModel model = getColorModel(Transparency.OPAQUE);
    WritableRaster wr =
        model.createCompatibleWritableRaster(width,height);
    return new OffScreenImage(target,model,wr,model.isAlphaPremultiplied());
}
项目:openjdk-jdk10    文件RenderToCustomBufferTest.java   
private static BufferedImage createCustomBuffer() {
    ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    ColorModel cm = new ComponentColorModel(cs,DataBuffer.TYPE_FLOAT);
    WritableRaster wr = cm.createCompatibleWritableRaster(width,height);

    return new BufferedImage(cm,null);
}
项目:openjdk-jdk10    文件SunVolatileImage.java   
private SunVolatileImage(Component comp,GraphicsConfiguration graphicsConfig,Object context,ImageCapabilities caps)
{
    this(comp,graphicsConfig,context,caps,UNDEFINED);
}
项目:jdk8u-jdk    文件Win32GraphicsConfig.java   
/**
 * Returns the color model associated with this configuration that
 * supports the specified transparency.
 */
public ColorModel getColorModel(int transparency) {
    switch (transparency) {
    case Transparency.OPAQUE:
        return getColorModel();
    case Transparency.BITMASK:
        return new DirectColorModel(25,0x1000000);
    case Transparency.TRANSLUCENT:
        return ColorModel.getRGBdefault();
    default:
        return null;
    }
}
项目:openjdk-jdk10    文件X11GraphicsConfig.java   
public static ComponentColorModel createABGRCCM() {
    ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    int[] nBits = {8,8};
    int[] bOffs = {3,0};
    return new ComponentColorModel(cs,DataBuffer.TYPE_BYTE);
}
项目:jdk8u-jdk    文件ColCvtAlpha.java   
public static void main(String args[]) {
    BufferedImage src
        = new BufferedImage(1,10,BufferedImage.TYPE_INT_ARGB);

    // Set src pixel values
    Color pelColor = new Color(100,100,128);
    for (int i = 0; i < 10; i++) {
        src.setRGB(0,i,pelColor.getRGB());
    }

    ColorModel cm = new ComponentColorModel
        (ColorSpace.getInstance(ColorSpace.CS_GRAY),new int [] {8,src.getColorModel().isAlphaPremultiplied(),DataBuffer.TYPE_BYTE);

    SampleModel sm = new PixelInterleavedSampleModel
        (DataBuffer.TYPE_BYTE,200,new int [] { 0,1 });

    WritableRaster wr = Raster.createWritableRaster(sm,new Point(0,0));

    BufferedImage dst =
        new BufferedImage(cm,cm.isAlphaPremultiplied(),null);
    dst = dst.getSubimage(0,10);

    ColorConvertOp op = new ColorConvertOp(null);

    op.filter(src,dst);

    for (int i = 0; i < 10; i++) {
        if (((dst.getRGB(0,i) >> 24) & 0xff) != 128) {
            throw new RuntimeException(
                "Incorrect destination alpha value.");
        }
    }

}
项目:Openjsharp    文件SunGraphics2D.java   
/**
 * 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();
}
项目:jdk8u-jdk    文件ImageTests.java   
public TriStateImageType(Group parent,String nodename,String desc,int transparency)
{
    super(parent,nodename,desc);
    setHorizontal();
    new DrawableImage(this,true);
    new DrawableImage(this,Transparency.BITMASK,(transparency != Transparency.OPAQUE));
    new DrawableImage(this,(transparency == Transparency.TRANSLUCENT));
}
项目:jdk8u-jdk    文件D3DGraphicsConfig.java   
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width,type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。