LPaint::FrameRgn

#include "ltwrappr.h"

virtual L_INT LPaint::FrameRgn(uType, pXForm=NULL)

L_UINT uType;

/* type of frame */

pRGNXFORM pXForm;

/* pointer to a structure */

Displays an outline of the class object's associated bitmap region. If the region includes noncontiguous shapes, each shape is outlined. The outline, itself, is inside the region.

Parameter

Description

uType

The type of frame to display. The following are possible values. To animate the frame, you must cycle through the values using a timer event.

 

L_FRAME_MOVING0

[0]

L_FRAME_MOVING1

[1]

L_FRAME_MOVING2

[2]

L_FRAME_MOVING3

[3]

L_FRAME_MOVING4

[4]

L_FRAME_MOVING5

[5]

L_FRAME_MOVING6

[6]

L_FRAME_MOVING7

[7]

 

pXForm

Pointer to an RGNXFORM structure that LEADTOOLS uses to translate between display coordinates and bitmap coordinates.

 

If you specify NULL in this parameter, the scalar fields default to 1, the offsets default to 0, and the view perspective defaults to the bitmap's view perspective.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Before calling this function, you must declare an RGNXFORM structure and set its values, which LEADTOOLS uses to translate between device context coordinates and bitmap coordinates. For details about how the structure works refer to the RGNXFORM structure description. For a description of common usage, refer to Translating Coordinates for a Bitmap Region.

This function is designed to produce an animated frame, which you can implement by calling the function with a timer event that cycles through the possible frame types.

Required DLLs and Libraries

LTDIS

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

Class Members

Topics:

Raster Image Functions: Displaying Images

 

Raster Image Functions: Palettes

 

Defining and Using a Bitmap Region

 

Handling Palette Changes

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LPaint__FrameRgnExample(HWND hWnd)
{
   L_INT nRet;
   LPaint LeadPaint ;
   LBitmapRgn LeadRegion;
   LBitmapBase LeadBitmap;
   RGNXFORM Xform;
   HDC hDC;
   RECT Rect, rClientArea ;
   nRet = LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("image1.cmp"))) ;
   if(nRet != SUCCESS)
      return nRet;
   LeadRegion.SetBitmap(&LeadBitmap) ;
   Rect.left = 10 ;
   Rect.top = 10 ;
   Rect.right = 50 ;
   Rect.bottom = 50 ;
   nRet = LeadRegion.SetRgnRect(&Rect);
   if(nRet != SUCCESS)
      return nRet;
   hDC = GetDC(hWnd) ;
   // Get the client area of the current window
   GetClientRect(hWnd,&rClientArea);
   LeadRegion.GetRgnXForm(&Xform);
   LeadPaint.SetBitmap(&LeadBitmap);
   LeadPaint.SetDC(hDC) ;
   Xform.uViewPerspective = TOP_LEFT;
   Xform.nXScalarNum = LeadBitmap.GetWidth();
   Xform.nXScalarDen = rClientArea.right;
   Xform.nYScalarNum = LeadBitmap.GetHeight() ;
   Xform.nYScalarDen = rClientArea.bottom;
   Xform.nXOffset = 0;
   Xform.nYOffset = 0;
   nRet = LeadPaint.FrameRgn(L_FRAME_MOVING0,&Xform) ;
   if(nRet != SUCCESS)
      return nRet;
   nRet = LeadPaint.PaintRgnDC() ;
   if(nRet != SUCCESS)
      return nRet;
   LeadPaint.SetDC(0) ;
   ReleaseDC(hWnd,hDC);
   return SUCCESS;
}