My system is Mac Mini OSX Snow Leopard, of_preRelease_v0061_osxSL_FAT
I draw something with the mouse on the screen.
Then I grab the drawing with ofImage.
Then I try to draw, what I grabbed.
The problem is the following:
I draw a circle of radius 10.
Then I grab this part of the screen (say 100x100 pixels).
Then I draw the grabbed part of the screen somewhere else.
If the circle is red and 10 pixels in size, the grabbed part when drawn is a red square of size 100.
I don’t know why this happens. It looks like the ofImage only captures the color?
Yes I know that i can duplicate the screen easier with ofTexture, but I need to access the pixel data and this is only possible with ofImage.
Hm, cannot upload sample so I paste it at the end of this message …
Hopefully someone knows what I am doing wrong.
Regards,
vhantom
--------- sample testapp ----------------------
#ifndef _TEST_APP
#define _TEST_APP
#include “ofMain.h”
class testApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
ofImage image;
};
#endif
#include “testApp.h”
void testApp::setup(){
ofSetCircleResolution(50);
ofBackground(255,255,255);
ofSetFrameRate(30);
ofSetColor(255,0,0);
ofFill();
}
void testApp::update(){
}
void testApp::draw(){
ofCircle(0, 0, 3);
image.grabScreen(0, 0, 20, 20);
image.draw(50, 50);
}
void testApp::keyPressed(int key){}
void testApp::keyReleased (int key){}
void testApp::mouseMoved(int x, int y ){}
void testApp::mouseDragged(int x, int y, int button){}
void testApp::mousePressed(int x, int y, int button){}
void testApp::mouseReleased(int x, int y, int button){}
void testApp::windowResized(int w, int h){}