Record Class PaintPlan
java.lang.Object
java.lang.Record
dev.despical.pixelpainter.image.PaintPlan
- Record Components:
width- output columnsheight- output rowsblocks- row-major block-data strings or null for transparent pixelsmaterials- selected material names and their pixel counts
public record PaintPlan(int width, int height, String[] blocks, Map<String,Integer> materials)
extends Record
Stores prepared block data and material totals without a live world reference.
The block array is a row-major image, with row zero at the top. A null entry preserves the existing block. Construction and array access copy the array; the material-count map is copied and exposed as an unmodifiable view.
Plans are created by image workers and consumed by the server-thread painting service. Counts describe selected pixels rather than changes to terrain that may already match the selected material.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionblock(int index) Reads one selected block without copying the complete pixel array.String[]blocks()Returns a defensive copy of the row-major pixel array.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intheight()Returns the value of theheightrecord component.Returns the value of thematerialsrecord component.intpainted()Counts pixels that select a palette material.intsize()Returns the complete output area, including transparent pixels.final StringtoString()Returns a string representation of this record class.intwidth()Returns the value of thewidthrecord component.
-
Constructor Details
-
PaintPlan
-
-
Method Details
-
blocks
Returns a defensive copy of the row-major pixel array.- Returns:
- copied block-data strings, including null transparent entries
-
block
Reads one selected block without copying the complete pixel array.- Parameters:
index- row-major pixel index- Returns:
- canonical block data, or null to preserve terrain
-
size
public int size()Returns the complete output area, including transparent pixels.- Returns:
- number of pixel slots
-
painted
public int painted()Counts pixels that select a palette material.- Returns:
- selected pixels, regardless of existing terrain
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
width
-
height
-
materials
-