Initial source commit
This commit is contained in:
commit
f1384c11ee
335 changed files with 52715 additions and 0 deletions
44
minorGems/graphics/converters/testPNG.cpp
Normal file
44
minorGems/graphics/converters/testPNG.cpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
#include "PNGImageConverter.h"
|
||||
|
||||
#include "minorGems/graphics/Image.h"
|
||||
|
||||
#include "minorGems/io/file/FileOutputStream.h"
|
||||
|
||||
#include "minorGems/system/Time.h"
|
||||
|
||||
|
||||
int main() {
|
||||
|
||||
int imageSize = 640;
|
||||
Image testImage( imageSize, imageSize, 3, false );
|
||||
|
||||
|
||||
// red fades toward bottom
|
||||
// green fades toward right
|
||||
double *red = testImage.getChannel( 0 );
|
||||
double *green = testImage.getChannel( 1 );
|
||||
|
||||
for( int y=0; y<imageSize; y++ ) {
|
||||
for( int x=0; x<imageSize; x++ ) {
|
||||
red[y*imageSize+x] = 1.0 - ( y / (double)imageSize );
|
||||
green[y*imageSize+x] = 1.0 - ( x / (double)imageSize );
|
||||
green[y*imageSize+x] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
PNGImageConverter png;
|
||||
|
||||
|
||||
File outFileB( NULL, "test.png" );
|
||||
FileOutputStream outStreamB( &outFileB );
|
||||
|
||||
|
||||
double t = Time::getCurrentTime();
|
||||
|
||||
png.formatImage( &testImage, &outStreamB );
|
||||
|
||||
printf( "Converter took %f seconds\n",
|
||||
Time::getCurrentTime() - t );
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue