L_VecGetObjectAttributes

#include "lvkrn.h"

L_LVKRN_API L_INT L_VecGetObjectAttributes(pVector, pObject, pnROP, pPen, pBrush, pFont)

const pVECTORHANDLE pVector;

/* pointer to a vector handle */

const pVECTOROBJECT pObject;

/* pointer to a vector object */

L_INT * pnROP;

/* ROP code */

pVECTORPEN pPen;

/* pen characteristics */

pVECTORBRUSH pBrush;

/* brush characteristics */

pVECTORFONT pFont;

/* font characteristics */

Gets the attributes of an object.

Parameter

Description

pVector

Pointer to a vector handle.

pObject

Pointer to the vector object for which to get the attributes.

pnROP

Pointer to a variable to be updated with the object's ROP code. For more information on valid ROP2 codes, refer to your SDK..

pPen

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.

pBrush

Pointer to a VECTORBRUSH structure to be updated with the characteristics of the brush to use when drawing the class object.

pFont

Pointer to a VECTORFONT structure to be updated with the characteristics of the font used by the class object.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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.

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_VecSetObjectAttributes, L_VecGetObject, L_VecSetObject, L_VecFreeObject

Topics:

Working with Vector Objects

Example

This example will get the line color of the object under a given point regardless of its type.

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;
}