dbsoft / dwindows

Dynamic Windows Library Mirror
Other
8 stars 1 forks source link

C API: Add functions to return pixmap width and height #4

Closed PierceNg closed 1 year ago

PierceNg commented 1 year ago

C and C++ code can use macros DW_PIXMAP_WIDTH and DW_PIXMAP_HEIGHT but foreign language bindings cannot. As structure of HPIXMAP is platform-dependent, it is best for language bindings to treat HPIXMAP as an opaque pointer. Hence functions to return a pixmap's width and height are needed.

dbsoft commented 1 year ago

Sounds like a valid use case, I'll sneak this in last minute for 3.3.

dbsoft commented 1 year ago

I added dw_pixmap_get_width() and dw_pixmap_get_height() to provide the same function as DW_PIXMAP_WIDTH() and DW_PIXMAP_HEIGHT() macros via APIs. I made the new C++ bindings use it instead of the macros so I could test the functionality. Everything seems to work after fixing a build error on OS/2. Let me know if this works for you.

PierceNg commented 1 year ago

Thank you. I used the functions in my Pascal test program that does buffered drawing via HPIXMAPs like how your dwtest does it. Works on GTK3 and Android. All good.

dbsoft commented 1 year ago

Awesome glad to hear it! :)