Example usage for java.awt.image ComponentSampleModel getWidth

List of usage examples for java.awt.image ComponentSampleModel getWidth

Introduction

In this page you can find the example usage for java.awt.image ComponentSampleModel getWidth.

Prototype

public final int getWidth() 

Source Link

Document

Returns the width in pixels.

Usage

From source file:org.geoserver.jai.ConcurrentTileFactory.java

static long getBufferSizeCSM(ComponentSampleModel csm) {
    int[] bandOffsets = csm.getBandOffsets();
    int maxBandOff = bandOffsets[0];
    for (int i = 1; i < bandOffsets.length; i++)
        maxBandOff = Math.max(maxBandOff, bandOffsets[i]);

    long size = 0;
    if (maxBandOff >= 0)
        size += maxBandOff + 1;//  ww w  .jav  a2s  . c  o m
    int pixelStride = csm.getPixelStride();
    if (pixelStride > 0)
        size += pixelStride * (csm.getWidth() - 1);
    int scanlineStride = csm.getScanlineStride();
    if (scanlineStride > 0)
        size += scanlineStride * (csm.getHeight() - 1);
    return size;
}