Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Drawing an Image Tool
Drawing an Image Tool [message #139269] Tue, 22 June 2004 08:47 Go to next message
Eclipse UserFriend
Originally posted by: harshs.bsil.com

Hi,
i want to create a component that will draw the image in that bound. i
have created the structure but i am not able to see the picture as and
when i select the file from the open dialog box.
i have used ImageFigure object in my EditPart class........
Please advise

Regards,
Harsh Singal
Re: Drawing an Image Tool [message #139339 is a reply to message #139269] Tue, 22 June 2004 15:01 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
So, you create a new image based on the selected file and invoke
setImage(...) on that ImageFigure, right? What exactly is happening? Do
you see any exceptions in the log? A code snippet showing what you are
doing might help us pinpoint the problem.

"Harsh Singal" <harshs@bsil.com> wrote in message
news:cb8rno$a42$1@eclipse.org...
> Hi,
> i want to create a component that will draw the image in that bound. i
> have created the structure but i am not able to see the picture as and
> when i select the file from the open dialog box.
> i have used ImageFigure object in my EditPart class........
> Please advise
>
> Regards,
> Harsh Singal
>
Re: Drawing an Image Tool [message #139558 is a reply to message #139339] Wed, 23 June 2004 05:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harshs.bsil.com

the problem of creating the component is solved. now one new problem
arose.....
once i create the component in the file and save it and close the window.
and after that i again try to open the file i am not able to load the
component.
wat i have done is i have serialized the image and overriden writeObject
and readObject methods...........i have serialized it by getting the
pixels from the imageData using the getResourceAsStream
method................

Please advise if i am wrong somewhere
Regards,
Harsh Singal


Pratik Shah wrote:

> So, you create a new image based on the selected file and invoke
> setImage(...) on that ImageFigure, right? What exactly is happening? Do
> you see any exceptions in the log? A code snippet showing what you are
> doing might help us pinpoint the problem.

> "Harsh Singal" <harshs@bsil.com> wrote in message
> news:cb8rno$a42$1@eclipse.org...
> > Hi,
> > i want to create a component that will draw the image in that bound. i
> > have created the structure but i am not able to see the picture as and
> > when i select the file from the open dialog box.
> > i have used ImageFigure object in my EditPart class........
> > Please advise
> >
> > Regards,
> > Harsh Singal
> >
Re: Drawing an Image Tool [message #139801 is a reply to message #139558] Wed, 23 June 2004 19:40 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Do you care to give us a bigger picture of what you are trying to accomplish
here?

I am not sure what you are doing. Image and ImageData are not serializable,
and I don't know what getResourceAsStream() does (is this the one defined in
Class?). Trying to serialize an SWT Image sounds like trouble. Can't you
save the image as an image file? Where is this Image coming from in the
first place? I thought the user was selecting an image file from the
computer. Can't you just copy that file? You might want to try the
platform.swt newsgroup for help with Images.


"Harsh Singal" <harshs@bsil.com> wrote in message
news:cbb5g9$14q$1@eclipse.org...
> the problem of creating the component is solved. now one new problem
> arose.....
> once i create the component in the file and save it and close the window.
> and after that i again try to open the file i am not able to load the
> component.
> wat i have done is i have serialized the image and overriden writeObject
> and readObject methods...........i have serialized it by getting the
> pixels from the imageData using the getResourceAsStream
> method................
>
> Please advise if i am wrong somewhere
> Regards,
> Harsh Singal
>
>
> Pratik Shah wrote:
>
> > So, you create a new image based on the selected file and invoke
> > setImage(...) on that ImageFigure, right? What exactly is happening?
Do
> > you see any exceptions in the log? A code snippet showing what you are
> > doing might help us pinpoint the problem.
>
> > "Harsh Singal" <harshs@bsil.com> wrote in message
> > news:cb8rno$a42$1@eclipse.org...
> > > Hi,
> > > i want to create a component that will draw the image in that bound. i
> > > have created the structure but i am not able to see the picture as and
> > > when i select the file from the open dialog box.
> > > i have used ImageFigure object in my EditPart class........
> > > Please advise
> > >
> > > Regards,
> > > Harsh Singal
> > >
>
>
Re: Drawing an Image Tool [message #139839 is a reply to message #139801] Thu, 24 June 2004 04:22 Go to previous message
Eclipse UserFriend
Originally posted by: harshs.bsil.com

Hi Pratik,
thanx for your concern. actually the problem is solved now. the problem
was i was not serializing the image data. i overrid the readObject and
writeObject and grabbed the pixels.........
Now a new problem has taken place. Now i am not able to move the component
from one location to another at that particular time. but when i save the
image and again load it the image is moved to the new location where i
dragged it earlier before saving........
i have used correct role and policies for it......
can anyone please tell which method i have to use setLocation and setSize
methods for it.........

Regards,
Harsh Singal

Pratik Shah wrote:

> Do you care to give us a bigger picture of what you are trying to accomplish
> here?

> I am not sure what you are doing. Image and ImageData are not serializable,
> and I don't know what getResourceAsStream() does (is this the one defined in
> Class?). Trying to serialize an SWT Image sounds like trouble. Can't you
> save the image as an image file? Where is this Image coming from in the
> first place? I thought the user was selecting an image file from the
> computer. Can't you just copy that file? You might want to try the
> platform.swt newsgroup for help with Images.


> "Harsh Singal" <harshs@bsil.com> wrote in message
> news:cbb5g9$14q$1@eclipse.org...
> > the problem of creating the component is solved. now one new problem
> > arose.....
> > once i create the component in the file and save it and close the window.
> > and after that i again try to open the file i am not able to load the
> > component.
> > wat i have done is i have serialized the image and overriden writeObject
> > and readObject methods...........i have serialized it by getting the
> > pixels from the imageData using the getResourceAsStream
> > method................
> >
> > Please advise if i am wrong somewhere
> > Regards,
> > Harsh Singal
> >
> >
> > Pratik Shah wrote:
> >
> > > So, you create a new image based on the selected file and invoke
> > > setImage(...) on that ImageFigure, right? What exactly is happening?
> Do
> > > you see any exceptions in the log? A code snippet showing what you are
> > > doing might help us pinpoint the problem.
> >
> > > "Harsh Singal" <harshs@bsil.com> wrote in message
> > > news:cb8rno$a42$1@eclipse.org...
> > > > Hi,
> > > > i want to create a component that will draw the image in that bound. i
> > > > have created the structure but i am not able to see the picture as and
> > > > when i select the file from the open dialog box.
> > > > i have used ImageFigure object in my EditPart class........
> > > > Please advise
> > > >
> > > > Regards,
> > > > Harsh Singal
> > > >
> >
> >
Previous Topic:MarqueeSelectionTool
Next Topic:plugin Absoulate path
Goto Forum:
  


Current Time: Thu Apr 25 16:08:18 GMT 2024

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

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

Back to the top