Tiled 2D Amortized Noise
A Program to Generate Infinite Grayscale Noise Textures with Amortized Noise
 All Classes Files Functions Variables Macros Pages
Functions
SaveImage.cpp File Reference

Source code for saving a noise cell as a PNG or TGA file. More...

#include <stdio.h>
#include "defines.h"

Functions

void Save2DNoise (float **cell, const int n, const float scale, const char *basefilename)
 

Detailed Description

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.

Function Documentation

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).

Parameters
cellPointer to array in which to store the noise.
scaleRescale by this to get in the range -1..1.
basefilenameRoot of the file name under which to store the noise.
nCell size.