samer@0: /* samer@0: * Copyright (c) 2000, Samer Abdallah, King's College London. samer@0: * All rights reserved. samer@0: * samer@0: * This software is provided AS iS and WITHOUT ANY WARRANTY; samer@0: * without even the implied warranty of MERCHANTABILITY or samer@0: * FITNESS FOR A PARTICULAR PURPOSE. samer@0: */ samer@0: samer@0: package samer.tools; samer@0: import java.awt.image.*; samer@0: samer@0: public class ArrayImageSource extends ImageSourceBase samer@0: { samer@0: double array[]; samer@0: byte buf[]; samer@0: samer@0: public ArrayImageSource( double A[]) { this(A,A.length,1); } samer@0: public ArrayImageSource( double A[], boolean vertical) { this(A,1,A.length); } samer@0: public ArrayImageSource( double A[], int w, int h) samer@0: { samer@0: array = A; samer@0: width = w; samer@0: height = h; samer@0: buf = new byte[A.length]; samer@0: } samer@0: samer@0: protected int getHints() { samer@0: return ImageConsumer.TOPDOWNLEFTRIGHT samer@0: | ImageConsumer.COMPLETESCANLINES samer@0: | ImageConsumer.SINGLEPASS; samer@0: } samer@0: samer@0: protected void sendPixels(ImageConsumer ic) samer@0: { samer@0: int i; samer@0: for (i=0; i