Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Must I use draw2d or swt for my plugin ?
Must I use draw2d or swt for my plugin ? [message #8723] Sun, 09 June 2002 12:49 Go to next message
Eclipse UserFriend
Originally posted by: nicolas.barbe.ens.insa-rennes

Hi,

I am writting a plug-in with this features :
- it can display an image,
- it can create figures (rectangles and points),
- it can move these figures,
- we can drag and resize these figures with the mouse,
- we can zoom the view (the image and the figures are scalled automaticaly)
zoom is very important for this plugin
- we can use scrollbar to show another part of the view

Is it a good idea to use draw2D to implement these specifications or must I
create them directly using SWT ?
What is the easyest way ?

I believe that draw2D doesn't provide zoom, is that right ?

And the last question, is it possible to use transparency with SWT or draw2D
?

thanks

Nicolas Barb
Re: Must I use draw2d or swt for my plugin ? [message #184987 is a reply to message #8723] Tue, 21 June 2005 14:04 Go to previous message
Tom K. is currently offline Tom K.Friend
Messages: 22
Registered: July 2009
Junior Member
Nicolas Barbé wrote:
> Hi,
>
> I am writting a plug-in with this features :
> - it can display an image,
> - it can create figures (rectangles and points),
> - it can move these figures,
> - we can drag and resize these figures with the mouse,
> - we can zoom the view (the image and the figures are scalled automaticaly)
> zoom is very important for this plugin
> - we can use scrollbar to show another part of the view
>
> Is it a good idea to use draw2D to implement these specifications or must I
> create them directly using SWT ?
> What is the easyest way ?
>
> I believe that draw2D doesn't provide zoom, is that right ?
>
> And the last question, is it possible to use transparency with SWT or draw2D
> ?
>
> thanks
>
> Nicolas Barbé
>
>


As far as I now in draw2d is xor the kind of transparency... In swt you
can have transparency ..

final Image imgDuke = ImageLoader.loadImage("img/duke.gif");
Image img = ImageLoader.loadImage("img/ColoredMap_klein.jpg");

ImageData imageData = img.getImageData();

// for absolute transparency (see the backgorund of the Window System
use SWT.NO_BACKGROUND)
//final Canvas canvas = new Canvas(parent, SWT.NO_BACKGROUND);
final Canvas canvas = new Canvas(parent, SWT.NONE);

byte[] alphaValues = new byte[imageData.height * imageData.width];
for (int j = 0; j < imageData.height; j++) {
for (int i = 0; i < imageData.width; i++) {
alphaValues[j * imageData.width + i] = (byte) (255 - 255 * i
/ imageData.width);
}
}
imageData.alphaData = alphaValues;
final Image image = new Image(parent.getDisplay(), imageData);
canvas.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.drawImage(imgDuke, 200, 50);
e.gc.drawImage(image, 10, 10);
}
});


Cheers
Tom
Previous Topic:Filling Color in Figure!!!!
Next Topic:Cut/Copy/Paste problem within the GEF canvas
Goto Forum:
  


Current Time: Tue Jul 30 10:25:22 GMT 2024

Powered by FUDForum. Page generated in 0.03573 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top