Package me.damoebe
Klasse BrickImage
java.lang.Object
me.damoebe.BrickImage
The Main class to generate BrickImages containing every brick
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungBrickImage(int width, int height, Image image) Main constructor of the BrickImage classBrickImage(int width, int height, Image image, boolean allowTransparentBricks) Transparent property constructorBrickImage(int width, int height, Image image, Map<String, Integer> availableElements) Constructor for a BrickImage which has specific elements build in it. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungGetter for bricksMaps element_id to amount of this element being usedgetPreviewImage(int brickSize) Draws a preview imagedoublegetPrice()Assumes that one brick costs 0.015 $ in averageAssumes that one brick is 0.8*0.8 cm large.Getter for source imagegetStats()Combines all important StatsintCalculates the brick amount.voidoptimizeVariations(int minBrickAmount) Minimized the variations of Bricks in the imagevoidsetMaxBrickVariations(int maxBrickVariations) Optimizes the brick variations using optimizeVariations() until the brick variations are lower or the same as maxBrickVariations.
-
Konstruktordetails
-
BrickImage
Main constructor of the BrickImage class- Parameter:
width- The target width of the BrickImageheight- The target height of the BrickImageimage- The source image, that will be scaled down
-
BrickImage
Transparent property constructor- Parameter:
width- The target width of the BrickImageheight- The target height of the BrickImageimage- The source image, that will be scaled downallowTransparentBricks- If transparent Bricks should be allowed or not
-
BrickImage
Constructor for a BrickImage which has specific elements build in it.- Parameter:
width- Target width of the BrickImageheight- Target height of the BrickImageimage- Source ImageavailableElements- Map of available elements that should be used to build the BrickImage
-
-
Methodendetails
-
getPreviewImage
Draws a preview image- Parameter:
brickSize- The exact pixel-size one brick will take in the image- Gibt zurück:
- A BufferedImage containing all bricks forming the result
-
getSourceImage
-
getElementsSorted
-
optimizeVariations
public void optimizeVariations(int minBrickAmount) Minimized the variations of Bricks in the image- Parameter:
minBrickAmount- The minimal amount of bricks an element needs to have in the Image to keep existing after the optimization.
-
setMaxBrickVariations
public void setMaxBrickVariations(int maxBrickVariations) Optimizes the brick variations using optimizeVariations() until the brick variations are lower or the same as maxBrickVariations. Please keep in mind that changing to a higher value will not resolve in more optimisations.- Parameter:
maxBrickVariations- The maximal brick variations that should be allowed in the brickImage
-
getBricks
-
getSizeInCM
Assumes that one brick is 0.8*0.8 cm large.- Gibt zurück:
- A String featuring the real-life width and height of the BrickImage. Format: {width}cm x {height}cm
-
getTotalBricks
public int getTotalBricks()Calculates the brick amount.- Gibt zurück:
- Number of total bricks
-
getPrice
public double getPrice()Assumes that one brick costs 0.015 $ in average- Gibt zurück:
- a double representing the estimated prize
-
getStats
Combines all important Stats- Gibt zurück:
- A String featuring size, brick_amount and estimated price of the BrickImage
-