-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo_image.cpp
More file actions
36 lines (28 loc) · 792 Bytes
/
demo_image.cpp
File metadata and controls
36 lines (28 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// To build
// clang++ -std=c++11 -I ~/github/TitanOpenGLKit/TitanOpenGLKit_osx/include/ -L ~/github/TitanOpenGLKit/TitanOpenGLKit_osx/lib/ demo_image.cpp -lfreeimageplus
//
#include <iostream>
#include "Image.h"
using namespace std;
int main(void){
static const unsigned int d = 500;
PNGImage the_image("red.png", d, d);
for(int i = 0; i < d; i++){
for(int j = 0; j < d; j++){
the_image.setPixel(i, j, 255, 0, 0, 255);
}
}
the_image.save( );
the_image = PNGImage("speckled.png", d, d);
for(int i = 0; i < d; i++){
for(int j = 0; j < d; j++){
if( i % 2 == 0 && j % 2 == 0 ){
the_image.setPixel(i, j, 0, 255, 0, 255);
}else{
the_image.setPixel(i, j, 255, 0, 0, 255);
}
}
}
the_image.save( );
return 0;
}