Class BuildFromPathGen
BuildFromPathGen myGen = new BuildFromPathGen(w, h); myGen.setPixelMap(newPixelMap); myGen.generate();The int[] array that you supply to setPixelMap must have length = w * h and contain the ordinal numbers from 0..(w * h - 1) in any order. Its values are the index numbers in a w * h bitmap in signal path order. BuildFromPathGen makes it easy to create arbitrary signal paths that do not depend on numerical calculations.
-
Field Summary
FieldsFields inherited from class net.paulhertz.pixelaudio.PixelMapGen
coords, h, pixelMap, sampleMap, size, transformType, w
-
Constructor Summary
ConstructorsConstructorDescriptionBuildFromPathGen
(int width, int height) BuildFromPathGen
(int width, int height, AffineTransformType type) -
Method Summary
Modifier and TypeMethodDescriptiondescribe()
int[]
generate()
Initialization method that setsthis.coords
, and thenthis.pixelMap
andthis.sampleMap
:this.coords
is a list of coordinate pairs representing the signal path, the (x,y) pixel locations along a path that visits every pixel in a bitmap exactly once.void
setPixelMap
(int[] newPixelMap) Sets the value of the pixelMap field.boolean
validate
(int width, int height) Methods inherited from class net.paulhertz.pixelaudio.PixelMapGen
findNearestPowerOfTwoLessThan, findPowerOfTwo, getCoordinates, getCoordinatesCopy, getHeight, getInversMapFromPixelArray, getPixelMap, getPixelMapCopy, getPixelMapFromCoordinatess, getSampleMap, getSampleMapCopy, getSize, getTransformType, getWidth, isPowerOfTwo, loadIndexMaps, setMapsFromCoords, setTransformType, transformCoords
-
Field Details
-
description
- See Also:
-
-
Constructor Details
-
BuildFromPathGen
-
BuildFromPathGen
public BuildFromPathGen(int width, int height)
-
-
Method Details
-
describe
- Specified by:
describe
in classPixelMapGen
- Returns:
- A String describing the mapping generated by your class and any initialization requirements.
-
validate
public boolean validate(int width, int height) - Specified by:
validate
in classPixelMapGen
- Returns:
- true if the width and height parameters are valid for creating a mapping with this generator, otherwise, false.
-
generate
public int[] generate()Description copied from class:PixelMapGen
Initialization method that sets
this.coords
, and thenthis.pixelMap
andthis.sampleMap
:this.coords
is a list of coordinate pairs representing the signal path, the (x,y) pixel locations along a path that visits every pixel in a bitmap exactly once. Once you have created it, you can callsetMapsFromCoords()
to setthis.pixelMap
andthis.sampleMap
automatically.generate()
must be called from your class, so that you can initialize any local variables before generating coordinates and LUTs. The best place to call it is typically on the last line of the constructor for your class, after calling super() on the first line and after initializing any local variables needed to generate your coordinates and LUTs. You must initializethis.coords
,this.pixelMap
, andthis.sampleMap
within generate(). SeeDiagonalZigzagGen
orHilbertGen
for sample code.- Specified by:
generate
in classPixelMapGen
- Returns:
- this.pixelMap, the value for PixelAudioMapper.signalToImageLUT.
-
setPixelMap
public void setPixelMap(int[] newPixelMap) Sets the value of the pixelMap field. PixelMap corresponds to signalToImageLUT in a PixelAudioMapper, an int[] array where the value at each index is the unique index of a pixel in a bitmap. The array that you supply to setPixelMap must have length = w * h and contain the ordinal numbers from 0..(w * h - 1) in any order.- Parameters:
newPixelMap
-
-