It works - with parts left over
-
:~ The code below successfully draws a rounded pushbutton (without text since my SVG engine doesn't support text directly and i haven't added the text drawing code yet) I just fired it up this morning and wrote it and it worked. Last time it didn't. I have no idea why. I've changed some things but nothing that should have destroyed it to where it silently failed. I'm not sure whether I'm happy about this or not. dumb button (without text) in svg - YouTube[^]
if(m_doc_dirty) {
gfx_result res;
svg_doc_builder builder(ssizef(destination.dimensions().width,destination.dimensions().width));
svg_shape_info si;
si.stroke.color = color<rgba_pixel<32>>::white;
si.stroke.type = svg_paint_type::color;
si.fill.type = svg_paint_type::color;
si.fill.color = m_pressed ? color<rgba_pixel<32>>::red : color<rgba_pixel<32>>::purple;
srect16 b = this->bounds().dimensions().bounds(); // zero out top left
res = builder.add_rounded_rectangle(rectf(b.x1,b.y1,b.x2,b.y2),{10,10}, si);
if (res != gfx_result::success) {
Serial.printf("Error: %d\r\n", (int)res);
return;
}
builder.to_doc(&m_doc);
m_doc_dirty = false;
}Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
-
:~ The code below successfully draws a rounded pushbutton (without text since my SVG engine doesn't support text directly and i haven't added the text drawing code yet) I just fired it up this morning and wrote it and it worked. Last time it didn't. I have no idea why. I've changed some things but nothing that should have destroyed it to where it silently failed. I'm not sure whether I'm happy about this or not. dumb button (without text) in svg - YouTube[^]
if(m_doc_dirty) {
gfx_result res;
svg_doc_builder builder(ssizef(destination.dimensions().width,destination.dimensions().width));
svg_shape_info si;
si.stroke.color = color<rgba_pixel<32>>::white;
si.stroke.type = svg_paint_type::color;
si.fill.type = svg_paint_type::color;
si.fill.color = m_pressed ? color<rgba_pixel<32>>::red : color<rgba_pixel<32>>::purple;
srect16 b = this->bounds().dimensions().bounds(); // zero out top left
res = builder.add_rounded_rectangle(rectf(b.x1,b.y1,b.x2,b.y2),{10,10}, si);
if (res != gfx_result::success) {
Serial.printf("Error: %d\r\n", (int)res);
return;
}
builder.to_doc(&m_doc);
m_doc_dirty = false;
}Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix
you know what happens when you even think "I don't know why" right? Same as "the bug went away..."
Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.
-
:~ The code below successfully draws a rounded pushbutton (without text since my SVG engine doesn't support text directly and i haven't added the text drawing code yet) I just fired it up this morning and wrote it and it worked. Last time it didn't. I have no idea why. I've changed some things but nothing that should have destroyed it to where it silently failed. I'm not sure whether I'm happy about this or not. dumb button (without text) in svg - YouTube[^]
if(m_doc_dirty) {
gfx_result res;
svg_doc_builder builder(ssizef(destination.dimensions().width,destination.dimensions().width));
svg_shape_info si;
si.stroke.color = color<rgba_pixel<32>>::white;
si.stroke.type = svg_paint_type::color;
si.fill.type = svg_paint_type::color;
si.fill.color = m_pressed ? color<rgba_pixel<32>>::red : color<rgba_pixel<32>>::purple;
srect16 b = this->bounds().dimensions().bounds(); // zero out top left
res = builder.add_rounded_rectangle(rectf(b.x1,b.y1,b.x2,b.y2),{10,10}, si);
if (res != gfx_result::success) {
Serial.printf("Error: %d\r\n", (int)res);
return;
}
builder.to_doc(&m_doc);
m_doc_dirty = false;
}Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix