Add ScalingCanvas and #canvasScaleFactor for OSWorldRenderer#15647
Merged
Ducasse merged 53 commits intopharo-project:Pharo12from Dec 2, 2023
Merged
Add ScalingCanvas and #canvasScaleFactor for OSWorldRenderer#15647Ducasse merged 53 commits intopharo-project:Pharo12from
Ducasse merged 53 commits intopharo-project:Pharo12from
Conversation
… with an additional parameter ‘scale’.
…the canvas returned by its #getCanvas method.
…ethrough:strikethroughColor: on ScalingCanvas delegate to a corresponding method on FormCanvas that takes the ‘scale’ as an additional parameter.
…s passed to the block is another ScalingCanvas.
…nding method on FormCanvas that takes the ‘scale’ as an additional parameter.
…ngCanvas so that the canvas passed to the block is another ScalingCanvas if the transform is a pure translation.
…uring: on ScalingCanvas so that in each the canvas passed to the block is another ScalingCanvas.
…ITheme and ThemeIcons to the corresponding scale 2 form.
…graph, but not the surrounding decorators, by delegating to a corresponding method on FormCanvas that takes the ‘scale’ as an additional parameter.
…rColor: on ScalingCanvas so that, when the border width is 0, the use of #apply: is avoided as it affects translucent colors (note: Pharo issue pharo-project#14654 is taken into account here to prevent a VM crash for the large rectangles derived from the value of #defaultMaxExtent in RubAbstractTextArea).
…hes used by HandMorph so that the patches are no longer scaled down when saved and scaled back up when restored.
…ners, #drawImageOn:at: and #paintImageOn:at: on ScalingCanvas.
…direct transformations of the corresponding values from the FormCanvas.
…Color and #shadowColor: on ScalingCanvas as direct delegations to the FormCanvas.
…fillColor:scale:drawBlock:do: from the #example for ScalingCanvas.
…:fillColor:borderWidth:borderColor: on ScalingCanvas to take into account that the rectangle can have nonintegral coordinates.
… there is no mapping in ‘FormMapping’ by scaling the form so as to avoid the use of #apply: as that affects translucent colors, made the method also take into account that the point can be nonintegral, and extended the class with the implementations from Canvas for #paintImage:at: and #paintImage:at:sourceRect: to cancel out the overrides of PluggableCanvas.
…ceRect:rule: to its #stencil:at:sourceRect:color: as well.
…ont:color:underline:underlineColor:strikethrough:strikethroughColor: on ScalingCanvas to take into account that the given bounds rectangle can have nonintegral coordinates.
…n:font:color:underline:underlineColor:strikethrough:strikethroughColor:scale: and #paragraph:bounds:color:scale: on FormCanvas to a protocol ‘scaled drawing’.
…erer so that, when set to a value other than 1, the world is drawn on a scaled form using a ScalingCanvas.
de42f45 to
ded8b0b
Compare
…cCoreDependencies on SystemDependenciesTest to changes in commit c2f51fe (“Merged ScalingCanvas, and […]”).
Member
|
Thanks Kris we really appreciate all your work this is really cool. |
Contributor
Author
|
Thanks! 😄 |
This was referenced Dec 2, 2023
Rinzwind
added a commit
to Rinzwind/pharo
that referenced
this pull request
Dec 3, 2023
…nvas and #canvasScaleFactor for OSWorldRenderer”) to Pharo 11.
Contributor
Author
|
I updated the Pharo 11 backport: branch ‘scaling-canvas-tryout-15-pharo11’ (commit 8803946). I could open a pull request for that as well if desired. |
This was referenced Dec 4, 2023
This was referenced Jan 28, 2024
Rinzwind
added a commit
to Rinzwind/pharo
that referenced
this pull request
Aug 31, 2024
…mmit f048494 (“Merge pull request pharo-project#15647 […] Add ScalingCanvas and #canvasScaleFactor for OSWorldRenderer”): the extent of the form passed to the renderer needs to be scaled by the factor used by the canvas in #getCanvas on OSWindowFormRenderer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request:
#canvasScaleFactorfor OSWorldRenderer which determines the scale of the Form used to draw a WorldMorph. The world is drawn on a ScalingCanvas, instead of directly on a FormCanvas, when the setting is set to a value other than 1.The screenshots listed in pull request #15561 show the effect of setting the
#canvasScaleFactorto 2 on Macs with a ‘Retina display’.The
#canvasScaleFactorcan be set through the Settings Browser so that it can also be saved to disk:Note that pull request #15561 mentions doing
World scaleFactor: 0.5as a way to use ScalingCanvas, but this no longer applies as the#canvasScaleFactorhas been separated from the world#scaleFactor. The two factors can be set independently. Though on Macs with a ‘Retina display’, it seems best to set them so that the multiplication of the#canvasScaleFactorby the reciprocal of the#scaleFactoris 2. The following cycles through such combinations:A few methods are refactored on FormCanvas to offer a ‘scale’ parameter for use by a ScalingCanvas. As previously mentioned, it might be better to turn ScalingCanvas into a subclass of FormCanvas. The FormMapping that is used in ScalingCanvas needs to be removed but is still needed because icons are not yet consistently represented as a FormSet with a Form for more than one scale. The
#canvasScaleFactoris global while it might be better to have a separate factor per world. These and any other necessary improvements can however be left to ‘future work’; merging this now will make it easier for others to give it a try.I will update the Pharo 11 backport when this pull request is merged.