Well it's been a good past 24 hours
-
I got my font caches working. One is for measuring. The other is for drawing. You can use none, one or both. Expiring is still not as efficient as I'd like, but: You can set the number of bytes, and/or the number of items to limit them to. It's easy to get statistics on them. It's just generally easy to use
m_font_draw_cache.initialize();
m_font_measure_cache.initialize();
m_font_draw_cache.max_entries(21);
m_font_measure_cache.max_memory_size(512);From there you can just pass them to the font's render() and draw() methods as desired. Only wrinkle is you can potentially screw up your caching if you reuse the cache for a different font without the clearing the cache first. I decided to make the caching on a per font basis to give you that level of control. It's embedded so you're dealing in a constrained environment and constantly robbing peter to pay paul. This way you have fine control over trading RAM for speed. In addition, I think I finally got my text measuring code working correctly. I got 3 different kinds of font working with a common base class - 16-bit windows .fon/.fnt files, .VLW anti-aliased raster, and TrueType/OpenType. Also the way I handle drawing it is kinda nice. You can use
draw::text<>()
and give it the font, or you can use the font's draw() method with a callback in which case I provide you a series of alpha transparency maps, and locations. You can simply draw using my lib'sdraw::icon<>()
function:static gfx_result draw_cb(spoint16 location,const const_bitmap>& glyph, void* state) {
draw_cb_state* st = (draw_cb_state*)state;
control_surface_type& dst = *(control_surface_type*)st->dst;
const srect16 r(location,(ssize16)glyph.dimensions());
//draw::rectangle(dst,r,color_t::blue);
if(r.intersects(st->clip)) {
return draw::icon(dst,location,glyph,rgb_pixel<16>(rand()%32,rand()%64,rand()%32));
} else {
return gfx_result::success;
}
}Also I made my text encoding pluggable so I'm not stuck with just latin1 and UTF8.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
-
I got my font caches working. One is for measuring. The other is for drawing. You can use none, one or both. Expiring is still not as efficient as I'd like, but: You can set the number of bytes, and/or the number of items to limit them to. It's easy to get statistics on them. It's just generally easy to use
m_font_draw_cache.initialize();
m_font_measure_cache.initialize();
m_font_draw_cache.max_entries(21);
m_font_measure_cache.max_memory_size(512);From there you can just pass them to the font's render() and draw() methods as desired. Only wrinkle is you can potentially screw up your caching if you reuse the cache for a different font without the clearing the cache first. I decided to make the caching on a per font basis to give you that level of control. It's embedded so you're dealing in a constrained environment and constantly robbing peter to pay paul. This way you have fine control over trading RAM for speed. In addition, I think I finally got my text measuring code working correctly. I got 3 different kinds of font working with a common base class - 16-bit windows .fon/.fnt files, .VLW anti-aliased raster, and TrueType/OpenType. Also the way I handle drawing it is kinda nice. You can use
draw::text<>()
and give it the font, or you can use the font's draw() method with a callback in which case I provide you a series of alpha transparency maps, and locations. You can simply draw using my lib'sdraw::icon<>()
function:static gfx_result draw_cb(spoint16 location,const const_bitmap>& glyph, void* state) {
draw_cb_state* st = (draw_cb_state*)state;
control_surface_type& dst = *(control_surface_type*)st->dst;
const srect16 r(location,(ssize16)glyph.dimensions());
//draw::rectangle(dst,r,color_t::blue);
if(r.intersects(st->clip)) {
return draw::icon(dst,location,glyph,rgb_pixel<16>(rand()%32,rand()%64,rand()%32));
} else {
return gfx_result::success;
}
}Also I made my text encoding pluggable so I'm not stuck with just latin1 and UTF8.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
So you got your [Hashing weirdness. Need troubleshooting ideas](https://www.codeproject.com/Questions/5386900/Hashing-weirdness-Need-troubleshooting-ideas) issue sorted, then?
"A little song, a little dance, a little seltzer down your pants" Chuckles the clown
-
So you got your [Hashing weirdness. Need troubleshooting ideas](https://www.codeproject.com/Questions/5386900/Hashing-weirdness-Need-troubleshooting-ideas) issue sorted, then?
"A little song, a little dance, a little seltzer down your pants" Chuckles the clown
Ah yes. I forgot about that. Thanks. I'll close it now. Unfortunately I don't have an easy explanation for what I did.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
-
Ah yes. I forgot about that. Thanks. I'll close it now. Unfortunately I don't have an easy explanation for what I did.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
-
Write an article?
"A little song, a little dance, a little seltzer down your pants" Chuckles the clown
I will eventually, but not on this code specifically. The caching isn't very generic or general purpose. The reason being is that it's part of a much larger graphics library I'm create a major version update of. I will be writing an article on that once it's ready, but I have a lot of work to do before then.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
-
I got my font caches working. One is for measuring. The other is for drawing. You can use none, one or both. Expiring is still not as efficient as I'd like, but: You can set the number of bytes, and/or the number of items to limit them to. It's easy to get statistics on them. It's just generally easy to use
m_font_draw_cache.initialize();
m_font_measure_cache.initialize();
m_font_draw_cache.max_entries(21);
m_font_measure_cache.max_memory_size(512);From there you can just pass them to the font's render() and draw() methods as desired. Only wrinkle is you can potentially screw up your caching if you reuse the cache for a different font without the clearing the cache first. I decided to make the caching on a per font basis to give you that level of control. It's embedded so you're dealing in a constrained environment and constantly robbing peter to pay paul. This way you have fine control over trading RAM for speed. In addition, I think I finally got my text measuring code working correctly. I got 3 different kinds of font working with a common base class - 16-bit windows .fon/.fnt files, .VLW anti-aliased raster, and TrueType/OpenType. Also the way I handle drawing it is kinda nice. You can use
draw::text<>()
and give it the font, or you can use the font's draw() method with a callback in which case I provide you a series of alpha transparency maps, and locations. You can simply draw using my lib'sdraw::icon<>()
function:static gfx_result draw_cb(spoint16 location,const const_bitmap>& glyph, void* state) {
draw_cb_state* st = (draw_cb_state*)state;
control_surface_type& dst = *(control_surface_type*)st->dst;
const srect16 r(location,(ssize16)glyph.dimensions());
//draw::rectangle(dst,r,color_t::blue);
if(r.intersects(st->clip)) {
return draw::icon(dst,location,glyph,rgb_pixel<16>(rand()%32,rand()%64,rand()%32));
} else {
return gfx_result::success;
}
}Also I made my text encoding pluggable so I'm not stuck with just latin1 and UTF8.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
It's finally fast(er) then?
-
It's finally fast(er) then?
Fast enough now.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
-
Fast enough now.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
Good for you.
-
Fast enough now.
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
-
It all kind of runs together for me but also I know what you mean. :)
Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix