ImageGear for C and C++ on Windows v20.0 - Updated
LPFNIG_ART_DRAWNOTIFYFUNC
API Reference Guide > ART Component API Reference > ART Component Callback Functions Reference > LPFNIG_ART_DRAWNOTIFYFUNC

When registered, this callback gets called when ART encounters a mark that it does not know how to draw.

Declaration:

 
Copy Code
typedef VOID (ACCUAPI *LPFNIG_ART_DRAWNOTIFYFUNC)(
        HIGEAR hIGear, 
        DWORD dwGrpID, 
        LPVOID lpPrivate, 
        HDC hDC, 
        AT_MODE nWhen, 
        ART_MARK_INDEX hMarkIndex, 
        const LPART_MARK_ATTRIBUTES lpMarkAttr, 
        const LPAT_RECT lprcClip, 
        const LPAT_RECT lprcBounds, 
        AT_MODE nOrientation
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle to the image.
dwGrpID DWORD Identifier of group.
lpPrivate LPVOID A far pointer that takes private callback data.
hDC HDC Windows handle to the device context to which to draw.
nWhen AT_MODE Before or after image.
hMarkIndex ART_MARK_INDEX Index for the mark.
lpMarkAttr const LPART_MARK_ATTRIBUTES Set to the ART_MARK_ATTRIBUTES structure of the mark to draw.
lprcClip const LPAT_RECT Set to the AT_RECT coordinates of the clipping rectangle.
lprcBounds const LPAT_RECT The scaled bounds of the mark.
nOrientation AT_MODE The orientation of the mark. Set to an AT_MODE constant (defined in Gear.h) that begins with IG_ORIENT_TOP_ .

Return Value:

Returns the number of ImageGear errors that occurred during the function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Sample:

None

Example:

 
Copy Code
VOID ACCUAPI DRAWNOTIFYFUNC( 
        HIGEAR hIGear,  
        DWORD dwGrpID,  
        LPVOID lpPrivate,  
        HDC hDC,  
        AT_MODE nWhen,  
        ART_MARK_INDEX hMarkIndex,  
        const LPART_MARK_ATTRIBUTES lpMarkAttr,  
        const LPAT_RECT lprcClip,  
        const LPAT_RECT lprcBounds,  
        AT_MODE nOrientation 
        )
{
        HBRUSH hBrush;
        HBRUSH hOldBrush;
        AT_RGBQUAD color = lpMarkAttr->rgbColor1;
        AT_POINT ptPoints[2];
        ptPoints[0].x = lpMarkAttr->rcBounds.left;
        ptPoints[0].y = lpMarkAttr->rcBounds.top;
        ptPoints[1].x = lpMarkAttr->rcBounds.right;
        ptPoints[1].y = lpMarkAttr->rcBounds.bottom;
        IG_dspl_image_to_device(hIGear, dwGrpID, hWnd, hDC, ptPoints, 2);
        hBrush = CreateSolidBrush(RGB(color.rgbRed, color.rgbGreen , color.rgbBlue));
        hOldBrush = SelectObject(hDC, hBrush);
        Ellipse(hDC, ptPoints[0].x, ptPoints[0].y, ptPoints[1].x, ptPoints[1].y);
        SelectObject(hDC, hOldBrush);
        DeleteObject(hBrush);
}

Remarks:

The main purpose of this callback is for painting user-defined marks that the developer has created. This callback gets called twice each time the mark needs to be painted. On the first call, the nWhen parameter is set to ART_DISPLAY_PREPAINT. This indicates that the underlying image has not repainted itself yet. On the second call, nWhen is set to ART_DISPLAY_POSTPAINT. Any drawing that is done during the pre-paint phase is clobbered by the underlying image when it paints itself. The pre-paint phase is used to create clipping regions for optimized painting. The mark is drawn during the post-paint phase. The hMarkIndex parameter indicates that the mark needs to be painted and its attributes are passed in the lpMarkAttr parameter. If the mark has extra data in named blocks that is necessary during painting, the named blocks are queried by this function.

The lprcClip parameter is the current clipping rectangle. Any drawing that occurs outside this rectangle is clipped by the operating system. This parameter is passed to give the callback an opportunity to optimize its painting within the rectangle. The lprcBounds parameter is the rectangle of the current boundaries of the mark. This parameter differs from the rcBounds field in the ART_MARK_ATTRIBUTES structure. The rectangle in this parameter is scaled for the display and if the underlying image is rotated, then lprcBounds is rotated. The nOrientation parameter tells the callback how to orient the mark when drawn. Possible values include: IG_ROTATE_0, IG_ROTATE_90, IG_ROTATE_180 and IG_ROTATE_270.

In order to use this callback, it must be registered with ART using the function ART_callback_register().
Is this page helpful?
Yes No
Thanks for your feedback.