Sets the attributes of an object. This function is available in the LEADTOOLS Vector Imaging Pro Toolkit.
#include "ltvkrn.h"
L_LVKRN_API L_INT L_VecSetObjectAttributes(pVector, pObject, pnROP, pPen, pBrush, pFont, dwFlags)
Pointer to a vector handle.
Pointer to the vector object for which to set the attributes.
Pointer to a variable that contains the ROP code to set. For more information on valid ROP2 codes, refer to your SDK..
Pointer to a VECTORPEN structure that contains the pen characteristics to set.
Pointer to a VECTORBRUSH structure that contains the brush characteristics to set.
Pointer to a VECTORFONT structure that contains the font to set.
Flag that indicates which objects to process. Possible values are:
Value | Meaning |
---|---|
0 | Set the attributes for all objects. |
VECTOR_FLAGS_SELECTED_ONLY | Set the attributes of the selected objects only. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
If pObject is NULL, the function uses the dwFlags parameter to determine the objects for which to set the new attributes.
If NULL is passed for pnROP, pPen, pBrush and/or pFont, then that attribute will not be set. For example, if NULL is passed for the pFont parameter, the pFont parameter will not be set for the specified object.
Certain parameters are ignored depending on pObject. For example, if pObject is VECTOR_LINE, then the pBrush and pFont parameters are ignored.
This function provides a simpler way of setting object information, without having to get the object descriptor, inspect the object type, set the new attributes and then free the descriptor.
This example change all objects in a given vector handle to use RED pen.
L_LTVKRNTEX_API L_INT VecSetObjectAttributesExample(pVECTORHANDLE pVector)
{
VECTORPEN Pen;
Pen.nSize = sizeof( Pen );
Pen.bExtPen = FALSE;
Pen.NewPen.LogPen.lopnColor = RGB( 255, 0, 0 );
Pen.NewPen.LogPen.lopnWidth.x = 1;
Pen.NewPen.LogPen.lopnWidth.y = 1;
Pen.NewPen.LogPen.lopnStyle = PS_SOLID;
return L_VecSetObjectAttributes( pVector, NULL, NULL, &Pen, NULL, NULL, 0L );
}