SWT Step 6. Image handling

Objective

Implement image handling (including o.e.swt.graphics.Image class). The test example of this step should draw images of different formats in the SWT top window client area using corresponding methods of o.e.swt.graphics.GC class.

Task notes

There is one issue with getting image data when the system (the display) is in 256-color mode -- it is described here.

Also we have a potential problem with icons, because OS/2 supports only 32x32/16x16 px and 40x40/20x20 px icons. Although we made it possible to create and draw icons of any size we cannot use non-standard ones in places where OS/2 accepts standard icon/pointer handlers (for example, in some controls).

Step checklist

Operation Status Remarks
Add OS.DevOpenDC() and OD_* constants, DevCloseDC(); OS.GpiCreatePS() and PU_*, GPIF_*, GPIT_*, GPIA_*, GPIM_* constants, GpiDestr Done [dmik] During to complicacy of one of its parameters OS.DevOpenDC()is implemented in an unusual way, see the source
Add Display.internal_get_HAB() method Done [dmik] This is a static and public method, not intended for use by applications. It is intended for those classes inside SWT to obtain the HAB which don't have the direct access to the Display object but need it.
Add OS.GpiQueryDeviceBitmapFormats(), GpiCreateBitmap() and CBM_INIT constant, constants for BITMAPINFOHEADER2: OS.BCA_*, BRU_*, BRA_*, BRH_* and BCE_*, OS.GpiSetBitmap() Done [dmik]
Add two static helper methods to Image class: new_compatible_GC() and dispose_compatible_GC() Done [dmik] Done for convenience
Add OS.GpiBitBlt() and CBM_*, ROP_*, BBO_* constants Done [dmik]
Implement GC.fillGradientRectagle() Done [dmik]
Add OS.GpiQueryPalette(), OS.GpiQueryBitmapBits(), OS.GpiSetBitmapBits(), GpiDrawBits(), GpiWCBitBlt(), GpiQueryDefaultViewMatrix() Done [dmik] GpiWCBitBlt() is used now instead of GpiBitBlt() when possible -- because it does blitting faster.
Add the package static method Image.createBitmap(), the protected field Device.has32bitDepth Done [dmik] Used for convenience when dealing with bitmaps. has32BitDepth is true when the device supports the 32-bit color depth.
Add OS.WinCreatePointerIndirect(), WinDestroyPointer(), WinDrawPointer(), WinQueryPointerInfo(), DP_* constants and POINTERINFO class Done [dmik]
Implement GC.drawImage() Done [dmik]
Implement Image class, add SWT006_01 testcase + different test images, add SWT006_02 testcase Done [dmik]
Change the behavior of filled versions of some graphic primitives in GC (rectangles and arcs) back to that one in Windows (meaning that they are drawn 1 pixel narrower than their outlined counterparts with the same width and height arguments) Done [dmik] This is done for compatibility reasons -- filling an area of a client window with GC.fillRectangle() is quite a frequent task and must work equally across platforms (see here for initial discussion of this issue).
Fix Decorations: redirect the call to layout() to client.layout(); fix Shell: do implicit layout upon the first open() or setVisible() call as it done in Windows. Done [dmik]
Add OS.WinScrollWindow() and SW_* constants, HRGN_ERROR constant; implement GC.copyArea() Done [dmik] Note, that this item and the following ones are added after the SWT006 Step was considered to be done and tagged in the repository.
Add OS.GpiSetRegion(), GpiQueryClipBox(); implement GC.getClipping(Region), isClipped() Done [dmik]
Add SWT006_03 testcase Done [dmik] This testcase is for testing of two items above.