Package squidpony.squidgrid.gui.gdx
Interface IPackedColorPanel
- All Known Implementing Classes:
ImageSquidPanel
,SparseLayers
,SquidMessageBox
,SquidPanel
,SubcellLayers
public interface IPackedColorPanel
Created by Tommy Ettinger on 8/5/2017.
-
Method Summary
Modifier and Type Method Description void
blend(int x, int y, float color, float mixBy)
Using the existing color at the position x,y, this performs color blending from that existing color to the given color (as a float), using the mixBy parameter to determine how much of the color parameter to use (1f will set the color in this to the parameter, while 0f for mixBy will ignore the color parameter entirely).int
cellHeight()
int
cellWidth()
void
clear(int x, int y)
Removes the contents of this cell, leaving a transparent space.com.badlogic.gdx.graphics.Color
getDefaultForegroundColor()
int
gridHeight()
int
gridWidth()
boolean
hasActiveAnimations()
void
put(char[][] foregrounds, com.badlogic.gdx.graphics.Color[][] colors)
void
put(int x, int y, char c)
Puts the characterc
at(x, y)
.void
put(int x, int y, char c, float encodedColor)
Places a char in the given color at the given x,y position; if the implementation has a separate background from the foreground characters, this will not affect it.void
put(int x, int y, char c, com.badlogic.gdx.graphics.Color color)
Puts the characterc
at(x, y)
with somecolor
.void
put(int x, int y, float color)
Places a full cell of color at the given x,y position; this may be used as a background or foreground, depending on the implementation.void
put(int x, int y, com.badlogic.gdx.graphics.Color color)
Putscolor
at(x, y)
(in the cell's entirety, i.e.void
put(int xOffset, int yOffset, String string, com.badlogic.gdx.graphics.Color foreground)
Puts the given string horizontally with the first character at the given offset.void
put(int xOffset, int yOffset, IColoredString<? extends com.badlogic.gdx.graphics.Color> cs)
Puts the given string horizontally with the first character at the given offset, using the colors thatcs
provides.void
setDefaultForeground(com.badlogic.gdx.graphics.Color color)
Sets the default foreground color.
-
Method Details
-
put
Places a full cell of color at the given x,y position; this may be used as a background or foreground, depending on the implementation. The color is given as a packed float, the kind produced byColor.toFloatBits()
. If the implementation performs color filtering on Color objects, it generally won't on packed float colors.- Parameters:
x
- x position of the celly
- y position of the cellcolor
- color for the full cell as a packed float, as made byColor.toFloatBits()
-
blend
Using the existing color at the position x,y, this performs color blending from that existing color to the given color (as a float), using the mixBy parameter to determine how much of the color parameter to use (1f will set the color in this to the parameter, while 0f for mixBy will ignore the color parameter entirely).- Parameters:
x
- the x component of the position in this panel to draw the starting color fromy
- the y component of the position in this panel to draw the starting color fromcolor
- the new color to mix with the starting color; a packed float, as made byColor.toFloatBits()
mixBy
- the amount by which the new color will affect the old one, between 0 (no effect) and 1 (overwrite)
-
put
Places a char in the given color at the given x,y position; if the implementation has a separate background from the foreground characters, this will not affect it. The color is given as a packed float, the kind produced byColor.toFloatBits()
. If the implementation performs color filtering on Color objects, it generally won't on packed float colors.- Parameters:
x
- x position of the chary
- y position of the charc
- the char to put at the given cellencodedColor
- the color for the char as a packed float, as made byColor.toFloatBits()
-
put
Puts the characterc
at(x, y)
.- Parameters:
x
-y
-c
-
-
put
Putscolor
at(x, y)
(in the cell's entirety, i.e. in the background).- Parameters:
x
-y
-color
-
-
put
Puts the given string horizontally with the first character at the given offset. Does not word wrap. Characters that are not renderable (due to being at negative offsets or offsets greater than the grid size) will not be shown but will not cause any malfunctions.- Parameters:
xOffset
- the x coordinate of the first characteryOffset
- the y coordinate of the first characterstring
- the characters to be displayedforeground
- the color to draw the characters
-
put
Puts the given string horizontally with the first character at the given offset, using the colors thatcs
provides. Does not word wrap. Characters that are not renderable (due to being at negative offsets or offsets greater than the grid size) will not be shown but will not cause any malfunctions.- Parameters:
xOffset
- the x coordinate of the first characteryOffset
- the y coordinate of the first charactercs
- The string to display, with its colors.
-
put
Puts the characterc
at(x, y)
with somecolor
.- Parameters:
x
-y
-c
-color
-
-
put
- Parameters:
foregrounds
- Can benull
, indicating that only colors must be put.colors
-
-
clear
Removes the contents of this cell, leaving a transparent space.- Parameters:
x
-y
-
-
gridWidth
int gridWidth()- Returns:
- The number of cells that this panel spans, horizontally.
-
gridHeight
int gridHeight()- Returns:
- The number of cells that this panel spans, vertically.
-
cellWidth
int cellWidth()- Returns:
- The width of a cell, in number of pixels.
-
cellHeight
int cellHeight()- Returns:
- The height of a cell, in number of pixels.
-
hasActiveAnimations
boolean hasActiveAnimations()- Returns:
- Returns true if there are animations running when this method is called.
-
setDefaultForeground
Sets the default foreground color.- Parameters:
color
-
-
getDefaultForegroundColor
com.badlogic.gdx.graphics.Color getDefaultForegroundColor()- Returns:
- The default foreground color (if none was set with
setDefaultForeground(Color)
), or the last color set withsetDefaultForeground(Color)
. Cannot benull
.
-