Some Questions Concerning LUA/C regarding GUI and Drawing - General Discussion and Assistance - CHDK Forum supplierdeeply

Some Questions Concerning LUA/C regarding GUI and Drawing

  • 4 Replies
  • 4578 Views
Some Questions Concerning LUA/C regarding GUI and Drawing
« on: 04 / February / 2019, 02:47:25 »
Advertisements
As i started to make my own Script for my camera , i ran into some "pitfalls" with it, which are based by some Limitations I found. Like making more complex Guis and drawing Objects on the Screen. I think I know how I could work around that in LUA but I feel like it would be more efficient to directly into the C source (especially the drawing functions) and Populate them to LUA. As far as I understood it, the LUA implementation is some sort of "binding" to C functions that are written in the Main source Correct me if I am wrong about that. 

So what Features I'd like to add:
1. Draw more Shapes (Polygons, Curves)
2. More Userinputs (they must reside somewhere in the Code already, because they are used when you configure CHDK or a script)
3. Remove/Hide Objects from the Screen without redrawing the Entire OSD (to prevent flickering).

I know i can work my way around 1&2 in LUA, but that might become very inefficient, So I'd like to implement it into the C Source, but I'm not sure if thats maybe a waste of Time, because there are some Limitations on the Software I don't know about or maybe some other reasons that are more Hardware related. Maybe someone with more Experience can give me a little Heads on about this topic

With best regards
Adromir

*

Offline reyalp

  • ******
  • 14118
Re: Some Questions Concerning LUA/C regarding GUI and Drawing
« Reply #1 on: 11 / February / 2019, 16:20:13 »
As i started to make my own Script for my camera , i ran into some "pitfalls" with it, which are based by some Limitations I found. Like making more complex Guis and drawing Objects on the Screen. I think I know how I could work around that in LUA but I feel like it would be more efficient to directly into the C source (especially the drawing functions) and Populate them to LUA. As far as I understood it, the LUA implementation is some sort of "binding" to C functions that are written in the Main source Correct me if I am wrong about that. 
The Lua binding is in modules/luascript.c
This is compiled into a loadable module (lua.flt) so core functions must be exported to be available (see module_exportlist.c)

Quote
So what Features I'd like to add:
1. Draw more Shapes (Polygons, Curves)
This should be fairly straightforward, following the example of what is in core/gui_draw.c and how existing functions are exported to Lua.
However, for unfilled polygons I would expect a Lua implementation using lines to be sufficient. Filled polygons and curves might benefit from C implementation, but I'd be hesitant to add them to the core without a specific identified need.

Quote
2. More Userinputs (they must reside somewhere in the Code already, because they are used when you configure CHDK or a script)
You mean input controls, like what appears in the menu? This is complicated because script and UI run in different tasks (script runs in kbd_task, UI generally runs in in spytask.

Quote
3. Remove/Hide Objects from the Screen without redrawing the Entire OSD (to prevent flickering).
I do not believe this is possible to do in a general way, and the CHDK OSD would continue to flicker for other reasons in any case.
Don't forget what the H stands for.

Re: Some Questions Concerning LUA/C regarding GUI and Drawing
« Reply #2 on: 12 / March / 2019, 20:02:03 »
Hello Sorry for the late reply,
I was on a Vacation in Bali while you replied and havent checked the forum since I got back.

Well my suggestions arent really a big priority, I just thought that it can unleash a new level of posibilities if Userscripts could be written with more Options of user interactions and drawing more elaborate gui elements than the current Implementation allows it .

Background for it is, that I was missing a feature in chdk when taking Pictures is some sort of custom quick settings for my own frequently used Camera settings while shooting different kind of scenes, so I dont have to temper around with different settings (aperture, Iso, white balance etc) when i am taking pictures. So far the problem with that Idea is the lack of options of userinteraction with Scripts. The Idea for drawing more elaborate Shapes came to me, when I tried to work my way around the current limitations, because I figured that it might be easier (for me) to hack around it this way than like enabling more controls in the C implementation of LUA

Re: Some Questions Concerning LUA/C regarding GUI and Drawing
« Reply #3 on: 12 / March / 2019, 23:24:24 »
So far the problem with that Idea is the lack of options of userinteraction with Scripts. The Idea for drawing more elaborate Shapes came to me, when I tried to work my way around the current limitations, because I figured that it might be easier (for me) to hack around it this way than like enabling more controls in the C implementation of LUA
While the word elegant does not come to mind, here's an example of what can be done to create a "reasonable" level of user interaction capability in CHDK using just Lua scripting : CHDKplus

Of course, if there were better GUI capabilities then I would have used them as well  8)
Ported :   A1200    SD940   G10    Powershot N    G16


Re: Some Questions Concerning LUA/C regarding GUI and Drawing
« Reply #4 on: 13 / March / 2019, 23:43:44 »
Hey waterwings, thanks for pointing me in a direction to work with.. Though I paused my lua scripting efforts for a bit, because I realised that I am mainly in need for something else around chdk first, which will be my next project.. If I can get the bits and pieces together I will need for it

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal