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);
}
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);
}
}
Aggregations