froussel / u8glib

Automatically exported from code.google.com/p/u8glib
Other
0 stars 0 forks source link

Suggested x scaling function #249

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Can I suggest adding a setxscale function. Not all displays have square pixels, 
or at least are on a square grid - I have just found this to be the case with 
the Nokia 5110. Circles are rendered as ellipses. To get circles I have to draw 
ellipses with the x-axis scaled by 1.2, but of course I have to apply this to 
all drawing functions as well, such as lines, polygons, etc. A setxscale 
function would allow this lack of orthogonality to be transparent.

Suggest void setXScale(uint8_t scale = 10) where no scaling = 10, 12 = 120% etc.

In some apps this is important. I have just done a demonstrator for a client 
that controls hydraulic rams for a platform leveller. The user display includes 
a simulated bubble level - concentric circles and a dot that moves about with 
some text and other graphics scattered about. Looks somewhat noddy with 
ellipses and not circles, but the code to make the circles is unnecessarily 
complicated.

Original issue reported on code.google.com by john.fit...@gmail.com on 1 Apr 2014 at 3:39

GoogleCodeExporter commented 9 years ago
How do I make this a suggestion and not a defect? I saw no option when I 
created the issue.

Original comment by john.fit...@gmail.com on 1 Apr 2014 at 3:41

GoogleCodeExporter commented 9 years ago
Thanks for the enhancement requrest (also changed the issue type... you have to 
delete "defect" up to the dash).

However, i do not know if i should implement this. I think it might be a nice 
add on to the library itself. I mean, you could introduce your own line draw 
procedure, which does this kind of scaling. Additionally fractional scaling 
will need to strange effects on monochrome displays. 

I also can not really imagine how the implementation should be look like. Maybe 
you could provide some example code, e.g. for the line draw algorithm.

Original comment by olikr...@gmail.com on 1 Apr 2014 at 5:17

GoogleCodeExporter commented 9 years ago
I will give it some more thought. In my implementation I took a very simple 
approach using macros in the function calls - no code simplification but just 
makes the code more readable.
The Nokia 5110 is 84x48 pixels and the display area is 28x20mm, so the pixel 
ratio is 1.75 and the display aspect ratio is 1.4. the ratio of the two is 0.8 
(1/1.25). Clearly circles will not be circular. Other problems arise too. Cross 
hairs are asymmetric and do not cross in the middle because lines are specified 
from their start, not their middle. In all, a poor display for anything other 
than text and glyphs.
I don't know how many other displays exhibit this geometry. Whether the problem 
is widespread enough to go to the trouble of enhancing the library - I can't 
answer that. For my part, I have successfully completed the technology 
demonstrator to the customer, who is suitably impressed, and I will not use the 
5110 display again in this project - I never intended to - the final product 
will actually use a mobile phone as the console.

Original comment by john.fit...@gmail.com on 3 Apr 2014 at 4:25

GoogleCodeExporter commented 9 years ago
Most other displays have nearly 1:1 aspect ratio.

Original comment by olikr...@gmail.com on 3 Apr 2014 at 6:29

GoogleCodeExporter commented 9 years ago
good suggestion, but not suitable for u8glib...will close this :-(

Original comment by olikr...@gmail.com on 16 Jun 2014 at 7:14