java.awt.image.SampleModel#getWidth()源码实例Demo

下面列出了java.awt.image.SampleModel#getWidth() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: openjdk-jdk9   文件: GIFImageWriterSpi.java
public boolean canEncodeImage(ImageTypeSpecifier type) {
    if (type == null) {
        throw new IllegalArgumentException("type == null!");
    }

    SampleModel sm = type.getSampleModel();
    ColorModel cm = type.getColorModel();

    boolean canEncode = sm.getNumBands() == 1 &&
        sm.getSampleSize(0) <= 8 &&
        sm.getWidth() <= 65535 &&
        sm.getHeight() <= 65535 &&
        (cm == null || cm.getComponentSize()[0] <= 8);

    if (canEncode) {
        return true;
    } else {
        return PaletteBuilder.canCreatePalette(type);
    }
}
 
源代码2 项目: jdk8u-jdk   文件: ShortBandedRaster.java
/**
 * Constructs a ShortBandedRaster with the given SampleModel.
 * The Raster's upper left corner is origin and it is the same
 * size as the SampleModel.  A DataBuffer large enough to describe the
 * Raster is automatically created.  SampleModel must be of type
 * BandedSampleModel.
 * @param sampleModel     The SampleModel that specifies the layout.
 * @param origin          The Point that specified the origin.
 */
public ShortBandedRaster(SampleModel sampleModel,
                            Point origin) {
    this(sampleModel,
         sampleModel.createDataBuffer(),
         new Rectangle(origin.x,
                       origin.y,
                       sampleModel.getWidth(),
                       sampleModel.getHeight()),
         origin,
         null);
}
 
/**
 * Constructs a ShortComponentRaster with the given SampleModel
 * and DataBuffer.  The Raster's upper left corner is origin and
 * it is the same sizes the SampleModel.  The DataBuffer is not
 * initialized and must be a DataBufferUShort compatible with SampleModel.
 * SampleModel must be of type ComponentSampleModel or
 * SinglePixelPackedSampleModel.
 * @param sampleModel     The SampleModel that specifies the layout.
 * @param dataBuffer      The DataBufferUShort that contains the image data.
 * @param origin          The Point that specifies the origin.
 */
public ShortComponentRaster(SampleModel sampleModel,
                               DataBuffer dataBuffer,
                               Point origin) {
    this(sampleModel,
         dataBuffer,
         new Rectangle(origin.x,
                       origin.y,
                       sampleModel.getWidth(),
                       sampleModel.getHeight()),
         origin,
         null);
}
 
源代码4 项目: openjdk-jdk8u   文件: ByteComponentRaster.java
/**
 * Constructs a ByteComponentRaster with the given SampleModel.
 * The Raster's upper left corner is origin and it is the same
 * size as the SampleModel.  A DataBuffer large enough to describe the
 * Raster is automatically created.  SampleModel must be of type
 * SinglePixelPackedSampleModel or ComponentSampleModel.
 * @param sampleModel     The SampleModel that specifies the layout.
 * @param origin          The Point that specified the origin.
 */
public ByteComponentRaster(SampleModel sampleModel, Point origin) {
    this(sampleModel,
         sampleModel.createDataBuffer(),
         new Rectangle(origin.x,
                       origin.y,
                       sampleModel.getWidth(),
                       sampleModel.getHeight()),
         origin,
         null);
}
 
源代码5 项目: openjdk-jdk9   文件: BytePackedRaster.java
/**
 * Constructs a BytePackedRaster with the given SampleModel
 * and DataBuffer.  The Raster's upper left corner is origin and
 * it is the same size as the SampleModel.  The DataBuffer is not
 * initialized and must be a DataBufferByte compatible with SampleModel.
 * SampleModel must be of type MultiPixelPackedSampleModel.
 * @param sampleModel     The SampleModel that specifies the layout.
 * @param dataBuffer      The DataBufferByte that contains the image data.
 * @param origin          The Point that specifies the origin.
 */
public BytePackedRaster(SampleModel sampleModel,
                        DataBufferByte dataBuffer,
                        Point origin)
{
    this(sampleModel,
         dataBuffer,
         new Rectangle(origin.x,
                       origin.y,
                       sampleModel.getWidth(),
                       sampleModel.getHeight()),
         origin,
         null);
}
 
源代码6 项目: openjdk-8   文件: ByteInterleavedRaster.java
/**
 * Constructs a ByteInterleavedRaster with the given SampleModel.
 * The Raster's upper left corner is origin and it is the same
 * size as the SampleModel.  A DataBuffer large enough to describe the
 * Raster is automatically created.  SampleModel must be of type
 * SinglePixelPackedSampleModel or InterleavedSampleModel.
 * @param sampleModel     The SampleModel that specifies the layout.
 * @param origin          The Point that specified the origin.
 */
public ByteInterleavedRaster(SampleModel sampleModel, Point origin) {
    this(sampleModel,
         sampleModel.createDataBuffer(),
         new Rectangle(origin.x,
                       origin.y,
                       sampleModel.getWidth(),
                       sampleModel.getHeight()),
         origin,
         null);
}
 
源代码7 项目: jdk8u-jdk   文件: IntegerComponentRaster.java
/**
 *  Constructs a IntegerComponentRaster with the given SampleModel.
 *  The Raster's upper left corner is origin and it is the same
 *  size as the SampleModel.  A DataBuffer large enough to describe the
 *  Raster is automatically created.  SampleModel must be of type
 *  SinglePixelPackedSampleModel.
 *  @param sampleModel     The SampleModel that specifies the layout.
 *  @param origin          The Point that specified the origin.
 */
public IntegerComponentRaster(SampleModel sampleModel,
                                 Point origin) {
    this(sampleModel,
         sampleModel.createDataBuffer(),
         new Rectangle(origin.x,
                       origin.y,
                       sampleModel.getWidth(),
                       sampleModel.getHeight()),
         origin,
         null);
}
 
源代码8 项目: openjdk-jdk9   文件: ShortComponentRaster.java
/**
 * Constructs a ShortComponentRaster with the given SampleModel
 * and DataBuffer.  The Raster's upper left corner is origin and
 * it is the same sizes the SampleModel.  The DataBuffer is not
 * initialized and must be a DataBufferUShort compatible with SampleModel.
 * SampleModel must be of type ComponentSampleModel or
 * SinglePixelPackedSampleModel.
 * @param sampleModel     The SampleModel that specifies the layout.
 * @param dataBuffer      The DataBufferUShort that contains the image data.
 * @param origin          The Point that specifies the origin.
 */
public ShortComponentRaster(SampleModel sampleModel,
                            DataBufferUShort dataBuffer,
                            Point origin)
{
    this(sampleModel,
         dataBuffer,
         new Rectangle(origin.x,
                       origin.y,
                       sampleModel.getWidth(),
                       sampleModel.getHeight()),
         origin,
         null);
}
 
源代码9 项目: TencentKona-8   文件: ShortComponentRaster.java
/**
 *  Constructs a ShortComponentRaster with the given SampleModel.
 *  The Raster's upper left corner is origin and it is the same
 *  size as the SampleModel.  A DataBuffer large enough to describe the
 *  Raster is automatically created.  SampleModel must be of type
 *  ComponentSampleModel or SinglePixelPackedSampleModel.
 *  @param sampleModel     The SampleModel that specifies the layout.
 *  @param origin          The Point that specified the origin.
 */
public ShortComponentRaster(SampleModel sampleModel, Point origin) {
    this(sampleModel,
         sampleModel.createDataBuffer(),
         new Rectangle(origin.x,
                       origin.y,
                       sampleModel.getWidth(),
                       sampleModel.getHeight()),
         origin,
         null);
}
 
源代码10 项目: openjdk-jdk9   文件: IntegerComponentRaster.java
/**
 *  Constructs a IntegerComponentRaster with the given SampleModel.
 *  The Raster's upper left corner is origin and it is the same
 *  size as the SampleModel.  A DataBuffer large enough to describe the
 *  Raster is automatically created.  SampleModel must be of type
 *  SinglePixelPackedSampleModel.
 *  @param sampleModel     The SampleModel that specifies the layout.
 *  @param origin          The Point that specified the origin.
 */
public IntegerComponentRaster(SampleModel sampleModel, Point origin) {
    this(sampleModel,
         (DataBufferInt) sampleModel.createDataBuffer(),
         new Rectangle(origin.x,
                       origin.y,
                       sampleModel.getWidth(),
                       sampleModel.getHeight()),
         origin,
         null);
}
 
源代码11 项目: jdk8u60   文件: ByteComponentRaster.java
/**
 * Constructs a ByteComponentRaster with the given SampleModel.
 * The Raster's upper left corner is origin and it is the same
 * size as the SampleModel.  A DataBuffer large enough to describe the
 * Raster is automatically created.  SampleModel must be of type
 * SinglePixelPackedSampleModel or ComponentSampleModel.
 * @param sampleModel     The SampleModel that specifies the layout.
 * @param origin          The Point that specified the origin.
 */
public ByteComponentRaster(SampleModel sampleModel, Point origin) {
    this(sampleModel,
         sampleModel.createDataBuffer(),
         new Rectangle(origin.x,
                       origin.y,
                       sampleModel.getWidth(),
                       sampleModel.getHeight()),
         origin,
         null);
}
 
源代码12 项目: jdk8u-jdk   文件: ShortComponentRaster.java
/**
 *  Constructs a ShortComponentRaster with the given SampleModel.
 *  The Raster's upper left corner is origin and it is the same
 *  size as the SampleModel.  A DataBuffer large enough to describe the
 *  Raster is automatically created.  SampleModel must be of type
 *  ComponentSampleModel or SinglePixelPackedSampleModel.
 *  @param sampleModel     The SampleModel that specifies the layout.
 *  @param origin          The Point that specified the origin.
 */
public ShortComponentRaster(SampleModel sampleModel, Point origin) {
    this(sampleModel,
         sampleModel.createDataBuffer(),
         new Rectangle(origin.x,
                       origin.y,
                       sampleModel.getWidth(),
                       sampleModel.getHeight()),
         origin,
         null);
}
 
源代码13 项目: jdk8u60   文件: ByteComponentRaster.java
/**
 * Constructs a ByteComponentRaster with the given SampleModel
 * and DataBuffer.  The Raster's upper left corner is origin and
 * it is the same size as the SampleModel.  The DataBuffer is not
 * initialized and must be a DataBufferByte compatible with SampleModel.
 * SampleModel must be of type SinglePixelPackedSampleModel
 * or ComponentSampleModel.
 * @param sampleModel     The SampleModel that specifies the layout.
 * @param dataBuffer      The DataBufferShort that contains the image data.
 * @param origin          The Point that specifies the origin.
 */
public ByteComponentRaster(SampleModel sampleModel,
                              DataBuffer dataBuffer,
                              Point origin) {
    this(sampleModel,
         dataBuffer,
         new Rectangle(origin.x,
                       origin.y,
                       sampleModel.getWidth(),
                       sampleModel.getHeight()),
         origin,
         null);
}
 
源代码14 项目: TencentKona-8   文件: ByteInterleavedRaster.java
/**
 * Constructs a ByteInterleavedRaster with the given SampleModel.
 * The Raster's upper left corner is origin and it is the same
 * size as the SampleModel.  A DataBuffer large enough to describe the
 * Raster is automatically created.  SampleModel must be of type
 * SinglePixelPackedSampleModel or InterleavedSampleModel.
 * @param sampleModel     The SampleModel that specifies the layout.
 * @param origin          The Point that specified the origin.
 */
public ByteInterleavedRaster(SampleModel sampleModel, Point origin) {
    this(sampleModel,
         sampleModel.createDataBuffer(),
         new Rectangle(origin.x,
                       origin.y,
                       sampleModel.getWidth(),
                       sampleModel.getHeight()),
         origin,
         null);
}
 
源代码15 项目: jdk8u-jdk   文件: BytePackedRaster.java
/**
 * Constructs a BytePackedRaster with the given SampleModel.
 * The Raster's upper left corner is origin and it is the same
 * size as the SampleModel.  A DataBuffer large enough to describe the
 * Raster is automatically created.  SampleModel must be of type
 * MultiPixelPackedSampleModel.
 * @param sampleModel     The SampleModel that specifies the layout.
 * @param origin          The Point that specified the origin.
 */
public BytePackedRaster(SampleModel sampleModel,
                        Point origin) {
    this(sampleModel,
         sampleModel.createDataBuffer(),
         new Rectangle(origin.x,
                       origin.y,
                       sampleModel.getWidth(),
                       sampleModel.getHeight()),
         origin,
         null);
}
 
源代码16 项目: dragonwell8_jdk   文件: IntegerComponentRaster.java
/**
 *  Constructs a IntegerComponentRaster with the given SampleModel.
 *  The Raster's upper left corner is origin and it is the same
 *  size as the SampleModel.  A DataBuffer large enough to describe the
 *  Raster is automatically created.  SampleModel must be of type
 *  SinglePixelPackedSampleModel.
 *  @param sampleModel     The SampleModel that specifies the layout.
 *  @param origin          The Point that specified the origin.
 */
public IntegerComponentRaster(SampleModel sampleModel,
                                 Point origin) {
    this(sampleModel,
         sampleModel.createDataBuffer(),
         new Rectangle(origin.x,
                       origin.y,
                       sampleModel.getWidth(),
                       sampleModel.getHeight()),
         origin,
         null);
}
 
源代码17 项目: jdk1.8-source-analysis   文件: GIFImageWriter.java
public IIOMetadata getDefaultImageMetadata(ImageTypeSpecifier imageType,
                                           ImageWriteParam param) {
    GIFWritableImageMetadata imageMetadata =
        new GIFWritableImageMetadata();

    // Image dimensions

    SampleModel sampleModel = imageType.getSampleModel();

    Rectangle sourceBounds = new Rectangle(sampleModel.getWidth(),
                                           sampleModel.getHeight());
    Dimension destSize = new Dimension();
    computeRegions(sourceBounds, destSize, param);

    imageMetadata.imageWidth = destSize.width;
    imageMetadata.imageHeight = destSize.height;

    // Interlacing

    if (param != null && param.canWriteProgressive() &&
        param.getProgressiveMode() == ImageWriteParam.MODE_DISABLED) {
        imageMetadata.interlaceFlag = false;
    } else {
        imageMetadata.interlaceFlag = true;
    }

    // Local color table

    ColorModel colorModel = imageType.getColorModel();

    imageMetadata.localColorTable =
        createColorTable(colorModel, sampleModel);

    // Transparency

    if (colorModel instanceof IndexColorModel) {
        int transparentIndex =
            ((IndexColorModel)colorModel).getTransparentPixel();
        if (transparentIndex != -1) {
            imageMetadata.transparentColorFlag = true;
            imageMetadata.transparentColorIndex = transparentIndex;
        }
    }

    return imageMetadata;
}
 
源代码18 项目: jdk8u-jdk   文件: GIFImageWriter.java
public IIOMetadata getDefaultImageMetadata(ImageTypeSpecifier imageType,
                                           ImageWriteParam param) {
    GIFWritableImageMetadata imageMetadata =
        new GIFWritableImageMetadata();

    // Image dimensions

    SampleModel sampleModel = imageType.getSampleModel();

    Rectangle sourceBounds = new Rectangle(sampleModel.getWidth(),
                                           sampleModel.getHeight());
    Dimension destSize = new Dimension();
    computeRegions(sourceBounds, destSize, param);

    imageMetadata.imageWidth = destSize.width;
    imageMetadata.imageHeight = destSize.height;

    // Interlacing

    if (param != null && param.canWriteProgressive() &&
        param.getProgressiveMode() == ImageWriteParam.MODE_DISABLED) {
        imageMetadata.interlaceFlag = false;
    } else {
        imageMetadata.interlaceFlag = true;
    }

    // Local color table

    ColorModel colorModel = imageType.getColorModel();

    imageMetadata.localColorTable =
        createColorTable(colorModel, sampleModel);

    // Transparency

    if (colorModel instanceof IndexColorModel) {
        int transparentIndex =
            ((IndexColorModel)colorModel).getTransparentPixel();
        if (transparentIndex != -1) {
            imageMetadata.transparentColorFlag = true;
            imageMetadata.transparentColorIndex = transparentIndex;
        }
    }

    return imageMetadata;
}
 
源代码19 项目: openjdk-8-source   文件: GIFImageWriter.java
public IIOMetadata getDefaultImageMetadata(ImageTypeSpecifier imageType,
                                           ImageWriteParam param) {
    GIFWritableImageMetadata imageMetadata =
        new GIFWritableImageMetadata();

    // Image dimensions

    SampleModel sampleModel = imageType.getSampleModel();

    Rectangle sourceBounds = new Rectangle(sampleModel.getWidth(),
                                           sampleModel.getHeight());
    Dimension destSize = new Dimension();
    computeRegions(sourceBounds, destSize, param);

    imageMetadata.imageWidth = destSize.width;
    imageMetadata.imageHeight = destSize.height;

    // Interlacing

    if (param != null && param.canWriteProgressive() &&
        param.getProgressiveMode() == ImageWriteParam.MODE_DISABLED) {
        imageMetadata.interlaceFlag = false;
    } else {
        imageMetadata.interlaceFlag = true;
    }

    // Local color table

    ColorModel colorModel = imageType.getColorModel();

    imageMetadata.localColorTable =
        createColorTable(colorModel, sampleModel);

    // Transparency

    if (colorModel instanceof IndexColorModel) {
        int transparentIndex =
            ((IndexColorModel)colorModel).getTransparentPixel();
        if (transparentIndex != -1) {
            imageMetadata.transparentColorFlag = true;
            imageMetadata.transparentColorIndex = transparentIndex;
        }
    }

    return imageMetadata;
}
 
源代码20 项目: jdk8u_jdk   文件: ShortBandedRaster.java
/**
 * Constructs a ShortBandedRaster with the given SampleModel
 * and DataBuffer.  The Raster's upper left corner is origin and
 * it is the same size as the SampleModel.  The DataBuffer is not
 * initialized and must be a DataBufferUShort compatible with SampleModel.
 * SampleModel must be of type BandedSampleModel.
 * @param sampleModel     The SampleModel that specifies the layout.
 * @param dataBuffer      The DataBufferUShort that contains the image data.
 * @param origin          The Point that specifies the origin.
 */
public ShortBandedRaster(SampleModel sampleModel,
                            DataBuffer dataBuffer,
                            Point origin) {
    this(sampleModel, dataBuffer,
         new Rectangle(origin.x, origin.y,
                       sampleModel.getWidth(),
                       sampleModel.getHeight()),
         origin, null);
}