All Downloads are FREE. Search and download functionalities are using the official Maven repository.

JSci.instruments.Image Maven / Gradle / Ivy

Go to download

JSci is a set of open source Java packages. The aim is to encapsulate scientific methods/principles in the most natural way possible. As such they should greatly aid the development of scientific based software. It offers: abstract math interfaces, linear algebra (support for various matrix and vector types), statistics (including probability distributions), wavelets, newtonian mechanics, chart/graph components (AWT and Swing), MathML DOM implementation, ... Note: some packages, like javax.comm, for the astro and instruments package aren't listed as dependencies (not available).

The newest version!
package JSci.instruments;

import java.awt.*;
import java.awt.image.*;
import java.util.*;

/** Describes a frame, that holds the informations to access an image */

public abstract class Image implements Dimensions {

    /** @return the width of the image */
    public int getWidth() { return getSize().width; }

    /** @return the height of the image */
    public int getHeight() { return getSize().height; }

    /** @return the dimension of the image */
    public abstract Dimension getSize();

    /** @return the scansize of the image in the getData() */
    public int getScansize() { return getSize().width; }

    /** @return the offset of the image in the getData() */
    public int getOffset() { return 0; }

    private static ColorModel cm;
    static {
	byte [] r = new byte[256];
	byte [] g = new byte[256];
	byte [] b = new byte[256];
	for (int j=0;j<256;j++) r[j]=g[j]=b[j]=(byte)j;
	cm = new IndexColorModel(8,256,r,g,b);
    }
    /** @return the ColorModel */
    public ColorModel getColorModel() { return cm; }

    /** @return the data */
    public abstract byte[] getData();

    /** @return the time in milliseconds */
    public long getTimeStamp() { return 0; }

    /* Overlay */
    private ArrayList ovrl = new ArrayList();
    
    /** Images (poligons and text) can be overlaid onto the images.
     * This method is called to actually paint the overlays.
     * @param g the graphical environment on which we want to paint 
     */
    public void doOverlay(Graphics g) { 
	for (int j=0;j




© 2015 - 2024 Weber Informatics LLC | Privacy Policy