Bridges-Java
3.4.2
Bridges(Java API)
|
This is a class in BRIDGES for representing an image.
A ColorGrid is essentially an image. One can construct an image of a particular size using the ColorGrid() constructor to be either blank or filled with a particular Color depending on which constructor is called.
One can change the color of a pixel with set(). For instance, like that:
You can get a ColorGrid from an existing Bridges ColorGrid assignment using bridges.connect.DataSource.getColorGridFromAssignment()
Public Member Functions | |
String | getDataStructType () |
ColorGrid () | |
ColorGrid (int rows, int cols) | |
ColorGrid (int rows, int cols, Color color) | |
void | resize (int rows, int cols) |
int | getHeight () |
int | getWidth () |
String | getDataStructureRepresentation () |
Public Member Functions inherited from bridges.base.Grid< Color > | |
String | getDataStructType () |
Grid () | |
Grid (int size) | |
Grid (int rows, int cols) | |
Construct a rows x cols size grid. More... | |
Grid (int[] size) | |
Construct a size[0] by size[1] sized grid. More... | |
void | resize (int rows, int cols) |
int[] | getDimensions () |
Get the grid dimensions. More... | |
E | get (Integer row, Integer col) |
Get the (row, col) element in the grid. More... | |
void | set (Integer row, Integer col, E val) |
String | getDataStructureRepresentation () |
Get data structure representation. More... | |
Additional Inherited Members | |
Protected Attributes inherited from bridges.base.Grid< Color > | |
ArrayList< ArrayList< E > > | grid |
int[] | gridSize |
Static Protected Attributes inherited from bridges.base.Grid< Color > | |
static final int[] | defaultGridSize |
static int[] | maxGridSize |
bridges.base.ColorGrid.ColorGrid | ( | ) |
Construct a color grid with defaulty sizes:
bridges.base.ColorGrid.ColorGrid | ( | int | rows, |
int | cols | ||
) |
Grid constructor with size arguments
rows | - int representing the number of rows of the grid |
cols | - int representing the number of columns of the grid |
bridges.base.ColorGrid.ColorGrid | ( | int | rows, |
int | cols, | ||
Color | color | ||
) |
String bridges.base.ColorGrid.getDataStructType | ( | ) |
Get the data type name
String bridges.base.ColorGrid.getDataStructureRepresentation | ( | ) |
Get the JSON representation of the color grid
int bridges.base.ColorGrid.getHeight | ( | ) |
Get the height of the color grid
int bridges.base.ColorGrid.getWidth | ( | ) |
Get the width of the color grid
void bridges.base.ColorGrid.resize | ( | int | rows, |
int | cols | ||
) |