L_LVKRN_API L_INT L_VecGetObjectAttributes(pVector, pObject, pnROP, pPen, pBrush, pFont)
Gets the attributes of an object.
Pointer to a vector handle.
Pointer to the vector object for which to get the attributes.
Pointer to a variable to be updated with the object's ROP code. For more information on valid ROP2 codes, refer to your SDK..
Pointer to a VECTORPEN structure to be updated with the characteristics of the pen to use when drawing the class object. If you do not wish to retrieve this information, pass NULL.
Pointer to a VECTORBRUSH structure to be updated with the characteristics of the brush to use when drawing the class object.
Pointer to a VECTORFONT structure to be updated with the characteristics of the font used by the class object.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
If NULL is passed for pnROP, pPen, pBrush and/or pFont, then that parameter will not be updated with the corresponding value. For example, if NULL is passed for the pFont parameter, the pFont parameter will not be updated with the font information 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 retrieving object information, without having to get the object descriptor, inspect the object type and then free the descriptor.
This example will get the line color of the object under a given point regardless of its type.
L_LTVKRNTEX_API COLORREF VecGetObjectAttributesExample(
pVECTORHANDLE pVector,
POINT* pt,
L_INT* nRet)
{
VECTOROBJECT Object;
VECTORPEN Pen;
COLORREF Color;
/* hit test */
*nRet = L_VecHitTest( pVector, pt, &Object );
if( *nRet == SUCCESS )
{
/* get its PEN */
*nRet = L_VecGetObjectAttributes( pVector, &Object, NULL, &Pen, NULL, NULL );
if( Pen.bExtPen )
Color = Pen.NewPen.ExtLogPen.elpColor;
else
Color = Pen.NewPen.LogPen.lopnColor;
}
else
Color = RGB( 0, 0, 0 ); // no object under color, assume black is default
return Color;
}