AgonConsole8 / agon-vdp

Official Firmware for the Agon Console8: ESP32 VDP
MIT License
38 stars 13 forks source link

More transform operations #236

Open stevesims opened 1 month ago

stevesims commented 1 month ago

Adds in a few new matrix operation commands

Affine transform command gains a "translate by bitmap size" operation, which adds an x,y translate to the transform where the given x and y values are scaled by the given bitmap's width and height. this is useful for adding in translate ops that are proportional to bitmap size, such as translating to negative half width and half height to centre the transform origin

New 3d affine transform command added. this supports all of the same options as the 2d affine transform command, and will create a 4x4 affine transform matrix. 3d versions generally take 1 more argument, as they need arguments for a third dimension. rotate for 3d takes 3 arguments (instead of 1) to rotate around all 3 axes

Generic "matrix manipulate" command added, which allows matrixes of arbitrary dimensions to so be created (given as arguments to the command) and manipulated. Operations include set, set value (to set an individual value at a row/column in an existing matrix), fill whole matrix with a given value, set values on the diagonal, add, subtract, multiply, scalar multiply, extract a sub-matrix, insert/delete row/column

New command added to create a new transformed bitmap. This will take a source bitmap (of any supported format) and a transform buffer, and from those two it generates a new RGBA2222 format bitmap in the target buffer. It accepts options to automatically resize the new bitmap to fit the transformed image, explicitly set the new size, and automatically translate the new bitmap back to the origin

New command to "transform data" added, which will take a source buffer, a matrix, and various options to control how data is found and interpreted. The target buffer is a copy of the source with the matrix applied to it, given the options, so data within that buffer is transformed to new values. As an example, if you have a buffer that contains a list of plot commands, this can be used to transform the coordinates given as part of those plot commands. This can also be used to transform buffers of other data. The data source format is specified as part of the command, and can be 16 or 32 bit values, that are fixed-point or floating-point values. (Integer transforms are supported by using fixed-point format with a shift of zero)