Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Add png as an emf resource?
Add png as an emf resource? [message #675116] Mon, 30 May 2011 11:02 Go to next message
js Missing name is currently offline js Missing nameFriend
Messages: 73
Registered: July 2009
Member
I have created an ecore model and generated the corresponding code. I have also tested that an instance of the full model can be written to disk and loaded back into my RCP application.

Now I need to add some images resources (typically .png files specified by the user) which must be included when the model is saved/loaded. But I can't seem to find any info on how to use emf resources (ResourceSet) to embed images.

Any hints or links to examples/documentation for this?
(no subject) [message #675214 is a reply to message #675116] Mon, 30 May 2011 15:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Do you want to save the bytes for the image itself or save a reference
to the location of the image file? If the former, you'll need to define
an EDataType that can convert the image to a String and back again. The
latter just involves saving the name of the file...


js wrote:
> I have created an ecore model and generated the corresponding code. I
> have also tested that an instance of the full model can be written to
> disk and loaded back into my RCP application.
>
> Now I need to add some images resources (typically .png files
> specified by the user) which must be included when the model is
> saved/loaded. But I can't seem to find any info on how to use emf
> resources (ResourceSet) to embed images.
>
> Any hints or links to examples/documentation for this?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: (no subject) [message #675394 is a reply to message #675214] Tue, 31 May 2011 11:40 Go to previous messageGo to next message
js Missing name is currently offline js Missing nameFriend
Messages: 73
Registered: July 2009
Member
Does emf offer any image2String - string2Image methods?

I have also tried to look into swt:

    Image image = new Image(display, "C:/sample_image.png");
    ImageData imageData = image.getImageData();
    //imageData.convertToString() ??



Any suggestion for libraries convert to a string before I add it as an resource?
Re: (no subject) [message #1731385 is a reply to message #675394] Wed, 04 May 2016 20:00 Go to previous message
Dinko Ivanov is currently offline Dinko IvanovFriend
Messages: 27
Registered: July 2009
Junior Member
Hi,

I've recently come across the same scenario: I'd like to store an image into the EMF model.
Is it really needed to introduce and use a new Data Type - I see that there's an EByteArray type, which might be convenient in that case. What do you think?

In general my feeling is that an Image should only exist in certain graphics context and not be part of the model itself. What is the best practice when it comes to embedding non-EMF objects?

Best Regards,
Dinko
Previous Topic:PDE-Exporting makeithappen
Next Topic:[EMFStore] Support for multiple workspaces
Goto Forum:
  


Current Time: Fri Mar 29 13:18:22 GMT 2024

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

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

Back to the top