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


Java BufferedImage.TYPE_INT_ARGB_PRE属性代码示例

本文整理汇总了Java中java.awt.image.BufferedImage.TYPE_INT_ARGB_PRE属性的典型用法代码示例。如果您正苦于以下问题:Java BufferedImage.TYPE_INT_ARGB_PRE属性的具体用法?Java BufferedImage.TYPE_INT_ARGB_PRE怎么用?Java BufferedImage.TYPE_INT_ARGB_PRE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.awt.image.BufferedImage的用法示例。


在下文中一共展示了BufferedImage.TYPE_INT_ARGB_PRE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getImageTypeName

static String getImageTypeName(int type) {
    switch(type) {
        case BufferedImage.TYPE_INT_ARGB:
            return "TYPE_INT_ARGB";
        case BufferedImage.TYPE_INT_RGB:
            return "TYPE_INT_RGB";
        case BufferedImage.TYPE_INT_BGR:
            return "TYPE_INT_BGR";
        case BufferedImage.TYPE_INT_ARGB_PRE:
            return "TYPE_INT_ARGB_PRE";
        case BufferedImage.TYPE_3BYTE_BGR:
            return "TYPE_3BYTE_BGR";
        case BufferedImage.TYPE_4BYTE_ABGR:
            return "TYPE_4BYTE_ABGR";
        case BufferedImage.TYPE_4BYTE_ABGR_PRE:
            return "TYPE_4BYTE_ABGR_PRE";
        case BufferedImage.TYPE_BYTE_BINARY:
            return "TYPE_BYTE_BINARY";
        case BufferedImage.TYPE_BYTE_GRAY:
            return "TYPE_BYTE_GRAY";
        case BufferedImage.TYPE_BYTE_INDEXED:
            return "TYPE_BYTE_INDEXED";
        case BufferedImage.TYPE_USHORT_555_RGB:
            return "TYPE_USHORT_555_RGB";
        case BufferedImage.TYPE_USHORT_565_RGB:
            return "TYPE_USHORT_565_RGB";
        case BufferedImage.TYPE_USHORT_GRAY:
            return "TYPE_USHORT_GRAY";
    }
    return "UNKNOWN";
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:ColConvTest.java

示例2: updateIcon

void updateIcon() {
    int width = fFrame.getWidth();
    int height = fFrame.getHeight();

    // Protect us from unsized frames, like in JCK test DefaultDesktopManager2008
    if (width <= 0 || height <= 0) {
        width = 128;
        height = 128;
    }

    final Image fImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB_PRE);
    final Graphics g = fImage.getGraphics();
    fFrame.paint(g);
    g.dispose();

    final float scale = (float)fDesktopIcon.getWidth() / (float)Math.max(width, height) * 0.89f;
    // Sending in -1 for width xor height causes it to maintain aspect ratio
    setIcon(new ImageIcon(fImage.getScaledInstance((int)(width * scale), -1, Image.SCALE_SMOOTH)));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:AquaInternalFrameDockIconUI.java

示例3: imageToArray

private static int[] imageToArray(Image image) {
    if (image == null) {
        return null;
    }

    int w = image.getWidth(null);
    int h = image.getHeight(null);

    if (w < 0 || h < 0) {
        return null;
    }

    BufferedImage bimg = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE);
    Graphics2D g2 = bimg.createGraphics();
    g2.setComposite(AlphaComposite.Src);
    g2.drawImage(image, 0, 0, null);
    g2.dispose();

    return ((DataBufferInt) bimg.getRaster().getDataBuffer()).getData();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:WTaskbarPeer.java

示例4: createBufferedImage

void createBufferedImage() {
    // REMIND:  Be careful!  Is this called everytime there is a
    // startProduction?  We only want to call it if it is new or
    // there is an error
    isDefaultBI = false;
    try {
        biRaster = cmodel.createCompatibleWritableRaster(width, height);
        bimage = createImage(cmodel, biRaster,
                             cmodel.isAlphaPremultiplied(), null);
    } catch (Exception e) {
        // Create a default image
        cmodel = ColorModel.getRGBdefault();
        biRaster = cmodel.createCompatibleWritableRaster(width, height);
        bimage = createImage(cmodel, biRaster, false, null);
    }
    int type = bimage.getType();

    if ((cmodel == ColorModel.getRGBdefault()) ||
           (type == BufferedImage.TYPE_INT_RGB) ||
           (type == BufferedImage.TYPE_INT_ARGB_PRE)) {
        isDefaultBI = true;
    }
    else if (cmodel instanceof DirectColorModel) {
        DirectColorModel dcm = (DirectColorModel) cmodel;
        if (dcm.getRedMask() == 0xff0000 &&
            dcm.getGreenMask() == 0xff00 &&
            dcm.getBlueMask()  == 0xff) {
            isDefaultBI = true;
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:31,代码来源:ImageRepresentation.java

示例5: loadInstance

private static ByteBuffer loadInstance(BufferedImage image, int dimension) {
    BufferedImage scaledIcon = new BufferedImage(dimension, dimension, BufferedImage.TYPE_INT_ARGB_PRE);
    Graphics2D g = scaledIcon.createGraphics();
    double ratio = getIconRatio(image, scaledIcon);
    double width = image.getWidth() * ratio;
    double height = image.getHeight() * ratio;
    g.drawImage(image, (int) ((scaledIcon.getWidth() - width) / 2), (int) ((scaledIcon.getHeight() - height) / 2),
            (int) (width), (int) (height), null);
    g.dispose();

    return convertToByteBuffer(scaledIcon);
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:12,代码来源:IconLoader.java

示例6: createBufferedImage

/** 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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:ImageUtilities.java

示例7: createImage

private BufferedImage createImage() {
    BufferedImage img = new BufferedImage (bounds.width, bounds.height,
        BufferedImage.TYPE_INT_ARGB_PRE);
    chiclet.setNotch(rightNotch, leftNotch);
    chiclet.setArcs (arcs[0], arcs[1], arcs[2], arcs[3]);
    chiclet.setBounds (bounds.x, bounds.y, bounds.width, bounds.height);
    chiclet.setAllowVertical(allowVertical);
    chiclet.setState (state);
    Graphics g = img.getGraphics();
    g.translate (-bounds.x, -bounds.y);
    ColorUtil.setupAntialiasing(g);
    chiclet.draw((Graphics2D)g);
    g.translate (bounds.x, bounds.y);
    return img;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:ChicletWrapper.java

示例8: createBufferedImage

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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:UINodeTest.java

示例9: complexClipBlit

private synchronized void complexClipBlit(SurfaceData src, SurfaceData dst,
                                          Composite comp, Region clip,
                                          int sx, int sy, int dx, int dy,
                                          int w, int h) {
    SurfaceData cachedSrc = null;
    if (srcTmp != null) {
        // use cached intermediate surface, if available
        cachedSrc = srcTmp.get();
    }

    // We can convert argb_pre data from OpenGL surface in two places:
    // - During OpenGL surface -> SW blit
    // - During SW -> SW blit
    // The first one is faster when we use opaque OGL surface, because in
    // this case we simply skip conversion and use color components as is.
    // Because of this we align intermediate buffer type with type of
    // destination not source.
    final int type = typeval == OGLSurfaceData.PF_INT_ARGB_PRE ?
                     BufferedImage.TYPE_INT_ARGB_PRE :
                     BufferedImage.TYPE_INT_ARGB;

    src = convertFrom(this, src, sx, sy, w, h, cachedSrc, type);

    // copy intermediate SW to destination SW using complex clip
    final Blit performop = Blit.getFromCache(src.getSurfaceType(),
                                             CompositeType.SrcNoEa,
                                             dst.getSurfaceType());
    performop.Blit(src, dst, comp, clip, 0, 0, dx, dy, w, h);

    if (src != cachedSrc) {
        // cache the intermediate surface
        srcTmp = new WeakReference<>(src);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:34,代码来源:OGLBlitLoops.java

示例10: loadInstance

private static ByteBuffer loadInstance(BufferedImage image, int dimension) {
	BufferedImage scaledIcon = new BufferedImage(dimension, dimension, BufferedImage.TYPE_INT_ARGB_PRE);
	Graphics2D g = scaledIcon.createGraphics();
	double ratio = getIconRatio(image, scaledIcon);
	double width = image.getWidth() * ratio;
	double height = image.getHeight() * ratio;
	g.drawImage(image, (int) ((scaledIcon.getWidth() - width) / 2), (int) ((scaledIcon.getHeight() - height) / 2),
			(int) (width), (int) (height), null);
	g.dispose();

	return convertToByteBuffer(scaledIcon);
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:12,代码来源:IconLoader.java

示例11: resizeBuffer

private void resizeBuffer(int width, int height, int newScaleFactor) {
        bbImage = new BufferedImage(width*newScaleFactor,height*newScaleFactor,
                                    BufferedImage.TYPE_INT_ARGB_PRE);
    int[] pixels= ((DataBufferInt)bbImage.getRaster().getDataBuffer()).getData();
    if (copyBufferEnabled) {
        syncCopyBuffer(true, 0, 0, width, height, newScaleFactor);
        pixels = copyBuffer;
    }
    content.imageBufferReset(pixels, 0, 0, width, height,
                             width * newScaleFactor, newScaleFactor);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:JLightweightFrame.java

示例12: createFirstPassGraphics

private PeekGraphics createFirstPassGraphics(PrinterJob printerJob, PageFormat page) {
    // This is called from the native side.
    BufferedImage bimg = new BufferedImage((int)Math.round(page.getWidth()), (int)Math.round(page.getHeight()), BufferedImage.TYPE_INT_ARGB_PRE);
    PeekGraphics peekGraphics = createPeekGraphics(bimg.createGraphics(), printerJob);
    Rectangle2D pageFormatArea = getPageFormatArea(page);
    initPrinterGraphics(peekGraphics, pageFormatArea);
    return peekGraphics;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:CPrinterJob.java

示例13: getImageForIcon

public static Image getImageForIcon(final Icon i) {
    if (i instanceof ImageIcon) return ((ImageIcon)i).getImage();

    final int w = i.getIconWidth();
    final int h = i.getIconHeight();

    if (w <= 0 || h <= 0) return null;

    // This could be any kind of icon, so we need to make a buffer for it, draw it and then pass the new image off to appkit.
    final BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE);
    final Graphics g = image.getGraphics();
    i.paintIcon(null, g, 0, 0);
    g.dispose();
    return image;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:AquaIcon.java

示例14: init

public static void init() {
    destroot = new Group.EnableSet(TestEnvironment.globaloptroot,
                                   "dest", "Output Destination Options");

    new Screen();
    new OffScreen();

    if (GraphicsTests.hasGraphics2D) {
        if (ImageTests.hasCompatImage) {
            compatimgdestroot =
                new Group.EnableSet(destroot, "compatimg",
                                    "Compatible Image Destinations");
            compatimgdestroot.setHorizontal();

            new CompatImg();
            new CompatImg(Transparency.OPAQUE);
            new CompatImg(Transparency.BITMASK);
            new CompatImg(Transparency.TRANSLUCENT);
        }

        if (ImageTests.hasVolatileImage) {
            new VolatileImg();
        }

        bufimgdestroot = new Group.EnableSet(destroot, "bufimg",
                                             "BufferedImage Destinations");

        new BufImg(BufferedImage.TYPE_INT_RGB);
        new BufImg(BufferedImage.TYPE_INT_ARGB);
        new BufImg(BufferedImage.TYPE_INT_ARGB_PRE);
        new BufImg(BufferedImage.TYPE_3BYTE_BGR);
        new BufImg(BufferedImage.TYPE_BYTE_INDEXED);
        new BufImg(BufferedImage.TYPE_BYTE_GRAY);
        new CustomImg();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:Destinations.java

示例15: updateIcon

void updateIcon() {
    final Object priorIcon = fFrame.getClientProperty(CACHED_FRAME_ICON_KEY);
    if (priorIcon instanceof ImageIcon) {
        setIcon((ImageIcon)priorIcon);
        return;
    }

    int width = fFrame.getWidth();
    int height = fFrame.getHeight();

    // Protect us from unsized frames, like in JCK test DefaultDesktopManager2008
    if (width <= 0 || height <= 0) {
        width = 128;
        height = 128;
    }

    final Image fImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB_PRE);
    final Graphics g = fImage.getGraphics();
    fFrame.paint(g);
    g.dispose();

    final float scale = (float)fDesktopIcon.getWidth() / (float)Math.max(width, height) * 0.89f;
    // Sending in -1 for width xor height causes it to maintain aspect ratio
    final ImageIcon icon = new ImageIcon(fImage.getScaledInstance((int)(width * scale), -1, Image.SCALE_SMOOTH));
    fFrame.putClientProperty(CACHED_FRAME_ICON_KEY, icon);
    setIcon(icon);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:AquaInternalFrameDockIconUI.java


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