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

Best effort for pixel perfect icon rendering #4552

Merged
merged 6 commits into from
May 18, 2024

Conversation

Noisyfox
Copy link
Collaborator

@Noisyfox Noisyfox commented Mar 18, 2024

This currently requires the toolbar icon to have even size.

Fixes #4328

Before:
icon_before

After:
icon_after

Toolbar icons should be noticeably sharper.

@yw4z
Copy link
Contributor

yw4z commented Mar 18, 2024

thanks for your efforts on this, i will report results
This problem also appears on popup windows of toolbar. especially on these places

  • Emboss > alignment icons
  • Emboss > buttons near Style dropdown menu
  • Other > Keyboard cheat sheet button
    i guess emboss popup aligns to right of window and bottom of window. icons looks blurry vertically and horizontally

@Noisyfox
Copy link
Collaborator Author

thanks for your efforts on this, i will report results This problem also appears on popup windows of toolbar. especially on these places

  • Emboss > alignment icons
  • Emboss > buttons near Style dropdown menu
  • Other > Keyboard cheat sheet button
    i guess emboss popup aligns to right of window and bottom of window. icons looks blurry vertically and horizontally

Not sure if I could do anything about these.

@Noisyfox
Copy link
Collaborator Author

@yw4z Also I've noticed your comment about icon size using odd numbers #4368 (comment)

Technically you're right but some of the existing code make the assumption that icon sizes are in even numbers and I'm not sure how well it might behave.

If you are planing to use icons with odd numbers, could you try using the binary of this PR and replace with your icons and see if they work well?

@yw4z
Copy link
Contributor

yw4z commented Mar 19, 2024

No i didnt changed their resolution to reduce code changes
Screenshot-20240319054512
mostly they have blank 1px line 2 sides
I'm adding all required changes in that commit as a to-do list. still changing things but big part of work is done

@yw4z
Copy link
Contributor

yw4z commented Mar 23, 2024

@Noisyfox changing this line to int fixed issue for toolbar popup icons. they are pixel perfect now :)

float offset_y = (line_height - s.y) / 2;

included this to my UI commit

@Noisyfox
Copy link
Collaborator Author

@Noisyfox changing this line to int fixed issue for toolbar popup icons. they are pixel perfect now :)

float offset_y = (line_height - s.y) / 2;

included this to my UI commit

Popups? Did you mean those gizmo panels?

@yw4z
Copy link
Contributor

yw4z commented Mar 23, 2024

yes also fixed blur on keyboard cheat sheet button

@discip
Copy link
Contributor

discip commented May 3, 2024

@SoftFever
Since #4368 has been implemented, this PR should too. 😊
Otherwise the icons look somewhat blurry under Linux (Manjaro GNOME).

@yw4z
Copy link
Contributor

yw4z commented May 4, 2024

@Noisyfox @SoftFever
here is my observations with code changes. i compiled with this changes

trying to make icons pixel perfect is unnecessary with scaling imo. i guess only necessary change is this line because icons already not supports lower resolutions
7673 const int offset = (cnv_width - toolbar_total_width) / 2;

other solutions for preventing scaling on icons

• Removing separators. this will reduce total with -40 px of toolbar
commented lines these lines to remove separators

    //if (!_init_separator_toolbar())
    //    return false;

Here is comparison with / without separators
Screenshot-20240504150458

• Reducing size of left spacing between sidebar toggle and toolbar

• Moving sidebar toggle to top bar. i guess this change will make a huge difference but requires more code changes

• Moving sidebar toggle to vertically center and exclude from toolbar calculations. Removing sidebar toggle from toolbar calculations saves additional 50px before triggering scaling. i added 2 lines for excluding and preventing rendering toggle button
Screenshot-20240504153139

after removing sidebar toggle, separators & left and right spacers. total width reduced by 110px. so scaling not starts before that
Screenshot-20240504165429

Preview of sidebar toggle with vertically centered (not included to code changes)
Screenshot-20240504165903

i didnt commited because tried completely different route. respect for your efforts
some changes can be made with less code
i tried to go with experimental way on my branch https://github.com/yw4z/OrcaSlicer/tree/toolbar-width-fix

@Noisyfox
Copy link
Collaborator Author

Noisyfox commented May 6, 2024

Moving sidebar toggle to vertically center and exclude from toolbar calculations.

This does look better.
One sidenote: make sure this won't overlap with the plate list on the preview view.

@discip
Copy link
Contributor

discip commented May 6, 2024

@yw4z
@Noisyfox

What about moving the arrow to the top, but without protruding into the workspace?
Something like this:
image
Maybe the design could be adjusted according to the theme.

@Noisyfox
Copy link
Collaborator Author

Noisyfox commented May 6, 2024

@yw4z @Noisyfox

What about moving the arrow to the top, but without protruding into the workspace? Something like this: image Maybe the design could be adjusted according to the theme.

That's not supported yet.

@discip
Copy link
Contributor

discip commented May 6, 2024

That's not supported yet.

That's a pity.

Copy link
Owner

@SoftFever SoftFever left a comment

Choose a reason for hiding this comment

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

Looks good
Thank you

@SoftFever SoftFever merged commit ba3016b into SoftFever:main May 18, 2024
12 checks passed
@yw4z yw4z mentioned this pull request Jul 23, 2024
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.

Toolbar icons blurry
4 participants