Bridges-Java  3.4.2
Bridges(Java API)
Public Member Functions | List of all members
bridges.base.ColorGrid Class Reference
Inheritance diagram for bridges.base.ColorGrid:
bridges.base.Grid< Color >

Detailed Description

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:

ColorGrid cg = new ColorGrid(rows, columns);
cg.set (2, 3, new Color("lightsalmon");
ColorGrid()
Definition: ColorGrid.java:44

You can get a ColorGrid from an existing Bridges ColorGrid assignment using bridges.connect.DataSource.getColorGridFromAssignment()

See also
See the tutorial about ColorGrid : https://bridgesuncc.github.io/tutorials/Grid.html
Author
David Burlinson, Erik Saule

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...
 
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
 

Constructor & Destructor Documentation

◆ ColorGrid() [1/3]

bridges.base.ColorGrid.ColorGrid ( )

Construct a color grid with defaulty sizes:

◆ ColorGrid() [2/3]

bridges.base.ColorGrid.ColorGrid ( int  rows,
int  cols 
)

Grid constructor with size arguments

Parameters
rows- int representing the number of rows of the grid
cols- int representing the number of columns of the grid

◆ ColorGrid() [3/3]

bridges.base.ColorGrid.ColorGrid ( int  rows,
int  cols,
Color  color 
)

Grid constructor with size and color string argument

Parameters
rows- int representing the number of rows of the grid
cols- int representing the number of columns of the grid
color- Color object

Member Function Documentation

◆ getDataStructType()

String bridges.base.ColorGrid.getDataStructType ( )

Get the data type name

Returns
the data type

◆ getDataStructureRepresentation()

String bridges.base.ColorGrid.getDataStructureRepresentation ( )

Get the JSON representation of the color grid

Returns
the JSON representation (string) of the color grid

◆ getHeight()

int bridges.base.ColorGrid.getHeight ( )

Get the height of the color grid

Returns
the height (number of rows) of the grid

◆ getWidth()

int bridges.base.ColorGrid.getWidth ( )

Get the width of the color grid

Returns
the width (number of columns) of the grid

◆ resize()

void bridges.base.ColorGrid.resize ( int  rows,
int  cols 
)

The documentation for this class was generated from the following file: