Package net.paulhertz.pixelaudio
Class MultiGen
java.lang.Object
net.paulhertz.pixelaudio.PixelMapGen
net.paulhertz.pixelaudio.MultiGen
A PixelMapGen child class that combines multiple PixelMapGen instances with a single signal path.
The signal path is not necessarily continuous over a 4-connected grid, i.e., the bitmap used by
a PixelAudioMapper instance initialized with a MultiGen, but it may be.
-
Field Summary
FieldsFields inherited from class net.paulhertz.pixelaudio.PixelMapGen
coords, flipx, flipy, fx270, fx90, h, nada, pixelMap, r180, r270, r90, sampleMap, size, transArray, transformType, uniformTransArray, w -
Constructor Summary
ConstructorsConstructorDescriptionMultiGen(int width, int height) Calls the default constructor with AffineTransformType.NADA as the third parameter.MultiGen(int width, int height, int rows, int columns, ArrayList<PixelMapGen> genList) Given an ArrayList of PixelMapGens, orders then in rows and columns to create a MultiGen.MultiGen(int width, int height, ArrayList<int[]> offsetList, ArrayList<PixelMapGen> genList) Given an ArrayList of PixelMapGens and an ArrayList of coordinate offsets, arranges the upper left corner of each gen at the corresponding coordinate offset over the width and height of the MultiGen.MultiGen(int width, int height, AffineTransformType transform) Default constructor, creates two DiagonalZigzagGens. -
Method Summary
Modifier and TypeMethodDescriptiondescribe()Returns a description of the mapping and initialization requirements of a PixelMapGen class.int[]generate()Initialize this.coords, this.pixelMap, this.sampleMap.private ArrayList<int[]>Generically-named method that calls the custom coordinate generation method (here, generateMultiCoordinates).private ArrayList<int[]>generateMultiCoordinates(int width, int height) The coordinate generation method for this class.intArrayList<int[]>intgetRows()static MultiGenhilbertZigzagLoop6x4(int genW, int genH) This method creates a MultiGen consisting of a mix of zigzag and Hilbert curves in 6 columns and 4 rows arranged to provide a continuous loop.ArrayList<int[]>translateCoords(ArrayList<int[]> coordList, int tx, int ty) Translates coordinate pairs incoordListby(tx, ty).booleanvalidate(int width, int height) Validates parameters to a constructor.Methods inherited from class net.paulhertz.pixelaudio.PixelMapGen
findNearestPowerOfTwoLessThan, findPowerOfTwo, getCoordinates, getCoordinatesCopy, getHeight, getInversMapFromPixelArray, getPixelMap, getPixelMapCopy, getPixelMapFromCoordinates, getSampleMap, getSampleMapCopy, getSize, getTransformType, getWidth, isPowerOfTwo, loadIndexMaps, randomTransform, randomUniformTransform, setMapsFromCoords, setTransformType, transformCoords
-
Field Details
-
rows
public int rows -
columns
public int columns -
genList
-
offsetList
-
description
- See Also:
-
-
Constructor Details
-
MultiGen
Default constructor, creates two DiagonalZigzagGens.- Parameters:
width- total width of the MultiGen in pixelsheight- total height of the MultiGen in pixelstransform- an AffineTransformType to apply the coordinates of the MultiGen
-
MultiGen
public MultiGen(int width, int height) Calls the default constructor with AffineTransformType.NADA as the third parameter.- Parameters:
width- total width of the MultiGen in pixelsheight- total height of the MultiGen in pixels
-
MultiGen
Given an ArrayList of PixelMapGens, orders then in rows and columns to create a MultiGen.- Parameters:
width- total width of the MultiGen in pixelsheight- total height of the MultiGen in pixelsrows- number of rows of PixelMapGenscolumns- number of columns of PixelMapGensgenList- an ArrayList of PixelMapGens, where genList.size() == rows * columns
-
MultiGen
Given an ArrayList of PixelMapGens and an ArrayList of coordinate offsets, arranges the upper left corner of each gen at the corresponding coordinate offset over the width and height of the MultiGen.- Parameters:
width- total width of the MultiGen in pixelsheight- total height of the MultiGen in pixelsoffsetList- a list of coordinate pairs, offsets to the upper left corner of each PixelMapGen in genListgenList- an ArrayList of PixelMapGens, where genList.size() == offsetList.size()
-
-
Method Details
-
describe
Description copied from class:PixelMapGenReturns a description of the mapping and initialization requirements of a PixelMapGen class.- Specified by:
describein classPixelMapGen- Returns:
- A String describing this class's mapping and initialization requirements
-
validate
public boolean validate(int width, int height) Description copied from class:PixelMapGenValidates parameters to a constructor.- Specified by:
validatein classPixelMapGen- Returns:
- true if the width and height parameters are valid for creating a mapping with this generator, otherwise, false.
-
generate
public int[] generate()Initialize this.coords, this.pixelMap, this.sampleMap.- Specified by:
generatein classPixelMapGen- Returns:
- this.pixelMap, the value for PixelAudioMapper.signalToImageLUT.
-
generateCoordinates
Generically-named method that calls the custom coordinate generation method (here, generateMultiCoordinates). Consider putting additional initializations here, if required by your coordinate generation method, rather than in the generate() method, which will then only handle coords initialization and the built-in pixelMap and sampleMap initializations.- Returns:
- An ArrayList of int[]: bitmap coordinates in the order the signal mapping would visit them.
-
generateMultiCoordinates
The coordinate generation method for this class. Both lookup tables are derived from the coordinate list created by this method.- Parameters:
width- width of the 2D bitmap pixel arrayheight- height of the 2D bitmap pixel array- Returns:
- an array of coordinate pairs
-
translateCoords
Translates coordinate pairs incoordListby(tx, ty).- Parameters:
coordList- list of coordinate pairstx- translation on x-axisty- translation on y-axis- Returns:
- translated coordinates
-
getRows
public int getRows() -
getColumns
public int getColumns() -
getGenList
-
getOffsetList
-
hilbertZigzagLoop6x4
This method creates a MultiGen consisting of a mix of zigzag and Hilbert curves in 6 columns and 4 rows arranged to provide a continuous loop. The resulting MultiGen will be 6 * genW wide by 4 * genH high, where genW == genH and genW is a power of 2 (required for Hilbert gens). Shows how to use arrays of gens, coordinate pairs, and affine transforms to create a MultiGen, probably the most useful general strategy.- Parameters:
genW- width of each gen, must be a power of 2 and equal to genWgenH- height of each gen, must be a power of 2 and equal to genW- Returns:
-