zakamik / u8glib

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

Rudimentary global offset implementation #277

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I found myself wanting global offset support in u8glib. This is useful for 
reusing graphics, as it allows you to create graphics independently of where 
you are using it, without using explicit offset variables. Similar mechanisms 
exists in many other libraries, such as OpenGL's glTranslatef.

Attached is a rudimentary implementation of such a mechanism. It works for 
box/frame/vline/hline/line, and that's all I have tested so far.

I hope the idea, if not the implementation, can be incorporated into a future 
release.

Original issue reported on code.google.com by freesp...@gmail.com on 5 Sep 2014 at 10:33

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for adding the patch. 
I have some doubts to add this to u8glib, because i do not know how many users 
will require or use this feature. On the other side it will slow down and 
require more flash rom for all users, if i do add this extension.

Original comment by olikr...@gmail.com on 7 Sep 2014 at 12:38

GoogleCodeExporter commented 8 years ago
Those are valid concerns. I find the extension very useful as it allows me to 
isolate the logic of creating a visual element from logic of placing the 
element, and allows better encapsulation. I suspect many people implement this 
explicitly by passing x and y offsets to drawing functions, which is 
essentially the same in terms of prog mem and speed cost, but less elegant.

It is perhaps possible to make this extension controlled via conditional 
compilation, so it is only activated by users who need it.

Original comment by freesp...@gmail.com on 7 Sep 2014 at 3:20

GoogleCodeExporter commented 8 years ago
I keep the comments and your patch here. Let me think about this. 

Original comment by olikr...@gmail.com on 7 Sep 2014 at 4:18

GoogleCodeExporter commented 8 years ago
No worries :) Thank you very much for your time, u8glib has been an enormous 
help!

Original comment by freesp...@gmail.com on 7 Sep 2014 at 4:25