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

background documentation and opacity support #969

Merged
merged 7 commits into from
Jan 21, 2024
Merged

background documentation and opacity support #969

merged 7 commits into from
Jan 21, 2024

Conversation

mmatera
Copy link
Contributor

@mmatera mmatera commented Jan 20, 2024

This PR adds the entry for Background in the documentation and provides support for opacity in SVG and json graphics.

>> Graphics3D[{Arrow[{{0,0,0},{1,0,1},{0,-1,0},{1,1,1}}]}, Background -> Red]
= -Graphics3D-

Other values for this option are neglected. For example, this prevent to
Copy link
Member

Choose a reason for hiding this comment

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

For soft line breaks add \ at the end of the line in the above and below line.

@rocky
Copy link
Member

rocky commented Jan 20, 2024

Looks good. It would be nice to add a test in test/format/svg/test_svg.py

@mmatera
Copy link
Contributor Author

mmatera commented Jan 20, 2024 via email

@rocky
Copy link
Member

rocky commented Jan 20, 2024

https://github.com/Mathics3/mathics-core/blob/master/test%2Fbuiltin%2Fdrawing%2Ftest_plot.py#L39. Here El sáb, 20 de ene de 2024, 4:13 p. m., R. Bernstein < @.> escribió:

@.
* commented on this pull request. ------------------------------ In mathics/builtin/drawing/drawing_options.py <#969 (comment)> : > @@ -78,6 +78,32 @@ class Axis(Builtin): summary_text = "graph option value to fill plot from curve to the axis" +class Background(Builtin): + """ + :WMA link:https://reference.wolfram.com/language/ref/Background.html + +

+
'Background' +
is an option that specifies the color of the background. +
+ + The specification must be a 'Color' or 'Automatic': + + >> Graphics3D[{Arrow[{{0,0,0},{1,0,1},{0,-1,0},{1,1,1}}]}, Background -> Red] + = -Graphics3D- + + Other values for this option are neglected. For example, this prevent to This is done already. I am not seeing any changes in https://github.com/Mathics3/mathics-core/pull/969/files any changes to test/format/test_asy.py — Reply to this email directly, view it on GitHub <#969 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAV2ZUGUEJEVHMR5NXEACWLYPQJMBAVCNFSM6AAAAABCCX6FROVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQMZUG4ZDANBZGA . You are receiving this because you authored the thread.Message ID: @.***>

Two things. I don't see any opacity parameter or alpha channel parameter in the example. Second, unit testing at a smaller level, i.e. inside test/format/test_asy.py is easier to deal with and tends to make it easier to pinpoint problems because the tests are more focused.

else:
from mathics.core.parser import parse_builtin_rule

default = {}
for option, value in self.options.items():
option = ensure_context(option)
default[option] = parse_builtin_rule(value)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is needed to make some of the low-level tests work, especially when an Evaluation object is not available.

@rocky
Copy link
Member

rocky commented Jan 21, 2024

Looks great now. Merge whenever you are done/satisfied.

@mmatera mmatera merged commit e65d661 into master Jan 21, 2024
11 checks passed
@mmatera mmatera deleted the background branch January 21, 2024 14:46
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.

2 participants