troubles with scale_x & scale_y

Posted By: hopfel

troubles with scale_x & scale_y - 08/17/10 22:16

Hi dear community,

I feel a bit discouraged because I'm to stupid to scale a panel the right way. o.0

I used this little code in one of my functions in my script:

Code:
my_panel.scale_x=12;
my_panel.scale_y=12;



But this happened ingame to my 16*16 panel:



The border should be constant, but here it's deformed.
And it's really just the border, the middle of the panel is scaled right.
This happens with other panels too. I really don't know what the problem could be like...

Anyone an idea?
Posted By: Superku

Re: troubles with scale_x & scale_y - 08/18/10 04:31

The reason could be that the scale parameters only have a valid range from -10 to 10.
Posted By: hopfel

Re: troubles with scale_x & scale_y - 08/18/10 11:24

The same thing happens with a value from 2 to 10 too. -.o'
Looks like I have to write a scale-function myselfe. smirk
Posted By: EvilSOB

Re: troubles with scale_x & scale_y - 08/18/10 12:37

Nah, just think it through.
I'll try to explain though, its not easy.
[sticking to 'square' scaling for simplicity]

If scales are at 1.0, all pixels are 1x1 in size.
If scales are at 2.0, all pixels are 2x2 in size.
If scales are at 3.0, all pixels are 3x3 in size.
etc...

BUT!!!
If scales are at 1.5, SOME pixels are 1x1, and some are 2X2,
because you cant make a pixel 1.5x1.5

SO.
If you lock your scales to ONLY INTEGERS, the problem will go away.
But the higher your scale gets, the 'chunkier' each step will become...

Get what I mean?
Posted By: MrGuest

Re: troubles with scale_x & scale_y - 08/18/10 13:06

Originally Posted By: EvilSOB
Nah, just think it through.
I'll try to explain though, its not easy.
[sticking to 'square' scaling for simplicity]

If scales are at 1.0, all pixels are 1x1 in size.
If scales are at 2.0, all pixels are 2x2 in size.
If scales are at 3.0, all pixels are 3x3 in size.
etc...

BUT!!!
If scales are at 1.5, SOME pixels are 1x1, and some are 2X2,
because you cant make a pixel 1.5x1.5

SO.
If you lock your scales to ONLY INTEGERS, the problem will go away.
But the higher your scale gets, the 'chunkier' each step will become...

Get what I mean?


AFAIK he is using integers?

just tested it, and having the same issue when scaling with integers, possible temp fix
Code:
pnl.size_x--;pnl.size_y--;

?
Posted By: bart_the_13th

Re: troubles with scale_x & scale_y - 08/18/10 13:37

Maybe it has something to do with pnl.center_x and center_y?
Posted By: hopfel

Re: troubles with scale_x & scale_y - 08/18/10 14:01

First thanks for all responses!

@EvilSOB: How MrGuest said, I'm already using integer. wink
@MrGuest: It's for the zoom-function of a little paint-program. So the only possible temp fix for me is to make an own scale-function using pixel-functions...
@bart_the_13th: No, it hasn't. grin
Posted By: Quad

Re: troubles with scale_x & scale_y - 08/18/10 14:24

maybe try using powers of 2?
2 4 16 32 etc (disregard the +10 limit)
Posted By: hopfel

Re: troubles with scale_x & scale_y - 08/18/10 14:47

It begins already at 2 to deform... o.-'
Posted By: Quad

Re: troubles with scale_x & scale_y - 08/18/10 15:01

in that case are you sure it's 16x16 and not 16x17 or 16x15 ?
Posted By: hopfel

Re: troubles with scale_x & scale_y - 08/18/10 15:07

The pictures in the picture in the startpost (lol) are the exactly copies from a screenshot of my game.
btw. the little one is 16*16 and the bigger one is 192*192.
But it should be the same with a non-quadrat, I guess.
© 2024 lite-C Forums