Skip to content

Conversation

@arunjose696
Copy link
Contributor

@arunjose696 arunjose696 commented Sep 15, 2025

It shall be possible to draw images at a custom zoom or size while maintaining the best achievable quality. To support this, images originating from an SVG source must be rasterized at the required size.

The internal API introduced in this PR enables loading SVGs at custom sizes, allowing images to be drawn at any requested zoom level or resolution, as discussed in in vi-eclipse/Eclipse-Platform#326

Goal It shall be possible to draw images at a custom zoom/size at the best achievable quality. This means either

  • rescaling from the most fitting zoomed version of the image that exists
  • rasterizing the image at the according size from an SVG source

This PR specifically adds the internal API to handle rasterization for images coming from SVG sources.

@laeubi
Copy link
Contributor

laeubi commented Sep 15, 2025

@arunjose696 can we please mirror the (relevant) information in the PR? Its always a bit hard to follow for others what are is discussed if it happens in another repository with a different organization.

*/
public ImageData rasterizeSVG(InputStream stream, int zoom) throws IOException;

public ImageData rasterizeSVG(InputStream stream, int width, int height) throws IOException;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add javadoc here, also if there are any limitations (e.g. what happens when size is negative).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added javadoc

@github-actions
Copy link
Contributor

github-actions bot commented Sep 15, 2025

Test Results

  118 files  ±0    118 suites  ±0   12m 8s ⏱️ + 1m 25s
4 439 tests +4  4 420 ✅ +2  17 💤 ±0  2 ❌ +2 
  298 runs  ±0    292 ✅  - 2   4 💤 ±0  2 ❌ +2 

For more details on these failures, see this check.

Results for commit 45dfe6c. ± Comparison against base commit 5d2665d.

♻️ This comment has been updated with latest results.

@HeikoKlare
Copy link
Contributor

@arunjose696 can you please fix the compilation errors?

Error:  D:\a\eclipse.platform.swt\eclipse.platform.swt\bundles\org.eclipse.swt\Eclipse SWT\common\org\eclipse\swt\internal\image\SVGFileFormat.java:[57] 
Error:  	} catch (IOException e) {
Error:  	         ^^^^^^^^^^^
Error:  Unreachable catch block for IOException. This exception is never thrown from the try statement body

@arunjose696 arunjose696 force-pushed the arunjose696/326/rasterizer branch 2 times, most recently from 74d2f86 to 2f57b89 Compare September 22, 2025 16:08
Copy link
Contributor

@HeikoKlare HeikoKlare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, the change looks good. I have rather minor comments.

@arunjose696 arunjose696 force-pushed the arunjose696/326/rasterizer branch 3 times, most recently from e56c37d to f916385 Compare September 24, 2025 09:39
Copy link
Contributor

@HeikoKlare HeikoKlare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks almost good to me. I just have minor comments left. Please check the formatting of the code again (I found some place where it seems inaccurate).

… and width

Adding internal API to SVGRasterizer and simple tests to see if the svgs
are loaded at right sizes by the rasterizer
@arunjose696 arunjose696 force-pushed the arunjose696/326/rasterizer branch from f916385 to 45dfe6c Compare September 24, 2025 12:04
@arunjose696
Copy link
Contributor Author

Looks almost good to me. I just have minor comments left. Please check the formatting of the code again (I found some place where it seems inaccurate).

Fixed formatting

@HeikoKlare HeikoKlare merged commit 8444ec7 into eclipse-platform:master Sep 24, 2025
15 of 17 checks passed
@HeikoKlare HeikoKlare deleted the arunjose696/326/rasterizer branch September 24, 2025 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rasterize the image at the according size from an SVG source

3 participants