void *pData |
Pointer to the image data. |
long lRows |
The image row dimension ( in pixels ). |
long lCols |
The image column dimension ( in pixels ). |
// This code demonstrates how to create a TIFF file
// that contains a 2048x2200 pixel gradient image.
#include <iostream>
#include "CTiffFile.h"
using namespace std;
using namespace arc;
int main()
{
unsigned short *pBuf = NULL;
unsigned short val = 0;
try {
//
// Create a new buffer and fill it with a gradient
//
pBuf = new unsigned short[ 2048 * 2200 ];
if ( pBuf == NULL )
{
cerr << "Error: failed to create buffer!" << endl;
exit( 1 );
}
for ( int r=0; r<2048; r++ )
{
for ( int c=0; c<2200; c++ )
pBuf[ c + r * 2200 ] = val;
val++;
if ( val >= 65535 ) val = 0;
}
//
// Write the buffer to a TIFF file
//
CTiffFile cTiff( "Image.tif" );
cTiff.Write( pBuf, 2048, 2200 );
}
catch ( std::exception &e )
{
cerr << "Exception Occurred: " << e.what() << endl;
}
catch ( ... )
{
cerr << "System Exception Occurred!" << endl;
}
}
© Astronomical Research Cameras, Inc.