Capture screen without opening shell

V

vicky

Hi All!

I am developing a plugin for eclipse, in which i need to draw a
diagram on shell without opening the shell and then i have to take a
screenshot of that diagram as an image(BMP, PNG or GIF).

I am able to draw the diagram on shell without opening it but when i
capture the screen of this hidden diagram it is different than the
original one.

Here is the code:

// read information from Data.txt and then add child figures to the
base figure
IFigure fig = Obj.getBaseFigure("Data.txt", userAction);

Rectangle rect = fig.getBounds();
Image image = new Image(composite.getDisplay(), 1024, 562);//
rect.width, rect.height)

GC gc = new GC(image);
Font fnt = gc.getFont();
fig.setFont(fnt);

SWTGraphics graphics = new SWTGraphics(gc);
composite.getShell().layout();

fig.paint(graphics);// paint the diagram.

ImageUtils.saveImage(image, "c:/Image.jpg", SWT.IMAGE_JPEG);//It gives
me a different img.

image.dispose();
graphics.dispose();
gc.dispose();




Org Fig: (it is textual image, two rectangles are joined with a lined)
___________________
----|__________________ |
|
| ___________________
----------- |__________________ |



recvd Image: size of rects has been increased, instead of line in
org image it displays a slant angled line
___________________
| |
\ |__________________ |
\
\ ___________________
\ | |
|__________________ |
 

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top