Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SVG Transcoder] Remove plain template #383

Closed
bric3 opened this issue Mar 18, 2022 · 1 comment
Closed

[SVG Transcoder] Remove plain template #383

bric3 opened this issue Mar 18, 2022 · 1 comment
Assignees
Labels
6.0 - Iridium Release 6.0 - 2022.H2 Breaking change Marking changes that break backwards compatibility

Comments

@bric3
Copy link

bric3 commented Mar 18, 2022

Version of Radiance (latest development is 6.0-SNAPSHOT)

5.0.0

Sub-project (Common, Animation, Theming, Component, ...)

svg-transcoder

Version of Java (current minimum is 9)

11

Version of OS

macOs 12.3

The issue you're experiencing (expected vs actual, screenshot, stack trace etc)

The generated code with the plain template is incorrect as code has references to colorFilter :

// _0_0
shape = new Ellipse2D.Double(7.0, 7.0, 10.0, 10.0);
paint = (colorFilter != null) ? colorFilter.filter(new Color(0, 0, 0, 255)) : new Color(0, 0, 0, 255);
g.setPaint(paint);
g.fill(shape);

This field reference can be found in the Radiance template :

It's initialized there.

String setColorFilter = this.hasRasters
? "throw " + this.languageRenderer.getObjectCreation("UnsupportedOperationException") +
"(\"Color filters on raster content not supported\")"
: "this.colorFilter = colorFilter";
templateString = templateString.replace(TOKEN_SET_COLOR_FILTER,
setColorFilter + this.languageRenderer.getStatementEnd());

But it's not there in the plain template.

However the colorFilter is used regardless of the template.

"(" + languageRenderer.getNullableInvocation("colorFilter", "filter", colorParameter) + ")");

"(" + languageRenderer.getNullableInvocation("colorFilter", "filter", colorParameter) + ")");

languageRenderer.getNullableInvocation("colorFilter", "filter", colorParameter) +

languageRenderer.getNullableInvocation("colorFilter", "filter", colorParameter) +

@kirill-grouchnikov
Copy link
Owner

This is actually a good time to remove the plain template altogether.

That template is a more of a curiosity and would need additional app-side code to configure the size of the icon, for each icon - that is something that comes built-in with the RadianceIcon.

I don't really want to start having some sort of a feature-aware template system, where a template can specify (via command-line flags in any case, so no much of a system) which extra features it supports - such as color filtering. It's certainly possible to start with this one-off and not emit the color filtering instructions, but I don't want to go down that road.

In general, I view Radiance as a cohesive set of libraries, and bundling a plain template breaks that cohesion.

@kirill-grouchnikov kirill-grouchnikov changed the title SVG Transcoder emits invalid Java code with PLAIN template (incorrectly references colorFilter) [SVG Transcoder] Remove plain template Mar 18, 2022
@kirill-grouchnikov kirill-grouchnikov self-assigned this Mar 18, 2022
@kirill-grouchnikov kirill-grouchnikov added Breaking change Marking changes that break backwards compatibility 6.0 - Iridium Release 6.0 - 2022.H2 labels Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.0 - Iridium Release 6.0 - 2022.H2 Breaking change Marking changes that break backwards compatibility
Projects
None yet
Development

No branches or pull requests

2 participants