DrawableButton::ImageFitted needs a small tweak?


#1


It seems that because ImageFitted centre the image, the path will be blured if the button width and height are not a factor of 2.
Not sure what's the best thing to do about it .. 
perhaps you could remove 0.5 on each side before resizing?


#2

hum.. wait, that's not the cause right?

it just seem I can't get my simple path always pixel aligned, it changes when I resize the button. not sure what I can do about that.

 


#3

You can't assume that 1 unit = 1 pixel any more. Your window may be running at any kind of scaled resolution, so that even if you align the pixels by their number, they don't necessarily align with whole pixels. That's why vector graphics or higher-res images are the smart way to do your graphics nowadays.


#4

ok, but (sorry for the basic question), i'm just drawing a path, isn't that part of what is called vector graphics ?

to be sure every thing is aligned, how would I go to draw such a simple path as that in a button in a vector graphic way ?

or is that just that I can't be sure in will be perfectly aligned when resized?

    static const unsigned char pathData[] = { 110,109,0,0,0,66,4,112,185,62,108,0,0,0,66,0,151,139,64,98,112,20,186,65,0,151,139,64,0,0,160,64,0,151,139,64,0,0,160,64,0,151,139,64,108,0,0,160,64,0,46,23,64,98,0,0,160,64,0,46,23,64,39,174,21,64,0,46,23,64,0,0,0,64,0,46,23,64,98,58,65,249,63,105,15,
        145,64,0,0,0,64,198,209,193,64,0,0,0,64,128,203,5,65,98,148,20,76,64,128,203,5,65,0,0,160,64,128,203,5,65,0,0,160,64,128,203,5,65,98,0,0,160,64,0,151,235,64,0,0,160,64,0,151,203,64,0,0,160,64,0,151,203,64,98,0,0,160,64,0,151,203,64,225,36,182,65,0,151,
        203,64,0,0,0,66,0,151,203,64,108,0,0,0,66,128,203,37,65,98,0,0,0,66,128,203,37,65,68,196,23,66,25,13,171,64,0,0,24,66,255,150,171,64,99,101,0,0 };


 

svg path :
"m 32,0.36218274 0,3.99999986 c -8.740021,0 -27,0 -27,0 l 0,-2 c 0,0 -2.6612457,0 -3,0 -0.052697,2.1709486 0,3.6946747 0,6 1.1887561,0 3,0 3,0 0,-1 0,-2 0,-2 0,0 17.768007,0 27,0 l 0,4.0000004 c 0,0 5.941666,-5.0168338 6,-5.0000004 z"

 

 

 


#5

(Sorry, for some reason I thought you were talking about images..)

Well, it's easier with paths, but really the same thing applies no matter how the pixels were generated - it's really optimistic to expect to be able to align the pixels when you've no idea what scale will be getting applied before it hits the screen. Especially on Windows, the desktop scale will often be a non-integer multiple.