Quote:
Originally Posted by juliansader
Quote:
Originally Posted by Sexan
Just one more question, when drawing rectangle dynamically it does not refresh if you resize (to lower number) until the mouse is released.View is updated only if the rectangle has expanded,but not if its shrinked. Is this my error somewhere?
Thank you very much for this magical APIs
|
To shrink or remove previously drawn GDI elements, either REAPER must redraw the underlying window, or if the window is static, you need to draw over your own GDI elements, using the original window content. The original window content can be stored in bitmap 1, combined with the rectangles in bitmap 2, and then blitted to the screen.
|
Shrinking seems to work fine if I make these changes:
* I use ASbmp to store the underlying window content. This must be updated whenever the window changes and REAPER redraws the window (and removes the script's rectangles). IIRC, SWS checks GetScrollInfo for changes.
Code:
reaper.JS_GDI_Blit(ASbmpDC, 0, 0, track_window_dc, 0, 0, 5000, 5000)
* Add another combineBmp in which the window content will be combined with the script rectangles in each cycle (so that the original content of ASbmp is not overwritten):
Code:
if as_track then
reaper.JS_LICE_Blit(combineBmp, 0, 0, ASbmp, 0, 0, 5000, 5000, 1, "COPY")
reaper.JS_LICE_FillRect(combineBmp, X_start, Y_start, W, H, 0xFF0000, 0.5, "COPY")
reaper.JS_GDI_Blit(track_window_dc, 0, 0, combineBmpDC, 0, 0, 5000, 5000 )
end
Result: