[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Native PyGame method for automatically scaling inputs to a surface resolution?



On Fri, 30 Sep 2011 09:19:12 -0400
Christopher Night <cosmologicon@xxxxxxxxx> wrote:

> Well pixels are just the simplest example. The ambiguity exists for
> all drawing functions, not just set_at. For instance, should a
> horizontal line extending from (10, 99.6) to (90, 99.6) appear on the
> 100x100 screen or not? So I don't think that forbidding set_at solves
> it.

If you are going to use scaled surface you *must* specify the dimension
of what you are drawing. Precisely as you can see the great wall of
Chine from a low orbit but you can't from the moon, so you should be
able to see a line only if its thickness is larger than half of the
"mapped" size of a pixel.

But this is nothing new: try to draw a line of thickness 1 and to
smoothscale it down 10 times: you won't see it [or you will see a very
faint colour simulating the 10% of a pixel].

You could automatize some of the functions by stating for example that
"set_at" assumes a square of side 1/scale, or that a draw_line without
a thickness parameter assumes tickness is 1/scale...

However, if you are going to draw something that does need not to be
scaled, it would be a better solution (at least IMO) to simply bit a
non-scaled image on the scaled one.

> If you're going to say that lines are 1-dimensional and thus
> infinitely smaller than pixels, and thus we're obliged to draw a thin
> rectangle whenever we want a line, then (a) I probably would not use
> the tool if it doesn't even support drawing lines, and (b) consider
> the filled, closed polygon from (10, 99.6) to (90, 99.6) to (50,
> 200). Would drawing that cause any pixels on the 100x100 screen to be
> lit up or not?

About (b): maybe I am missing the point as it seems obvious to me that
it shouldn't. Unless you want to do something like smoothscale does (and
thus using intensity as a mean to simulate fractions of a pixel) all the
points, once scaled, are outside the surface... did I misunderstand you?

/mac