Search in sources :

Example 16 with PImage

use of processing.core.PImage in project opennars by opennars.

the class GTextIconAlignBase method setIcon.

/**
 * Set the icon to be used and the horizontal and/or vertical icon alignment.
 * Use the constants in GAlign e.g. <pre>GAlign.LEFT</pre> <br>
 *
 * @param fname the filename of the icon
 * @param nbrImages number of tiled images in the icon
 * @param horz LEFT or RIGHT
 * @param vert TOP, MIDDLE, BOTTOM
 */
public void setIcon(String fname, int nbrImages, GAlign horz, GAlign vert) {
    PImage iconImage = ImageManager.loadImage(winApp, fname);
    setIcon(iconImage, nbrImages, horz, vert);
}
Also used : PImage(processing.core.PImage)

Example 17 with PImage

use of processing.core.PImage in project opennars by opennars.

the class GCScheme method makeColorSchemes.

/**
 * Called every time we create a control. The palettes will be made when
 * the first control is created.
 *
 * @param app
 */
public static void makeColorSchemes(PApplet app) {
    // otherwise do nothing
    if (palettes != null)
        return;
    // Load the image
    PImage image = null;
    /*InputStream is = app.createInput("user_gui_palette.png");
		if(is != null){
			try {
				is.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
			image = app.loadImage("user_gui_palette.png");
			GMessenger.message(USER_COL_SCHEME, null);
		}
		else*/
    {
        // User image not provided
        image = app.loadImage("data/default_gui_palette.png");
        // Added to 3.4 to hopefully fix problem with OpenProcessing
        if (image == null)
            image = new PImage((new javax.swing.ImageIcon(new GCScheme().getClass().getResource("/data/default_gui_palette.png"))).getImage());
    }
    // Now make the palletes
    palettes = new int[16][16];
    jpalettes = new Color[16][16];
    for (int p = 0; p < 16; p++) for (int c = 0; c < 16; c++) {
        int col = image.get(c * 16 + 8, p * 16 + 8);
        palettes[p][c] = col;
        jpalettes[p][c] = new Color((col >> 16) & 0xff, (col >> 8) & 0xff, col & 0xff);
    }
}
Also used : PImage(processing.core.PImage) Color(java.awt.Color)

Aggregations

PImage (processing.core.PImage)17 Color (java.awt.Color)4 File (java.io.File)2 Image (java.awt.Image)1 Point (java.awt.Point)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Method (java.lang.reflect.Method)1 ImageIcon (javax.swing.ImageIcon)1 SunburstItem (org.sirix.gui.view.sunburst.SunburstItem)1