sun.awt.image.ToolkitImage Java Examples

The following examples show how to use sun.awt.image.ToolkitImage. 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 jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public boolean copyImage(SunGraphics2D sg, Image img,
                         int dx, int dy, int sx, int sy, int w, int h,
                         Color bgColor,
                         ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return copyImage(sg, img, dx, dy, sx, sy, w, h, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg,
                                 dx, dy, (dx + w), (dy + h),
                                 sx, sy, (sx + w), (sy + h),
                                 bgColor, observer);
    }
}
 
Example #2
Source File: DrawImage.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public boolean scaleImage(SunGraphics2D sg, Image img,
                          int dx1, int dy1, int dx2, int dy2,
                          int sx1, int sy1, int sx2, int sy2,
                          Color bgColor,
                          ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return scaleImage(sg, img, dx1, dy1, dx2, dy2,
                          sx1, sy1, sx2, sy2, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg, dx1, dy1, dx2, dy2,
                                 sx1, sy1, sx2, sy2, bgColor, observer);
    }
}
 
Example #3
Source File: DrawImage.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public boolean scaleImage(SunGraphics2D sg, Image img,
                            int x, int y,
                            int width, int height,
                            Color bgColor,
                            ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return scaleImage(sg, img, x, y, width, height, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg, x, y, width, height, bgColor,
                                 observer);
    }
}
 
Example #4
Source File: DrawImage.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public boolean scaleImage(SunGraphics2D sg, Image img,
                            int x, int y,
                            int width, int height,
                            Color bgColor,
                            ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return scaleImage(sg, img, x, y, width, height, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg, x, y, width, height, bgColor,
                                 observer);
    }
}
 
Example #5
Source File: DrawImage.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public boolean scaleImage(SunGraphics2D sg, Image img,
                          int dx1, int dy1, int dx2, int dy2,
                          int sx1, int sy1, int sx2, int sy2,
                          Color bgColor,
                          ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return scaleImage(sg, img, dx1, dy1, dx2, dy2,
                          sx1, sy1, sx2, sy2, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg, dx1, dy1, dx2, dy2,
                                 sx1, sy1, sx2, sy2, bgColor, observer);
    }
}
 
Example #6
Source File: PathGraphics.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
protected BufferedImage getBufferedImage(Image img) {
    if (img instanceof BufferedImage) {
        // Otherwise we expect a BufferedImage to behave as a standard BI
        return (BufferedImage)img;
    } else if (img instanceof ToolkitImage) {
        // This can be null if the image isn't loaded yet.
        // This is fine as in that case our caller will return
        // as it will only draw a fully loaded image
        return ((ToolkitImage)img).getBufferedImage();
    } else if (img instanceof VolatileImage) {
        // VI needs to make a new BI: this is unavoidable but
        // I don't expect VI's to be "huge" in any case.
        return ((VolatileImage)img).getSnapshot();
    } else {
        // may be null or may be some non-standard Image which
        // shouldn't happen as Image is implemented by the platform
        // not by applications
        // If you add a new Image implementation to the platform you
        // will need to support it here similarly to VI.
        return null;
    }
}
 
Example #7
Source File: DrawImage.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public boolean scaleImage(SunGraphics2D sg, Image img,
                            int x, int y,
                            int width, int height,
                            Color bgColor,
                            ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return scaleImage(sg, img, x, y, width, height, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg, x, y, width, height, bgColor,
                                 observer);
    }
}
 
Example #8
Source File: DrawImage.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public boolean copyImage(SunGraphics2D sg, Image img,
                         int dx, int dy, int sx, int sy, int w, int h,
                         Color bgColor,
                         ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return copyImage(sg, img, dx, dy, sx, sy, w, h, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg,
                                 dx, dy, (dx + w), (dy + h),
                                 sx, sy, (sx + w), (sy + h),
                                 bgColor, observer);
    }
}
 
Example #9
Source File: DrawImage.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public boolean scaleImage(SunGraphics2D sg, Image img,
                          int dx1, int dy1, int dx2, int dy2,
                          int sx1, int sy1, int sx2, int sy2,
                          Color bgColor,
                          ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return scaleImage(sg, img, dx1, dy1, dx2, dy2,
                          sx1, sy1, sx2, sy2, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg, dx1, dy1, dx2, dy2,
                                 sx1, sy1, sx2, sy2, bgColor, observer);
    }
}
 
Example #10
Source File: PathGraphics.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
protected BufferedImage getBufferedImage(Image img) {
    if (img instanceof BufferedImage) {
        // Otherwise we expect a BufferedImage to behave as a standard BI
        return (BufferedImage)img;
    } else if (img instanceof ToolkitImage) {
        // This can be null if the image isn't loaded yet.
        // This is fine as in that case our caller will return
        // as it will only draw a fully loaded image
        return ((ToolkitImage)img).getBufferedImage();
    } else if (img instanceof VolatileImage) {
        // VI needs to make a new BI: this is unavoidable but
        // I don't expect VI's to be "huge" in any case.
        return ((VolatileImage)img).getSnapshot();
    } else {
        // may be null or may be some non-standard Image which
        // shouldn't happen as Image is implemented by the platform
        // not by applications
        // If you add a new Image implementation to the platform you
        // will need to support it here similarly to VI.
        return null;
    }
}
 
Example #11
Source File: DrawImage.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public boolean copyImage(SunGraphics2D sg, Image img,
                         int dx, int dy, int sx, int sy, int w, int h,
                         Color bgColor,
                         ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return copyImage(sg, img, dx, dy, sx, sy, w, h, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg,
                                 dx, dy, (dx + w), (dy + h),
                                 sx, sy, (sx + w), (sy + h),
                                 bgColor, observer);
    }
}
 
Example #12
Source File: DrawImage.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public boolean scaleImage(SunGraphics2D sg, Image img,
                            int x, int y,
                            int width, int height,
                            Color bgColor,
                            ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return scaleImage(sg, img, x, y, width, height, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg, x, y, width, height, bgColor,
                                 observer);
    }
}
 
Example #13
Source File: DrawImage.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public boolean scaleImage(SunGraphics2D sg, Image img,
                          int dx1, int dy1, int dx2, int dy2,
                          int sx1, int sy1, int sx2, int sy2,
                          Color bgColor,
                          ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return scaleImage(sg, img, dx1, dy1, dx2, dy2,
                          sx1, sy1, sx2, sy2, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg, dx1, dy1, dx2, dy2,
                                 sx1, sy1, sx2, sy2, bgColor, observer);
    }
}
 
Example #14
Source File: PathGraphics.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
protected BufferedImage getBufferedImage(Image img) {
    if (img instanceof BufferedImage) {
        // Otherwise we expect a BufferedImage to behave as a standard BI
        return (BufferedImage)img;
    } else if (img instanceof ToolkitImage) {
        // This can be null if the image isn't loaded yet.
        // This is fine as in that case our caller will return
        // as it will only draw a fully loaded image
        return ((ToolkitImage)img).getBufferedImage();
    } else if (img instanceof VolatileImage) {
        // VI needs to make a new BI: this is unavoidable but
        // I don't expect VI's to be "huge" in any case.
        return ((VolatileImage)img).getSnapshot();
    } else {
        // may be null or may be some non-standard Image which
        // shouldn't happen as Image is implemented by the platform
        // not by applications
        // If you add a new Image implementation to the platform you
        // will need to support it here similarly to VI.
        return null;
    }
}
 
Example #15
Source File: DrawImage.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public boolean copyImage(SunGraphics2D sg, Image img,
                         int dx, int dy, int sx, int sy, int w, int h,
                         Color bgColor,
                         ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return copyImage(sg, img, dx, dy, sx, sy, w, h, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg,
                                 dx, dy, (dx + w), (dy + h),
                                 sx, sy, (sx + w), (sy + h),
                                 bgColor, observer);
    }
}
 
Example #16
Source File: DrawImage.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public boolean copyImage(SunGraphics2D sg, Image img,
                         int dx, int dy, int sx, int sy, int w, int h,
                         Color bgColor,
                         ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return copyImage(sg, img, dx, dy, sx, sy, w, h, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg,
                                 dx, dy, (dx + w), (dy + h),
                                 sx, sy, (sx + w), (sy + h),
                                 bgColor, observer);
    }
}
 
Example #17
Source File: DrawImage.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public boolean copyImage(SunGraphics2D sg, Image img,
                         int dx, int dy, int sx, int sy, int w, int h,
                         Color bgColor,
                         ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return copyImage(sg, img, dx, dy, sx, sy, w, h, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg,
                                 dx, dy, (dx + w), (dy + h),
                                 sx, sy, (sx + w), (sy + h),
                                 bgColor, observer);
    }
}
 
Example #18
Source File: SunToolkit.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
    if (w == 0 || h == 0) {
        return true;
    }

    // Must be a ToolkitImage
    if (!(img instanceof ToolkitImage)) {
        return true;
    }

    ToolkitImage tkimg = (ToolkitImage)img;
    if (tkimg.hasError()) {
        if (o != null) {
            o.imageUpdate(img, ImageObserver.ERROR|ImageObserver.ABORT,
                          -1, -1, -1, -1);
        }
        return false;
    }
    ImageRepresentation ir = tkimg.getImageRep();
    return ir.prepare(o) & prepareResolutionVariant(img, w, h, o);
}
 
Example #19
Source File: PathGraphics.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected BufferedImage getBufferedImage(Image img) {
    if (img instanceof BufferedImage) {
        // Otherwise we expect a BufferedImage to behave as a standard BI
        return (BufferedImage)img;
    } else if (img instanceof ToolkitImage) {
        // This can be null if the image isn't loaded yet.
        // This is fine as in that case our caller will return
        // as it will only draw a fully loaded image
        return ((ToolkitImage)img).getBufferedImage();
    } else if (img instanceof VolatileImage) {
        // VI needs to make a new BI: this is unavoidable but
        // I don't expect VI's to be "huge" in any case.
        return ((VolatileImage)img).getSnapshot();
    } else {
        // may be null or may be some non-standard Image which
        // shouldn't happen as Image is implemented by the platform
        // not by applications
        // If you add a new Image implementation to the platform you
        // will need to support it here similarly to VI.
        return null;
    }
}
 
Example #20
Source File: PathGraphics.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected BufferedImage getBufferedImage(Image img) {
    if (img instanceof BufferedImage) {
        // Otherwise we expect a BufferedImage to behave as a standard BI
        return (BufferedImage)img;
    } else if (img instanceof ToolkitImage) {
        // This can be null if the image isn't loaded yet.
        // This is fine as in that case our caller will return
        // as it will only draw a fully loaded image
        return ((ToolkitImage)img).getBufferedImage();
    } else if (img instanceof VolatileImage) {
        // VI needs to make a new BI: this is unavoidable but
        // I don't expect VI's to be "huge" in any case.
        return ((VolatileImage)img).getSnapshot();
    } else {
        // may be null or may be some non-standard Image which
        // shouldn't happen as Image is implemented by the platform
        // not by applications
        // If you add a new Image implementation to the platform you
        // will need to support it here similarly to VI.
        return null;
    }
}
 
Example #21
Source File: DrawImage.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public boolean scaleImage(SunGraphics2D sg, Image img,
                          int dx1, int dy1, int dx2, int dy2,
                          int sx1, int sy1, int sx2, int sy2,
                          Color bgColor,
                          ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return scaleImage(sg, img, dx1, dy1, dx2, dy2,
                          sx1, sy1, sx2, sy2, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg, dx1, dy1, dx2, dy2,
                                 sx1, sy1, sx2, sy2, bgColor, observer);
    }
}
 
Example #22
Source File: PathGraphics.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected BufferedImage getBufferedImage(Image img) {
    if (img instanceof BufferedImage) {
        // Otherwise we expect a BufferedImage to behave as a standard BI
        return (BufferedImage)img;
    } else if (img instanceof ToolkitImage) {
        // This can be null if the image isn't loaded yet.
        // This is fine as in that case our caller will return
        // as it will only draw a fully loaded image
        return ((ToolkitImage)img).getBufferedImage();
    } else if (img instanceof VolatileImage) {
        // VI needs to make a new BI: this is unavoidable but
        // I don't expect VI's to be "huge" in any case.
        return ((VolatileImage)img).getSnapshot();
    } else {
        // may be null or may be some non-standard Image which
        // shouldn't happen as Image is implemented by the platform
        // not by applications
        // If you add a new Image implementation to the platform you
        // will need to support it here similarly to VI.
        return null;
    }
}
 
Example #23
Source File: DrawImage.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public boolean scaleImage(SunGraphics2D sg, Image img,
                            int x, int y,
                            int width, int height,
                            Color bgColor,
                            ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return scaleImage(sg, img, x, y, width, height, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg, x, y, width, height, bgColor,
                                 observer);
    }
}
 
Example #24
Source File: DrawImage.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public boolean copyImage(SunGraphics2D sg, Image img,
                         int dx, int dy, int sx, int sy, int w, int h,
                         Color bgColor,
                         ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return copyImage(sg, img, dx, dy, sx, sy, w, h, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg,
                                 dx, dy, (dx + w), (dy + h),
                                 sx, sy, (sx + w), (sy + h),
                                 bgColor, observer);
    }
}
 
Example #25
Source File: DrawImage.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public boolean scaleImage(SunGraphics2D sg, Image img,
                            int x, int y,
                            int width, int height,
                            Color bgColor,
                            ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return scaleImage(sg, img, x, y, width, height, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg, x, y, width, height, bgColor,
                                 observer);
    }
}
 
Example #26
Source File: DrawImage.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public boolean copyImage(SunGraphics2D sg, Image img,
                         int dx, int dy, int sx, int sy, int w, int h,
                         Color bgColor,
                         ImageObserver observer) {
    if (!(img instanceof ToolkitImage)) {
        return copyImage(sg, img, dx, dy, sx, sy, w, h, bgColor);
    } else {
        ToolkitImage sunimg = (ToolkitImage)img;
        if (!imageReady(sunimg, observer)) {
            return false;
        }
        ImageRepresentation ir = sunimg.getImageRep();
        return ir.drawToBufImage(sg, sunimg,
                                 dx, dy, (dx + w), (dy + h),
                                 sx, sy, (sx + w), (sy + h),
                                 bgColor, observer);
    }
}
 
Example #27
Source File: SunToolkit.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
@Override
public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
    if (w == 0 || h == 0) {
        return true;
    }

    // Must be a ToolkitImage
    if (!(img instanceof ToolkitImage)) {
        return true;
    }

    ToolkitImage tkimg = (ToolkitImage)img;
    if (tkimg.hasError()) {
        if (o != null) {
            o.imageUpdate(img, ImageObserver.ERROR|ImageObserver.ABORT,
                          -1, -1, -1, -1);
        }
        return false;
    }
    ImageRepresentation ir = tkimg.getImageRep();
    return ir.prepare(o) & prepareResolutionVariant(img, w, h, o);
}
 
Example #28
Source File: IconInfo.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #29
Source File: SunToolkit.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private boolean prepareResolutionVariant(Image img, int w, int h,
        ImageObserver o) {

    ToolkitImage rvImage = getResolutionVariant(img);
    int rvw = getRVSize(w);
    int rvh = getRVSize(h);
    // Ignore the resolution variant in case of error
    return rvImage == null || rvImage.hasError() || prepareImage(
            rvImage, rvw, rvh,
            MultiResolutionToolkitImage.getResolutionVariantObserver(
                    img, o, w, h, rvw, rvh, true));
}
 
Example #30
Source File: IconInfo.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}