public class ScreenBitmap
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static int |
BASE_UNIT
Base measure unit, set to 1, as it's always a native unit.
|
private java.util.List<NativeRectangle> |
bitmap
Screen state - all activated rectangles.
|
private int |
cols
The screen column number.
|
private boolean |
hasRectangles
Flag to track if clipping rectangles were added to this bitmap
(including
null rectangles, which reset the screen). |
private static int |
INV_COORD
Invalid coordinate constant.
|
private int |
invalidChars
The total number of invalid characters, used for searching.
|
private NativeRectangle |
outerRectangle
Union rectangle of all clipping areas.
|
private int |
rows
The screen row number.
|
private java.util.List<NativeRectangle> |
searchBitmap
Copy bitmap, used for searching the bottommost frame from which drawing can be started.
|
Modifier | Constructor and Description |
---|---|
private |
ScreenBitmap()
Default c'tor.
|
|
ScreenBitmap(int rows,
int cols)
Initializes the bitmap with the screen size.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addRectangle(NativeRectangle rect)
Adds an invalidated rectangle to the bitmap.
|
boolean |
canDraw(int row,
int col)
Check the bitmap if drawing is possible at that location.
|
boolean |
canDraw(NativePoint p)
Check the bitmap if drawing is possible at that location.
|
(package private) void |
clipRectangle(NativeRectangle rect)
Clips the bitmap so that no output is allowed outside of the given
rectangle.
|
int |
cols()
Get number of bitmap columns.
|
(package private) boolean |
drawNeeded(NativeRectangle rect)
Check if the given location can draw data.
|
java.util.List<NativeRectangle> |
getClippings(NativeRectangle bounds)
Get the list of clipping rectangles intersecting in the specified bounds.
|
(package private) ScreenBitmap |
getCopy()
Get a copy of this bitmap instance.
|
java.util.List<NativePoint> |
getHorizontalFragments(int y,
int x,
int length)
Get the drawable horizontal fragments, to the left side of the specified
column.
|
java.util.List<NativePoint> |
getHorizontalFragments(NativePoint p,
int length)
Get the drawable horizontal fragments, to the left side of the specified
column.
|
(package private) int |
getInvalidChars()
Get the total number of available clipped characters, from the search
bitmap screen.
|
NativeRectangle |
getOuterRectangle()
Get outer rectangle.
|
java.util.List<NativePoint> |
getVerticalFragments(int y,
int x,
int length)
Get the drawable vertical fragments, to the down side of the specified
row.
|
java.util.List<NativePoint> |
getVerticalFragments(NativePoint p,
int length)
Get the drawable vertical fragments, to the down side of the specified
row.
|
java.util.List<NativePoint> |
getVerticalFragmentsAnyColumn(int y,
int length)
Get the drawable vertical fragments, to the down side of the specified
row.
|
boolean |
hasCoordinatesOutsideScreen(NativeRectangle rect)
Check if a given rectangle has negative coordinates.
|
boolean |
hasInvalidCoordinates(NativeRectangle rect)
Check if a given rectangle has invalid coordinates.
|
(package private) boolean |
hasRectangles()
Check if the screen was added any rectangles (including null rectangles,
which reset the entire screen).
|
boolean |
isScreenReset()
This method will return
true if no clipping info was added
to this bitmap (i.e. |
(package private) boolean |
markArea(NativeRectangle rect)
Mark a certain area as searched and decrement the total number of
clipped characters.
|
(package private) void |
resetScreen()
Reset the screen to allow drawing.
|
void |
resetScreen(boolean state)
Reset the screen to the specified state.
|
int |
rows()
Get number of bitmap rows.
|
void |
setBit(int row,
int col,
boolean value)
Set one specified bit in bitmap.
|
void |
setColumns(int cols)
Set the number of columns for this bitmap.
|
void |
setRows(int rows)
Set the number of rows for this bitmap.
|
private void |
setState(int rowFrom,
int colFrom,
int rowTo,
int colTo,
boolean state)
Set the area specified by the given coordinates, in the specified state.
|
(package private) void |
startScreenSearch()
Create a copy of this screen bitmap and count the invalid chars.
|
private static final int BASE_UNIT
private static final int INV_COORD
private int cols
private int rows
private java.util.List<NativeRectangle> bitmap
private NativeRectangle outerRectangle
private int invalidChars
private java.util.List<NativeRectangle> searchBitmap
private boolean hasRectangles
null
rectangles, which reset the screen).private ScreenBitmap()
public ScreenBitmap(int rows, int cols)
true
.rows
- The number of screen rows.cols
- The number of screen columns.void startScreenSearch()
boolean markArea(NativeRectangle rect)
rect
- Area to mark as searched.true
if this area contains a clipped character,
which was not part of an upper widget.int getInvalidChars()
void resetScreen()
true
, indicating that the location can be drawn.public void resetScreen(boolean state)
state
- true
means that position can be drawn.private void setState(int rowFrom, int colFrom, int rowTo, int colTo, boolean state)
void addRectangle(NativeRectangle rect)
false
values.rect
- Invalidated rectangle, which entire region will be set to
true
. If null
, then the entire screen
area is set as drawable.void clipRectangle(NativeRectangle rect)
rect
- clipping rectangle.
If null
, nothing changes in the bitmappublic boolean isScreenReset()
true
if no clipping info was added
to this bitmap (i.e. the screen is in 'reset' state, with all characters
being drawable).true
if no clipping is in effect.public NativeRectangle getOuterRectangle()
boolean hasRectangles()
hasRectangles
flag.public boolean canDraw(int row, int col)
row
- The screen row.col
- The screen column.true
if drawing is allowed.public void setBit(int row, int col, boolean value)
row
- Bit row.col
- Bit column.value
- New bit value.public boolean canDraw(NativePoint p)
p
- The screen location.true
if drawing is allowed.public boolean hasCoordinatesOutsideScreen(NativeRectangle rect)
rect
- Rectangle to check for negative coordinates.true
if any of its coordinates are negative;
false
, if notpublic boolean hasInvalidCoordinates(NativeRectangle rect)
rect
- Rectangle to check for invalid coordinates.true
if any of its coordinates are invalid;
false
, if notboolean drawNeeded(NativeRectangle rect)
rect
- The area of the widget which is checked for drawing.true
if screen any of the bitmap locations
within the given rectangle are true
;
false
if nothing can be drawn.ScreenBitmap getCopy()
public java.util.List<NativePoint> getHorizontalFragments(NativePoint p, int length)
This will return an array of drawable fragments, each fragment having specified its start and end locations (both inclusive), relative to the 'length' parameter.
public java.util.List<NativePoint> getHorizontalFragments(int y, int x, int length)
This will return an array of drawable fragments, each fragment having specified its start and end locations (both inclusive), relative to the 'length' parameter.
y
- The row location where to start looking for drawable fragments,
horizontally.x
- The column location where to start looking for drawable
fragments, horizontally.length
- The length of the line to look into.Point.x
represents
the start column and Point.y
represents the end column,
inclusive.public java.util.List<NativePoint> getVerticalFragments(NativePoint p, int length)
This will return an array of drawable fragments, each fragment having specified its start and end locations (both inclusive), relative to the 'length' parameter.
p
- The location where to start looking for drawable fragments,
vertically.length
- The length of the line to look into.Point.x
represents
the start row and {#link Point#y} represents the end row,
inclusive.public java.util.List<NativePoint> getVerticalFragments(int y, int x, int length)
This will return an array of drawable fragments, each fragment having specified its start and end locations (both inclusive), relative to the 'length' parameter.
y
- The row location where to start looking for drawable fragments,
horizontally.x
- The column location where to start looking for drawable
fragments, horizontally.length
- The length of the line to look into.Point.x
represents
the start row and Point.y
represents the end row,
inclusive.public java.util.List<NativePoint> getVerticalFragmentsAnyColumn(int y, int length)
This will return an array of drawable fragments, each fragment having specified its start and end locations (both inclusive), relative to the 'length' parameter.
public int rows()
public void setRows(int rows)
rows
- The new number of rows.public int cols()
public void setColumns(int cols)
cols
- The new number of columns.public java.util.List<NativeRectangle> getClippings(NativeRectangle bounds)
bounds
- The bounds from which the clipping rectangles are required.