Looking into ML chdk-gui_draw.c tells me that the ML draw coding is sourced from CHDK.
Looking at the coding, which is in C, and I'm not a C programmer, tells me it should be relatively simple to add in a few enhancements, which then can be exposed in Lua.
For example, the draw_circle is coded like this:
void draw_circle(int x, int y, int r, int cl)
{
uint8_t* bvram = bmp_vram();
int dx = 0;
int dy = r;
int p=(3-(r<<1));
do {
bmp_putpixel_fast(bvram,(x+dx),(y+dy),cl);
bmp_putpixel_fast(bvram,(x+dy),(y+dx),cl);
bmp_putpixel_fast(bvram,(x+dy),(y-dx),cl);
bmp_putpixel_fast(bvram,(x+dx),(y-dy),cl);
bmp_putpixel_fast(bvram,(x-dx),(y-dy),cl);
bmp_putpixel_fast(bvram,(x-dy),(y-dx),cl);
bmp_putpixel_fast(bvram,(x-dy),(y+dx),cl);
bmp_putpixel_fast(bvram,(x-dx),(y+dy),cl);
++dx;
if (p<0)
p += ((dx<<2)+6);
else {
--dy;
p += (((dx-dy)<<2)+10);
}
} while (dx<=dy);
}
I've tried doing this myself, but I remain mystified at some of the C coding.
Also why do we have to duplicate certain things, eg like this:
bmp_putpixel_fast(bvram,(x+dx),(y+dy),cl);
bmp_putpixel_fast(bvram,(x+dy),(y+dx),cl);
My 'idea' was to use draw_circle to create a function that draws an arc, ie from angle a to angle b.
Looking at the existing coding, my thought was to simply use the existing draw_circle coding and 'simply' put in a test for the colour, ie cl.
If that part of the circle was outside the drawing angles, then don't draw or draw transparent.
Anyway, I'm afraid at this time, in my C development, I am unable to do this.
But the feature request remains: can we introduce a draw_arc into the ML chdk-gui_draw.c, and expose this in Lua?
Cheers
Garry