Bug 302518 - [ImageSupport] GraphicsToGraphics2DAdaptor#drawTextLayout(...) is not implemented
Summary: [ImageSupport] GraphicsToGraphics2DAdaptor#drawTextLayout(...) is not impleme...
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: 2.2   Edit
Hardware: PC Windows XP
: P3 major
Target Milestone: 2.3   Edit
Assignee: Alex Boyko CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 336523 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-02-10 17:20 EST by Alex Boyko CLA
Modified: 2011-02-20 13:15 EST (History)
3 users (show)

See Also:


Attachments
patch (5.02 KB, patch)
2010-02-10 17:20 EST, Alex Boyko CLA
no flags Details | Diff
corrected patch (2.60 KB, patch)
2010-02-10 17:35 EST, Alex Boyko CLA
no flags Details | Diff
patch (2.87 KB, patch)
2010-02-10 17:46 EST, Alex Boyko CLA
no flags Details | Diff
patch (7.23 KB, patch)
2010-02-10 18:28 EST, Alex Boyko CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Boyko CLA 2010-02-10 17:20:22 EST
Created attachment 158791 [details]
patch

GraphicsToGraphics2DAdaptor#drawTextLayout(...) is not implemented.
Hence, GMF fails to export to PNG, JPEG, SVG and PDF diagrams containing Arabic strings.

I had to add an extra method to ImageConverter to be able to generate AWT image based on ImageData to avoid generating another SWT image based on the image data updated with transparent pixel. (SWT image created from ImageData cannot be painted on)

Transparent pixel is set the current background color of the graphics object. Think this is the best we can do in terms of the transparent background. Otherwise, perhaps I should just set the transparent pixel to white?

Lidija, can you review this patch please?
Comment 1 Alex Boyko CLA 2010-02-10 17:35:17 EST
Created attachment 158793 [details]
corrected patch

Actually, i didn't need the transparent color - all I needed was to to call checkState() before painting the image, such that appliedState == currentState and all colors and attributes are up-to-date.
Here is the corrected patch - no new API required.
Comment 2 Alex Boyko CLA 2010-02-10 17:46:24 EST
Created attachment 158795 [details]
patch

Last change: added some unimplemented getters to GraphicsToGraphics2DAdaptor
Comment 3 Alex Boyko CLA 2010-02-10 18:28:13 EST
Created attachment 158801 [details]
patch

Lidija,
I tested other formats than a PDF and found that without transparent background the background for the text is white.
Therefore, I do set the transparent pixel == the pixel of the current graphics background color.
Also, added two methods in ImageConverter to convert AWT to/from buffered image from/to ImageData. These would be useful, because they don't require Display thread. That was the final change :-)

Anthony,
for GMF 2.3 plugin versions are supposed to be 1.3.0 correct? I changed the version of draw2d.ui.render.awt from 1.2.1 to 1.3.0 and added @since 1.3. Sounds good?
Comment 4 Anthony Hunter CLA 2010-02-11 12:22:34 EST
(In reply to comment #3)
> Created an attachment (id=158801) [details]
> patch
> 
> Lidija,
> I tested other formats than a PDF and found that without transparent background
> the background for the text is white.
> Therefore, I do set the transparent pixel == the pixel of the current graphics
> background color.
> Also, added two methods in ImageConverter to convert AWT to/from buffered image
> from/to ImageData. These would be useful, because they don't require Display
> thread. That was the final change :-)
> 
> Anthony,
> for GMF 2.3 plugin versions are supposed to be 1.3.0 correct? I changed the
> version of draw2d.ui.render.awt from 1.2.1 to 1.3.0 and added @since 1.3.
> Sounds good?

Yes, @since 1.3 and it should be 1.3.1 for now, here is why;

GMF Runtime in Galileo 3.5.2 SR2 is 1.3.0. It was a minor version change to indicate we made API additions in SR2 that clients needed. i.e. clients depending on the new API need to depend on bundle 1.3.0, if they used 1.2.x the API is not there.

Now draw2d.ui.render.awt has newer API since 3.5.2 SR2, so we need to make bundles 1.3.1, since the Runtime for Helios 3.6.0 is 1.3.1. 

According to the rules, new public API would should mean a minor version change to 1.4.0. @since 1.3 is not correct since the API was not in 1.3.0 of the bundle. I do not think this new API is needed by clients right? 

For now, make it 1.3.1 and I have flagged this issue in Bug 292918.
Comment 5 Lidija Grahek CLA 2010-02-11 12:28:01 EST
Alex, patch looks and works fine.
Comment 6 Alex Boyko CLA 2010-02-11 14:38:08 EST
Thanks, Lidija!
I set the plugin version as well as @since for 2 new methods to 1.3.1 as you adviced, Anthony.

Committed for 2.3
Comment 7 Eclipse Webmaster CLA 2010-07-16 23:38:08 EDT
[target cleanup] 2.3 M6 was the original target milestone for this
bug
Comment 8 Eclipse Webmaster CLA 2010-07-19 12:30:27 EDT
[GMF Restructure] Bug 319140 : product GMF and component Runtime Diagram was the original product and component for this bug
Comment 9 Aurelien Pupier CLA 2011-02-20 13:15:38 EST
*** Bug 336523 has been marked as a duplicate of this bug. ***