Package com.docuverse.identicon
Class NineBlockIdenticonRenderer2
java.lang.Object
com.docuverse.identicon.NineBlockIdenticonRenderer2
- All Implemented Interfaces:
IdenticonRenderer
public class NineBlockIdenticonRenderer2 extends Object implements IdenticonRenderer
9-block Identicon renderer.
Current implementation uses only the lower 32 bits of identicon code.
- Author:
- don
-
Constructor Summary
Constructors Constructor Description NineBlockIdenticonRenderer2()
Constructor. -
Method Summary
Modifier and Type Method Description Color
getBackgroundColor()
float
getPatchSize()
Returns the size in pixels at which each patch will be rendered before they are scaled down to requested identicon size.BufferedImage
render(int code, int size)
Returns rendered identicon image for given identicon code.BufferedImage
render(BigInteger code, int size)
Returns rendered identicon image for given identicon code.protected BufferedImage
renderQuilt(int code, int size)
void
setBackgroundColor(Color backgroundColor)
void
setPatchSize(float size)
Set the size in pixels at which each patch will be rendered before they are scaled down to requested identicon size.
-
Constructor Details
-
NineBlockIdenticonRenderer2
public NineBlockIdenticonRenderer2()Constructor.
-
-
Method Details
-
getPatchSize
public float getPatchSize()Returns the size in pixels at which each patch will be rendered before they are scaled down to requested identicon size.- Returns:
- the size
-
setPatchSize
public void setPatchSize(float size)Set the size in pixels at which each patch will be rendered before they are scaled down to requested identicon size. Default size is 20 pixels which means, for 9-block identicon, a 60x60 image will be rendered and scaled down.- Parameters:
size
- patch size in pixels
-
getBackgroundColor
-
setBackgroundColor
-
render
Description copied from interface:IdenticonRenderer
Returns rendered identicon image for given identicon code.- Specified by:
render
in interfaceIdenticonRenderer
- Parameters:
code
- identicon codesize
- image size- Returns:
- identicon image
-
render
Returns rendered identicon image for given identicon code.Size of the returned identicon image is determined by patchSize set using
setPatchSize(float)
. Since a 9-block identicon consists of 3x3 patches, width and height will be 3 times the patch size.- Specified by:
render
in interfaceIdenticonRenderer
- Parameters:
code
- identicon codesize
- image size- Returns:
- identicon image
-
renderQuilt
-