Tiled 2D Amortized Noise
A Program to Generate Infinite Grayscale Noise Textures with Amortized Noise
|
Source code for saving a noise cell as a PNG or TGA file. More...
Functions | |
void | Save2DNoise (float **cell, const int n, const float scale, const char *basefilename) |
Two versions of the Save2DNoise function, one for Windows and one for Unix. The Windows version uses GDI+ code for saving a PNG image to a file. This code was mostly scored from the MSDN website, but getting the details right was like pulling teeth. The Unix version saves the noise tile as a TGA image because, frankly, the format is bog-easy and I could write the code in under 30 seconds. No excuses.
void Save2DNoise | ( | float ** | cell, |
const int | n, | ||
const float | scale, | ||
const char * | basefilename | ||
) |
Save a cell of 2D noise as a png file (Windows) or TGA file (Unix).
cell | Pointer to array in which to store the noise. |
scale | Rescale by this to get in the range -1..1. |
basefilename | Root of the file name under which to store the noise. |
n | Cell size. |