To make drawing environment like paint; we can use timer or on mouse events like attached project, but it's not the real thing cause when we draw fast it gives some distant dots, How can we fix this? any ideas?
Professional Software Development Tools
To make drawing environment like paint; we can use timer or on mouse events like attached project, but it's not the real thing cause when we draw fast it gives some distant dots, How can we fix this? any ideas?
Use reteset's WinApi plugin.
Action Plugins
AllOn | Box | Class | Code | Cursor | DXML | Error | Frames | GlobalPaths | Group | INIPlus |KeyBind | KeyLock | MathEx | Menu | Name | Project | Resize | StatusBar
Download
Thanks for reminding, but is there any other way except merging windows?
arb,
Here's something I did a while ago - same problem with the 'dots' not keeping up with the mouse... maybe IR can explain why...?
http://www.indigorose.com/forums/thr...d-for-Children
calling , MoveTo() and LineTo() Windows GDI functions with a proper GDI pen would do that very good
in your sample you are creating objects continuously
when you look from another side it is equivalent of creating shape objec plugin in each time you create a dot
when i run the arb's sample project and after 10 seconds of mouse activity
application's memory utilization goes from 7 mb to 15 mb ,you simply flood the memory![]()
here is a simple drawing example
this is not a complete sample , it only shows how to draw lines with GDI API
please keep in mind :
all the drawings will be lost after next window redraw
you will need to catch WM_PAINT message of app window to replicate previous drawings
there are two ways to do it
one; save current dc as a memory bitmap (using GDI API)
another way ; store mouse positions in a lua table and call moveto /lineto functions through that table in next time
also saving positions to a table ,may help you to save drawings to a file and load in next time
this is how graphic programs work (save as project)
Wow, that was sweeeeeeeeet, Thank you very much for this.
I wish i learn more about windows capabilities.
Thanks again reteset![]()
@reteset,
I tryed to change the pen properties when calling the PenCreate function, theoretically the variable pStyle should be an string like PS_SOLID, PS_DASH...PS_INSIDEFRAME, however the placeholder for this variable is a number %d instead of %s, I could not find if the aforementioned strings have a number value.
When I change the pSize to a number greater than Zero, (more than one pixel) I have a delay when mouving the mouse, no drawn at all is seen untill few elapsed seconds or when moving the window along the screen.Code:CreatePen = function(pStyle,pSize,pColor) local va_arg = string.format("%d,%d,%d",pStyle,pSize,pColor); return DLL.CallFunction("Gdi32.dll", "CreatePen", va_arg, DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL); end
Is this behaviour normal, my OS W7 Media center, AMS version 8.0.4.0.?
Thanks.