L_VecPaintDC

#include "lvkrn.h"

L_LVKRN_API L_INT L_VecPaintDC(hDC, pVector, uWidth, uHeight, pSrc, pSrcClip, pDest, pDestClip, dwFlags)

L_HDC hDC;

handle to the target device context

const pVECTORHANDLE pVector;

pointer to the vector handle

L_UINT uWidth;

desired width of the vector

L_UINT uHeight;

desired height of the vector

const RECT *pSrc;

pointer to the display source rectangle

const RECT *pSrcClip;

pointer to the display source clipping rectangle

const RECT *pDest;

pointer to the display destination rectangle

const RECT *pDestClip;

pointer to the display destination clipping rectangle

L_UINT32 dwFlags;

flags

Displays any vector, at any size, to any device context (screen, printer, or memory dc).

Parameter Description
hDC Handle to a device context, such as a screen, to use as the display surface. The mapping mode of the device context must be MM_TEXT.
pVector Pointer to the vector handle referencing the vector image to paint.
uWidth Desired virtual width of the source vector in pixels.
uHeight Desired virtual height of the source vector in pixels.
pSrc Pointer to the Windows RECT structure that specifies the part of the vector to use as the display source.
  The coordinates in the RECT structure are relative to the vector. You can pass NULL to use the default, which matches the vector.
pSrcClip Pointer to the Windows RECT structure that specifies the portion of the display source to paint. Generally, this is used for updating the display when part of the source vector has changed.
  The coordinates in the RECT structure are relative to the vector. You can pass NULL to use the default, which matches the vector.
pDest Pointer to the Windows RECT structure that determines how the source rectangle is scaled and how the image is positioned in the device context.
  The coordinates in the RECT structure are relative to the device context. There is no default for this parameter. You must specify the RECT structure.
pDestClip Pointer to the Windows RECT structure that specifies the portion of the display rectangle to paint. Generally, this is used for updating changes in the display surface, such as when a user moves another window, uncovering a part of the image that had been covered up.
  The coordinates in the RECT structure are relative to the device context. You can pass NULL to use the default, which matches the device context. In most cases, however, you should use the rectangle returned by the Windows WM_PAINT message.
dwFlags Flag that indicates how to perform the paint process. Possible values are:
  Value Meaning
  VECTOR_PAINT_ERASEBKGND Use the vector background color to clear the destination area before painting.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function emulates the LEAD L_PaintDC function using a vector handle instead of a bitmap image.

Since vector images don't have physical width and height, you must pass width and height values to this function to determine the source size. In L_PaintDC, uWidth and uHeight are equal to Bitmap.Width and Bitmap.Height respectively, also rectangles coordinates should have positive values and they should be relative to uWidth and uHeight.

For more information on using the source and destination rectangles and the clipping rectangles, refer to L_PaintDC.

Required DLLs and Libraries

LVKRN

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

See Also

Functions:

L_VecPaint, L_VecRealize

Example

For complete sample code, refer to the VECOVRLY example. This example shows the minimum requirements for overlaying a vector drawing over a raster image.

L_INT VecPaintDCExample( 
HWND hWnd, 
BITMAPHANDLE LeadBitmap,   /* Bitmap handle for the image */ 
VECTORHANDLE LeadVector)   /* Vector handle for the drawing */ 
{ 
   L_INT nRet; 
   HDC hdc;                         /* Device context for the current window */ 
   RECT rLeadDest;                  /* Destination rectangle for painting */ 
   HPALETTE hSavedPalette = NULL;   /* Temporary copy of the current system palette */ 
   HPALETTE hOurPalette = NULL;     /* The palette that we will use to paint */ 
   /* Get the device context */ 
   hdc = GetDC( hWnd ); 
   /* Set the destination rectangle to be the same as the bitmap. 
   Other painting rectangles can take defaults. */ 
   SetRect( &rLeadDest, 0, 0, BITMAPWIDTH( &LeadBitmap ), BITMAPHEIGHT( &LeadBitmap ) ); 
   /* Create the palette that we will use to paint */ 
   hOurPalette = L_CreatePaintPalette( hdc, &LeadBitmap ); 
   /* Select our palette and save the old one */ 
   hSavedPalette = SelectPalette( hdc, hOurPalette, FALSE ); 
   /* Realize our palette */ 
   RealizePalette( hdc ); 
   /* Paint the raster image */ 
   nRet = L_PaintDC ( 
   hdc,         /* Device context */ 
   &LeadBitmap, /* Bitmap handle */ 
   NULL,        /* Default source rectangle */ 
   NULL,        /* Default source clip area */ 
   &rLeadDest,  /* Destination rectangle */ 
   NULL,        /* Default destination clipping rectangle */ 
   SRCCOPY );   /*  ROP3 code for a Normal Paint */ 
   if (nRet != SUCCESS) 
      return nRet; 
   /* Overlay the vector image */ 
   nRet = L_VecPaintDC( 
   hdc,               /* Device context */ 
   &LeadVector,       /* Vector handle */ 
   LeadBitmap.Width,  /* Width desired */ 
   LeadBitmap.Height, /* Height desired */ 
   NULL,              /* Default source rectangle */ 
   NULL,              /* Default source clip area */ 
   &rLeadDest,        /* Destination rectangle */ 
   NULL,              /* Default destination clipping rectangle */ 
   0L );              /* Do not erase background */ 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Restore the old palette */ 
   SelectPalette( hdc, hSavedPalette, FALSE ); 
   /* Delete the newly created palette */ 
   DeleteObject( hOurPalette ); 
   /* Release the device context */ 
   ReleaseDC( hWnd, hdc ); 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Vector C API Help