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


Java ImageRepresentation.reconstruct方法代码示例

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


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

示例1: IconInfo

import sun.awt.image.ImageRepresentation; //导入方法依赖的package包/类
public IconInfo(Image image) {
    this.image = image;
    if (image instanceof ToolkitImage) {
        ImageRepresentation ir = ((ToolkitImage)image).getImageRep();
        ir.reconstruct(ImageObserver.ALLBITS);
        this.width = ir.getWidth();
        this.height = ir.getHeight();
    } else {
        this.width = image.getWidth(null);
        this.height = image.getHeight(null);
    }
    this.scaledWidth = width;
    this.scaledHeight = height;
    this.rawLength = width * height + 2;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:IconInfo.java

示例2: IconInfo

import sun.awt.image.ImageRepresentation; //导入方法依赖的package包/类
public IconInfo(Image image) {
    this.image = image;
    if (image instanceof ToolkitImage) {
        ImageRepresentation ir = ((ToolkitImage)image).getImageRep();
        ir.reconstruct(ImageObserver.ALLBITS);
        this.width = ir.getWidth();
        this.height = ir.getHeight();
    } else {
        this.width = image.getWidth(null);
        this.height = image.getHeight(null);
    }
    this.scaledWidth = width;
    this.scaledHeight = height;
    this.rawLength = getScaledRawLength(width, height);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:IconInfo.java

示例3: XIconInfo

import sun.awt.image.ImageRepresentation; //导入方法依赖的package包/类
XIconInfo(Image image) {
    this.image = image;
    if (image instanceof ToolkitImage) {
        ImageRepresentation ir = ((ToolkitImage)image).getImageRep();
        ir.reconstruct(ImageObserver.ALLBITS);
        this.width = ir.getWidth();
        this.height = ir.getHeight();
    } else {
        this.width = image.getWidth(null);
        this.height = image.getHeight(null);
    }
    this.scaledWidth = width;
    this.scaledHeight = height;
    this.rawLength = width * height + 2;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:16,代码来源:XIconInfo.java

示例4: imageToPlatformBytes

import sun.awt.image.ImageRepresentation; //导入方法依赖的package包/类
@Override
protected byte[] imageToPlatformBytes(Image image, long format)
        throws IOException {
    String mimeType = null;
    if (format == CF_PNG) {
        mimeType = "image/png";
    } else if (format == CF_JFIF) {
        mimeType = "image/jpeg";
    }
    if (mimeType != null) {
        return imageToStandardBytes(image, mimeType);
    }

    int width = 0;
    int height = 0;

    if (image instanceof ToolkitImage) {
        ImageRepresentation ir = ((ToolkitImage)image).getImageRep();
        ir.reconstruct(ImageObserver.ALLBITS);
        width = ir.getWidth();
        height = ir.getHeight();
    } else {
        width = image.getWidth(null);
        height = image.getHeight(null);
    }

    // Fix for 4919639.
    // Some Windows native applications (e.g. clipbrd.exe) do not handle
    // 32-bpp DIBs correctly.
    // As a workaround we switched to 24-bpp DIBs.
    // MSDN prescribes that the bitmap array for a 24-bpp should consist of
    // 3-byte triplets representing blue, green and red components of a
    // pixel respectively. Additionally each scan line must be padded with
    // zeroes to end on a LONG data-type boundary. LONG is always 32-bit.
    // We render the given Image to a BufferedImage of type TYPE_3BYTE_BGR
    // with non-default scanline stride and pass the resulting data buffer
    // to the native code to fill the BITMAPINFO structure.
    int mod = (width * 3) % 4;
    int pad = mod > 0 ? 4 - mod : 0;

    ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    int[] nBits = {8, 8, 8};
    int[] bOffs = {2, 1, 0};
    ColorModel colorModel =
            new ComponentColorModel(cs, nBits, false, false,
                    Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
    WritableRaster raster =
            Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, width, height,
                    width * 3 + pad, 3, bOffs, null);

    BufferedImage bimage = new BufferedImage(colorModel, raster, false, null);

    // Some Windows native applications (e.g. clipbrd.exe) do not understand
    // top-down DIBs.
    // So we flip the image vertically and create a bottom-up DIB.
    AffineTransform imageFlipTransform =
            new AffineTransform(1, 0, 0, -1, 0, height);

    Graphics2D g2d = bimage.createGraphics();

    try {
        g2d.drawImage(image, imageFlipTransform, null);
    } finally {
        g2d.dispose();
    }

    DataBufferByte buffer = (DataBufferByte)raster.getDataBuffer();

    byte[] imageData = buffer.getData();
    return imageDataToPlatformImageBytes(imageData, width, height, format);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:72,代码来源:WDataTransferer.java

示例5: createNativeCursor

import sun.awt.image.ImageRepresentation; //导入方法依赖的package包/类
@Override
protected void createNativeCursor(Image im, int[] pixels, int w, int h,
                                  int xHotSpot, int yHotSpot) {
    BufferedImage bimage = new BufferedImage(w, h,
                           BufferedImage.TYPE_INT_RGB);
    Graphics g = bimage.getGraphics();
    try {
        if (im instanceof ToolkitImage) {
            ImageRepresentation ir = ((ToolkitImage)im).getImageRep();
            ir.reconstruct(ImageObserver.ALLBITS);
        }
        g.drawImage(im, 0, 0, w, h, null);
    } finally {
        g.dispose();
    }
    Raster  raster = bimage.getRaster();
    DataBuffer buffer = raster.getDataBuffer();
    // REMIND: native code should use ScanStride _AND_ width
    int data[] = ((DataBufferInt)buffer).getData();

    byte[] andMask = new byte[w * h / 8];
    int npixels = pixels.length;
    for (int i = 0; i < npixels; i++) {
        int ibyte = i / 8;
        int omask = 1 << (7 - (i % 8));
        if ((pixels[i] & 0xff000000) == 0) {
            // Transparent bit
            andMask[ibyte] |= omask;
        }
    }

    {
        int     ficW = raster.getWidth();
        if( raster instanceof IntegerComponentRaster ) {
            ficW = ((IntegerComponentRaster)raster).getScanlineStride();
        }
        createCursorIndirect(
            ((DataBufferInt)bimage.getRaster().getDataBuffer()).getData(),
            andMask, ficW, raster.getWidth(), raster.getHeight(),
            xHotSpot, yHotSpot);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:WCustomCursor.java

示例6: setIconImage

import sun.awt.image.ImageRepresentation; //导入方法依赖的package包/类
void setIconImage(Image img) {
    if (img == null) {
        //if image is null, reset to default image
        replaceImage(null);
        replaceMask(null);
    } else {
        //get image size
        int width;
        int height;
        if (img instanceof ToolkitImage) {
            ImageRepresentation ir = ((ToolkitImage)img).getImageRep();
            ir.reconstruct(ImageObserver.ALLBITS);
            width = ir.getWidth();
            height = ir.getHeight();
        }
        else {
            width = img.getWidth(null);
            height = img.getHeight(null);
        }
        Dimension iconSize = getIconSize(width, height);
        if (iconSize != null) {
            if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                log.finest("Icon size: {0}", iconSize);
            }
            iconWidth = iconSize.width;
            iconHeight = iconSize.height;
        } else {
            log.finest("Error calculating image size");
            iconWidth = 0;
            iconHeight = 0;
        }
        replaceImage(img);
        replaceMask(img);
    }
    //create icon window and set XWMHints
    XToolkit.awtLock();
    try {
        AwtGraphicsConfigData adata = parent.getGraphicsConfigurationData();
        awtImageData awtImage = adata.get_awtImage(0);
        XVisualInfo visInfo = adata.get_awt_visInfo();
        XWMHints hints = parent.getWMHints();
        window = hints.get_icon_window();
        if (window == 0) {
            log.finest("Icon window wasn't set");
            XCreateWindowParams params = getDelayedParams();
            params.add(BORDER_PIXEL, Long.valueOf(XToolkit.getAwtDefaultFg()));
            params.add(BACKGROUND_PIXMAP, iconPixmap);
            params.add(COLORMAP, adata.get_awt_cmap());
            params.add(DEPTH, awtImage.get_Depth());
            params.add(VISUAL_CLASS, (int)XConstants.InputOutput);
            params.add(VISUAL, visInfo.get_visual());
            params.add(VALUE_MASK, XConstants.CWBorderPixel | XConstants.CWColormap | XConstants.CWBackPixmap);
            params.add(PARENT_WINDOW, XlibWrapper.RootWindow(XToolkit.getDisplay(), visInfo.get_screen()));
            params.add(BOUNDS, new Rectangle(0, 0, iconWidth, iconHeight));
            params.remove(DELAYED);
            init(params);
            if (getWindow() == 0) {
                log.finest("Can't create new icon window");
            } else {
                log.finest("Created new icon window");
            }
        }
        if (getWindow() != 0) {
            XlibWrapper.XSetWindowBackgroundPixmap(XToolkit.getDisplay(), getWindow(), iconPixmap);
            XlibWrapper.XClearWindow(XToolkit.getDisplay(), getWindow());
        }
        // Provide both pixmap and window, WM or Taskbar will use the one they find more appropriate
        long newFlags = hints.get_flags() | XUtilConstants.IconPixmapHint | XUtilConstants.IconMaskHint;
        if (getWindow()  != 0) {
            newFlags |= XUtilConstants.IconWindowHint;
        }
        hints.set_flags(newFlags);
        hints.set_icon_pixmap(iconPixmap);
        hints.set_icon_mask(iconMask);
        hints.set_icon_window(getWindow());
        XlibWrapper.XSetWMHints(XToolkit.getDisplay(), parent.getShell(), hints.pData);
        log.finest("Set icon window hint");
    } finally {
        XToolkit.awtUnlock();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:82,代码来源:XIconWindow.java

示例7: setIconImage

import sun.awt.image.ImageRepresentation; //导入方法依赖的package包/类
void setIconImage(Image img) {
    if (img == null) {
        //if image is null, reset to default image
        replaceImage(null);
        replaceMask(null);
    } else {
        //get image size
        int width;
        int height;
        if (img instanceof ToolkitImage) {
            ImageRepresentation ir = ((ToolkitImage)img).getImageRep();
            ir.reconstruct(ImageObserver.ALLBITS);
            width = ir.getWidth();
            height = ir.getHeight();
        }
        else {
            width = img.getWidth(null);
            height = img.getHeight(null);
        }
        Dimension iconSize = getIconSize(width, height);
        if (iconSize != null) {
            if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                log.finest("Icon size: {0}", iconSize);
            }
            iconWidth = iconSize.width;
            iconHeight = iconSize.height;
        } else {
            log.finest("Error calculating image size");
            iconWidth = 0;
            iconHeight = 0;
        }
        replaceImage(img);
        replaceMask(img);
    }
    //create icon window and set XWMHints
    XToolkit.awtLock();
    try {
        AwtGraphicsConfigData adata = parent.getGraphicsConfigurationData();
        awtImageData awtImage = adata.get_awtImage(0);
        XVisualInfo visInfo = adata.get_awt_visInfo();
        XWMHints hints = parent.getWMHints();
        window = hints.get_icon_window();
        if (window == 0) {
            log.finest("Icon window wasn't set");
            XCreateWindowParams params = getDelayedParams();
            params.add(BORDER_PIXEL, Long.valueOf(XToolkit.getAwtDefaultFg()));
            params.add(BACKGROUND_PIXMAP, iconPixmap);
            params.add(COLORMAP, adata.get_awt_cmap());
            params.add(DEPTH, awtImage.get_Depth());
            params.add(VISUAL_CLASS, XConstants.InputOutput);
            params.add(VISUAL, visInfo.get_visual());
            params.add(VALUE_MASK, XConstants.CWBorderPixel | XConstants.CWColormap | XConstants.CWBackPixmap);
            params.add(PARENT_WINDOW, XlibWrapper.RootWindow(XToolkit.getDisplay(), visInfo.get_screen()));
            params.add(BOUNDS, new Rectangle(0, 0, iconWidth, iconHeight));
            params.remove(DELAYED);
            init(params);
            if (getWindow() == 0) {
                log.finest("Can't create new icon window");
            } else {
                log.finest("Created new icon window");
            }
        }
        if (getWindow() != 0) {
            XlibWrapper.XSetWindowBackgroundPixmap(XToolkit.getDisplay(), getWindow(), iconPixmap);
            XlibWrapper.XClearWindow(XToolkit.getDisplay(), getWindow());
        }
        // Provide both pixmap and window, WM or Taskbar will use the one they find more appropriate
        long newFlags = hints.get_flags() | XUtilConstants.IconPixmapHint | XUtilConstants.IconMaskHint;
        if (getWindow()  != 0) {
            newFlags |= XUtilConstants.IconWindowHint;
        }
        hints.set_flags(newFlags);
        hints.set_icon_pixmap(iconPixmap);
        hints.set_icon_mask(iconMask);
        hints.set_icon_window(getWindow());
        XlibWrapper.XSetWMHints(XToolkit.getDisplay(), parent.getShell(), hints.pData);
        log.finest("Set icon window hint");
    } finally {
        XToolkit.awtUnlock();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:82,代码来源:XIconWindow.java

示例8: imageToPlatformBytes

import sun.awt.image.ImageRepresentation; //导入方法依赖的package包/类
protected byte[] imageToPlatformBytes(Image image, long format)
  throws IOException {
    String mimeType = null;
    if (format == CF_PNG) {
        mimeType = "image/png";
    } else if (format == CF_JFIF) {
        mimeType = "image/jpeg";
    }
    if (mimeType != null) {
        return imageToStandardBytes(image, mimeType);
    }

    int width = 0;
    int height = 0;

    if (image instanceof ToolkitImage) {
        ImageRepresentation ir = ((ToolkitImage)image).getImageRep();
        ir.reconstruct(ImageObserver.ALLBITS);
        width = ir.getWidth();
        height = ir.getHeight();
    } else {
        width = image.getWidth(null);
        height = image.getHeight(null);
    }

    // Fix for 4919639.
    // Some Windows native applications (e.g. clipbrd.exe) do not handle
    // 32-bpp DIBs correctly.
    // As a workaround we switched to 24-bpp DIBs.
    // MSDN prescribes that the bitmap array for a 24-bpp should consist of
    // 3-byte triplets representing blue, green and red components of a
    // pixel respectively. Additionally each scan line must be padded with
    // zeroes to end on a LONG data-type boundary. LONG is always 32-bit.
    // We render the given Image to a BufferedImage of type TYPE_3BYTE_BGR
    // with non-default scanline stride and pass the resulting data buffer
    // to the native code to fill the BITMAPINFO structure.
    int mod = (width * 3) % 4;
    int pad = mod > 0 ? 4 - mod : 0;

    ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    int[] nBits = {8, 8, 8};
    int[] bOffs = {2, 1, 0};
    ColorModel colorModel =
        new ComponentColorModel(cs, nBits, false, false,
                                Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
    WritableRaster raster =
        Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, width, height,
                                       width * 3 + pad, 3, bOffs, null);

    BufferedImage bimage = new BufferedImage(colorModel, raster, false, null);

    // Some Windows native applications (e.g. clipbrd.exe) do not understand
    // top-down DIBs.
    // So we flip the image vertically and create a bottom-up DIB.
    AffineTransform imageFlipTransform =
        new AffineTransform(1, 0, 0, -1, 0, height);

    Graphics2D g2d = bimage.createGraphics();

    try {
        g2d.drawImage(image, imageFlipTransform, null);
    } finally {
        g2d.dispose();
    }

    DataBufferByte buffer = (DataBufferByte)raster.getDataBuffer();

    byte[] imageData = buffer.getData();
    return imageDataToPlatformImageBytes(imageData, width, height, format);
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:71,代码来源:WDataTransferer.java

示例9: createNativeCursor

import sun.awt.image.ImageRepresentation; //导入方法依赖的package包/类
protected void createNativeCursor(Image im, int[] pixels, int w, int h,
                                  int xHotSpot, int yHotSpot) {
    BufferedImage bimage = new BufferedImage(w, h,
                           BufferedImage.TYPE_INT_RGB);
    Graphics g = bimage.getGraphics();
    try {
        if (im instanceof ToolkitImage) {
            ImageRepresentation ir = ((ToolkitImage)im).getImageRep();
            ir.reconstruct(ImageObserver.ALLBITS);
        }
        g.drawImage(im, 0, 0, w, h, null);
    } finally {
        g.dispose();
    }
    Raster  raster = bimage.getRaster();
    DataBuffer buffer = raster.getDataBuffer();
    // REMIND: native code should use ScanStride _AND_ width
    int data[] = ((DataBufferInt)buffer).getData();

    byte[] andMask = new byte[w * h / 8];
    int npixels = pixels.length;
    for (int i = 0; i < npixels; i++) {
        int ibyte = i / 8;
        int omask = 1 << (7 - (i % 8));
        if ((pixels[i] & 0xff000000) == 0) {
            // Transparent bit
            andMask[ibyte] |= omask;
        }
    }

    {
        int     ficW = raster.getWidth();
        if( raster instanceof IntegerComponentRaster ) {
            ficW = ((IntegerComponentRaster)raster).getScanlineStride();
        }
        createCursorIndirect(
            ((DataBufferInt)bimage.getRaster().getDataBuffer()).getData(),
            andMask, ficW, raster.getWidth(), raster.getHeight(),
            xHotSpot, yHotSpot);
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:42,代码来源:WCustomCursor.java

示例10: setIconImage

import sun.awt.image.ImageRepresentation; //导入方法依赖的package包/类
void setIconImage(Image img) {
    if (img == null) {
        //if image is null, reset to default image
        replaceImage(null);
        replaceMask(null);
    } else {
        //get image size
        int width;
        int height;
        if (img instanceof ToolkitImage) {
            ImageRepresentation ir = ((ToolkitImage)img).getImageRep();
            ir.reconstruct(ImageObserver.ALLBITS);
            width = ir.getWidth();
            height = ir.getHeight();
        }
        else {
            width = img.getWidth(null);
            height = img.getHeight(null);
        }
        Dimension iconSize = getIconSize(width, height);
        if (iconSize != null) {
            log.finest("Icon size: {0}", iconSize);
            iconWidth = iconSize.width;
            iconHeight = iconSize.height;
        } else {
            log.finest("Error calculating image size");
            iconWidth = 0;
            iconHeight = 0;
        }
        replaceImage(img);
        replaceMask(img);
    }
    //create icon window and set XWMHints
    XToolkit.awtLock();
    try {
        AwtGraphicsConfigData adata = parent.getGraphicsConfigurationData();
        awtImageData awtImage = adata.get_awtImage(0);
        XVisualInfo visInfo = adata.get_awt_visInfo();
        XWMHints hints = parent.getWMHints();
        window = hints.get_icon_window();
        if (window == 0) {
            log.finest("Icon window wasn't set");
            XCreateWindowParams params = getDelayedParams();
            params.add(BORDER_PIXEL, Long.valueOf(XToolkit.getAwtDefaultFg()));
            params.add(BACKGROUND_PIXMAP, iconPixmap);
            params.add(COLORMAP, adata.get_awt_cmap());
            params.add(DEPTH, awtImage.get_Depth());
            params.add(VISUAL_CLASS, (int)XConstants.InputOutput);
            params.add(VISUAL, visInfo.get_visual());
            params.add(VALUE_MASK, XConstants.CWBorderPixel | XConstants.CWColormap | XConstants.CWBackPixmap);
            params.add(PARENT_WINDOW, XlibWrapper.RootWindow(XToolkit.getDisplay(), visInfo.get_screen()));
            params.add(BOUNDS, new Rectangle(0, 0, iconWidth, iconHeight));
            params.remove(DELAYED);
            init(params);
            if (getWindow() == 0) {
                log.finest("Can't create new icon window");
            } else {
                log.finest("Created new icon window");
            }
        }
        if (getWindow() != 0) {
            XlibWrapper.XSetWindowBackgroundPixmap(XToolkit.getDisplay(), getWindow(), iconPixmap);
            XlibWrapper.XClearWindow(XToolkit.getDisplay(), getWindow());
        }
        // Provide both pixmap and window, WM or Taskbar will use the one they find more appropriate
        long newFlags = hints.get_flags() | XUtilConstants.IconPixmapHint | XUtilConstants.IconMaskHint;
        if (getWindow()  != 0) {
            newFlags |= XUtilConstants.IconWindowHint;
        }
        hints.set_flags(newFlags);
        hints.set_icon_pixmap(iconPixmap);
        hints.set_icon_mask(iconMask);
        hints.set_icon_window(getWindow());
        XlibWrapper.XSetWMHints(XToolkit.getDisplay(), parent.getShell(), hints.pData);
        log.finest("Set icon window hint");
    } finally {
        XToolkit.awtUnlock();
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:80,代码来源:XIconWindow.java

示例11: imageToPlatformBytes

import sun.awt.image.ImageRepresentation; //导入方法依赖的package包/类
protected byte[] imageToPlatformBytes(Image image, long format)
        throws IOException {
    String mimeType = null;
    if (format == CF_PNG) {
        mimeType = "image/png";
    } else if (format == CF_JFIF) {
        mimeType = "image/jpeg";
    }
    if (mimeType != null) {
        return imageToStandardBytes(image, mimeType);
    }

    int width = 0;
    int height = 0;

    if (image instanceof ToolkitImage) {
        ImageRepresentation ir = ((ToolkitImage)image).getImageRep();
        ir.reconstruct(ImageObserver.ALLBITS);
        width = ir.getWidth();
        height = ir.getHeight();
    } else {
        width = image.getWidth(null);
        height = image.getHeight(null);
    }

    // Fix for 4919639.
    // Some Windows native applications (e.g. clipbrd.exe) do not handle
    // 32-bpp DIBs correctly.
    // As a workaround we switched to 24-bpp DIBs.
    // MSDN prescribes that the bitmap array for a 24-bpp should consist of
    // 3-byte triplets representing blue, green and red components of a
    // pixel respectively. Additionally each scan line must be padded with
    // zeroes to end on a LONG data-type boundary. LONG is always 32-bit.
    // We render the given Image to a BufferedImage of type TYPE_3BYTE_BGR
    // with non-default scanline stride and pass the resulting data buffer
    // to the native code to fill the BITMAPINFO structure.
    int mod = (width * 3) % 4;
    int pad = mod > 0 ? 4 - mod : 0;

    ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
    int[] nBits = {8, 8, 8};
    int[] bOffs = {2, 1, 0};
    ColorModel colorModel =
            new ComponentColorModel(cs, nBits, false, false,
                    Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
    WritableRaster raster =
            Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, width, height,
                    width * 3 + pad, 3, bOffs, null);

    BufferedImage bimage = new BufferedImage(colorModel, raster, false, null);

    // Some Windows native applications (e.g. clipbrd.exe) do not understand
    // top-down DIBs.
    // So we flip the image vertically and create a bottom-up DIB.
    AffineTransform imageFlipTransform =
            new AffineTransform(1, 0, 0, -1, 0, height);

    Graphics2D g2d = bimage.createGraphics();

    try {
        g2d.drawImage(image, imageFlipTransform, null);
    } finally {
        g2d.dispose();
    }

    DataBufferByte buffer = (DataBufferByte)raster.getDataBuffer();

    byte[] imageData = buffer.getData();
    return imageDataToPlatformImageBytes(imageData, width, height, format);
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:71,代码来源:WDataTransferer.java


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