What is the graphics library Bos Taurus?
Bos Taurus is a set of graphics functions (free open code) written in C and Harbour based in the Windows GDI functions specially developed for easy programming of the ON PAINT events in HMG.
In the past, the ON PAINT event was little used in applications developed in HMG due to malfunction of this event, but recently since version 3.0.43 of HMG Official (2012\/08\/30) and version 2.1.5 of HMG Extended (2012\/09\/12) the bug was corrected.
The ON PAINT event runs in response to WM_PAINT message that the Windows System sent to a window for inform that have to paint the client area. In HMG the ON PAINT event allows paint directly on the client area of a window before paint the Controls (Button, Grid, Image, ComboBox, etc.) and before paint the Draw Commands (Draw Graph, Rectangle, Line, etc.).
The BosTaurus_ChangeLog.TXT contains the latest updates in the source files of the library. From version 1.0.3, Bos Taurus supports the ANSI and UNICODE character set.
Why use the graphics library Bos Taurus?
Because in HMG exist very few native functions to draw and manipulate graphic images.
In Bos Taurus the draw functions are called with a Handle Device Context (hDC) obtained from the selected output device (desktop, client area, bitmap, etc.) just like when programming in C for Windows. This allows the use of the same functions of drawing and the easy transfer of graphics from one device to another irrespective of the output device selected. For example if a drawing function we pass to a hDC of window, the function draw in the client area of the window, however, if we pass the hDC associated with a Bitmap, the function draw in the Bitmap image.
The system of use of hDC in the functions will help other people to create other drawing functions fully compatible with the graphics library Bos Taurus, the programmer only have to use the appropriate hDC that gives the graphics library Bos Taurus. In fact with this system can be implemented in Harbour virtually all graphics functions (GDI) of Windows thereby providing a great power of graphic manipulation to the programmer.
How to use the graphics library Bos Taurus?
It is very easy to use the graphics library Bos Taurus in HMG because it is part of the library of HMG Official
Prototype Example
This example is very simple. Loads a Bitmap to the start the application and puts the background image, before drawing the image paints a vertical colors gradient from white to black. When you close the application frees of the memory the handle of the Bitmap. For more information see the demos that accompanying the Bos Taurus.
#include "HMG.CH"
FUNCTION MAIN
PRIVATE hBitmap := 0
DEFINE WINDOW Win1;
AT 0,0;
WIDTH 700;
HEIGHT 600;
TITLE "Prototype Demo";
MAIN;
ON INIT Proc_ON_INIT ();
ON RELEASE Proc_ON_RELEASE ();
ON PAINT Proc_ON_PAINT ()
// Definition of Application Controls
@ 435, 280 BUTTON Button1 CAPTION "Click";
ACTION MsgInfo ("Hello")
END WINDOW
CENTER WINDOW Win1
ACTIVATE WINDOW Win1
RETURN
PROCEDURE Proc_ON_INIT
hBitmap := BT_BitmapLoadFile ("HMG.bmp")
RETURN
PROCEDURE Proc_ON_RELEASE
BT_BitmapRelease (hBitmap)
RETURN
PROCEDURE Proc_ON_PAINT
LOCAL hDC, BTstruct
hDC := BT_CreateDC ("Win1", BT_HDC_INVALIDCLIENTAREA, @BTstruct)
BT_DrawGradientFillVertical (hDC,;
0, 0,;
BT_ClientAreaWidth ("Win1"),;
BT_ClientAreaHeight("Win1"),;
WHITE, BLACK)
BT_DrawBitmap (hDC, 35, 200, 300, 250, BT_COPY, hBitmap)
BT_DeleteDC (BTstruct)
RETURN