/* Copyright (C) 2000 Free Software Foundation This file is part of libgcj. This software is copyrighted work licensed under the terms of the Libgcj License. Please consult the file "LIBGCJ_LICENSE" for details. */ package java.awt.image; import java.awt.*; /** * @author Rolf W. Rasmussen */ public class Raster { protected SampleModel sampleModel; protected DataBuffer dataBuffer; protected int minX; protected int minY; protected int width; protected int height; protected int sampleModelTranslateX; protected int sampleModelTranslateY; protected int numBands; protected int numDataElements; protected Raster parent; protected Raster(SampleModel sampleModel, Point origin) { this(sampleModel, sampleModel.createDataBuffer(), origin); } protected Raster(SampleModel sampleModel, DataBuffer dataBuffer, Point origin) { this(sampleModel, dataBuffer, new Rectangle(origin.x, origin.y, sampleModel.getWidth(), sampleModel.getHeight()), origin, null); } protected Raster(SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion, Point sampleModelTranslate, Raster parent) { this.sampleModel = sampleModel; this.dataBuffer = dataBuffer; this.minX = aRegion.x; this.minY = aRegion.y; this.width = aRegion.width; this.height = aRegion.height; this.sampleModelTranslateX = sampleModelTranslate.x; this.sampleModelTranslateY = sampleModelTranslate.y; this.numBands = sampleModel.getNumBands(); this.numDataElements = sampleModel.getNumDataElements(); this.parent = parent; } public static WritableRaster createInterleavedRaster(int dataType, int w, int h, int bands, Point location) { int[] bandOffsets = new int[bands]; // TODO: Maybe not generate this every time. for (int b=0; b