staring from the back.
Again, sorry, but I don't understand this. What's the displayed area?We are talking about a preview therefore the (displayed)preview area is the area that is visible to the user.
What do you mean when you say "render"
Will use in for further explanation "preview buffer" to indicate the non visual area.
When I say render I mean the computation of the visual effect.
When I say draw I mean the visualisation of the computed effect on the preview area.
Sorry, I am not sure if I get what you are saying here. Could you elaborate a bit, perhaps give an example of the API that you think is needed?
A minimum for the preview widget would be :
Widgets : 1. The preview area 2. Horizontal/Vertical scrollbars if needed.
Signals :
1. preview_draw : draw preview area from current preview buffer.
2. preview_update : Call-back for rendering function followed by preview_draw or call preview_draw from callback.
(if possible send signal preview_draw from within callback to display rendering progress).
3. preview_changed : Call-back to determine which part of the drawable that must be rendered for preview.
(after scrollbar position changed)
API :
1. new_preview_buffer(drawable, buffer, x,y ,width, height, offset_x, offset_y);
drawable = self explanatory buffer = type to determine x, y = offset from drawable origin width, height = self explanatory offset_x, offset_y = offset for preview buffer.
drawing origin = 0,0
preview origin = 0+x, 0+y x,y=128
width, height = 128
offset_x, offset y = 0 (preview buffer = preview area)
=> rectangular preview buffer = (128,128) , (256,256) offset_x, offset_y = 20 use to render the preview more accurate. (preview buffer > preview area)
=> rectangular preview buffer = (x1-offset_x, y1-offset_y) , (x2+offset_x, y2+offset_y)
= (108,108), (276,276)
2. function to draw the buffer.
preview_draw_buffer(buffer);
3. function to free buffer preview_free_buffer(buffer);
4. functions to for internal housekeeping that can be used in the callback from preview_changed.
calculate new limits, check if buffer covers new coordinates if not preview needs update, otherwise only draw from buffer.
Geert