Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 325204

Summary: RAP: Use PNG renderer
Product: [Tools] MAT Reporter: Andrew Johnson <andrew_johnson>
Component: GUIAssignee: Andrew Johnson <andrew_johnson>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 1.1   
Target Milestone: 1.14.0   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/c/mat/org.eclipse.mat/+/199996
https://git.eclipse.org/c/mat/org.eclipse.mat.git/commit/?id=fed0ec3ee84a069e3d11980d8fc185b055572090
Whiteboard:
Bug Depends on:    
Bug Blocks: 262603    

Description Andrew Johnson CLA 2010-09-14 04:34:16 EDT
From bug 262603:
* Charts: Rewrote to use PNG renderer instead of SWT. This was necessary as RAP
does not support a full-fledged GC to support all BIRT needs. Instead of
drawing the chart onto a canvas, we now just create the image file and use a
Label to display it.
Comment 1 Andrew Johnson CLA 2023-02-19 03:00:31 EST
Using the changes in https://bugs.eclipse.org/bugs/attachment.cgi?id=187550&action=diff#src/org/eclipse/mat/ui/internal/chart/ChartCanvas.java_sec1 as a guide this can be done.

Modifications - RAP now has paint events, so that doesn't need to be changed.
renderer.setProperty(IDeviceRenderer.FILE_IDENTIFIER can now take an OutputStream as well as a File, so we can use a ByteArrayOutputStream and avoid the temporary file.

To aid single sourcing, we can try the dv.SWT renderer first, then if that fails go to dv.PNG and do the RAP processing. The org.eclipse.birt.chart.device.swt bundle can be optional - so the code can work as before with RCP.

As with the example patch, setting the background image on the canvas works - no need for a label.

Limitation - with the PNG renderer there is no hover selection of a item in the pie chart as inspector view item.
Comment 2 Eclipse Genie CLA 2023-02-19 03:04:40 EST
New Gerrit change created: https://git.eclipse.org/r/c/mat/org.eclipse.mat/+/199996