Git Product home page Git Product logo

Comments (19)

circular17 avatar circular17 commented on May 27, 2024

Indeed, borders are to be scaled and also fonts.

from bgracontrols.

lainz avatar lainz commented on May 27, 2024

Do you still have access to that retina mac?

And is just scaling the units enough, no need to worry about anything else except for the final drawing to canvas?

from bgracontrols.

circular17 avatar circular17 commented on May 27, 2024

Yes.

For mouse events you need to adjust the coordinates for example, if you have stored the clicked area scaled. I think that is about everything.

from bgracontrols.

lainz avatar lainz commented on May 27, 2024

Ok.

from bgracontrols.

lainz avatar lainz commented on May 27, 2024

So almost everything is retina, cool =)

from bgracontrols.

circular17 avatar circular17 commented on May 27, 2024

Hmmm let's summarize.

Retina support: BCButton (except glyph), BCComboBox, BCSVGViewer, BCSVGButton, BCTrackbarUpDown, BGRAGraphicControl, BGRAShape, BGRAVirtualScreen

I guess if someone need one more, we can do that at this point.

Maybe doing PCPanel would be like a basic one to do.

from bgracontrols.

lainz avatar lainz commented on May 27, 2024

I think we can fix the retina stuff for the glyph, getting the right image size for the BCButton.

from bgracontrols.

circular17 avatar circular17 commented on May 27, 2024

Well for now the image is stretched. For backward compatibility, I think we need a new property. Either something like a zoom ratio / scaling mode / glyph size, so that we can provide an image with more pixels as Glyph but that would be drawn at the right proportion, or another Glyph property to hold the image with Retina definition.

from bgracontrols.

circular17 avatar circular17 commented on May 27, 2024

I imagine something like this:

  • add a RetinaGlyph property, that will be drawn at 50% of its size (on Retina that will be the actual resolution)
  • when drawing, prefer Glyph property for regular display and prefer RetinaGlyph for Retina
  • one can provide only RetinaGlyph or only Glyph, and it will be stretched if needed

For most glyph, one could just supply the RetinaGlyph. The scaling would be fine if the positions are at even coordinates (0, 2, 4, etc.)

Though that doesn't cover high DPI. Maybe be can add GlyphZoom property as well. If we set it to 2, then that would use the RetinaGlyph at its actual size on non Retina display. Though if DPI is 150%, i.e a zoom factor or 1.5, the stretched icons may not look perfect.

from bgracontrols.

lainz avatar lainz commented on May 27, 2024

What I think about is using the High DPI / retina image list. There are already an imagelist and imageindex properties. Just that is not grabbing the right resolution from the imagelist.

I think with that we can keep the code like actually is, don't touching the glyph property, and if someone wants high resolution can use already the high resolution imagelist =)

from bgracontrols.

circular17 avatar circular17 commented on May 27, 2024

Yeah we can keep things simple like that. Maybe we could just add a GlyphAutoscale property (by default True), so that one can disable it on Retina and provide the full-resolution glyph. That would be simple enough and still allow to use the accurate resolution.

And otherwise of course, use an image list.

from bgracontrols.

lainz avatar lainz commented on May 27, 2024

Good, yes that sounds good, I will try on weekend to implement the imagelist code, and I let you the glyph since I don't have retina display to test.

from bgracontrols.

lainz avatar lainz commented on May 27, 2024

I did the changes for bcbutton imagelist.

Basically if you have selected an image list as icon source for BCButton, it works the same as before, but if in the image list you turn on the scaling property, it gets the bigger images if the DPI is bigger. It should work as well on macOS.

Here a simple test project, base icon size is 16x16, I've added resolutions for 125%, 150%, 175% and 200%. The AutoSize property works as well.

test bcbutton imagelist.zip

If it doesn't find the resolution based on dpi and scale factor, I've seen that it draws the next smaller. So it works fine if you provide the resolutions, and since is an opt-in feature is backward compatible.

from bgracontrols.

circular17 avatar circular17 commented on May 27, 2024

Hi, thanks for the test project.

Well, the Retina part doesn't work. That's because the size is computed mostly ignoring Retina scaling. And then when rendering the glyph, the scaling must be set to 1 if the bitmap form the image list is upscaled.

I've fixed that, and also added code to compute the font size using Retina scaling. By the way the default size of 0 needed to be actually determined before scaling.

In the end, I've added a GlyphScale property. When set to 1, the glyph is drawn as before. One can set to 0.5 to draw it twice as small and provide a higher resolution image for Retina. Or one can set it to DPI/96 to apply a crude scaling. So for example, if you apply a style to a BCButton, you can scale it according to DPI as you would with other parameters.

from bgracontrols.

lainz avatar lainz commented on May 27, 2024

Thanks for fixing it =)

from bgracontrols.

circular17 avatar circular17 commented on May 27, 2024

Here is a test using it. I've also added ScaleStyle function to BCButton. In this case, it scales just the text margin, but it can scale everything.
bcimglist-glyphscale.zip

I am not sure if doing scaling like that is ok. What do you think?
Capture d’écran 2020-11-06 à 13 45 29
Capture d’écran_2020-11-06_13-47-50

from bgracontrols.

lainz avatar lainz commented on May 27, 2024

Sorry for the delay. It looks good in the image. I think everything should be scaled, all that's possible to scale, because is like zooming, so for me it's fine.

from bgracontrols.

circular17 avatar circular17 commented on May 27, 2024

Ok

from bgracontrols.

lainz avatar lainz commented on May 27, 2024

Thanks for all the controls with retina, I think is enough with them, the new SVG controls can replace many and these are already retina (button, image list) so I close this.

from bgracontrols.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.