Container Scaling Values

The coordinates for defining and positioning objects within containers are translated to device coordinates only when the objects are displayed. Each object is defined and positioned relative to its container. The container sets the frame of reference.

At the time of display, the coordinates are modified using scalar properties (scaling factors), and offset properties. Thus, the scaling factors translate the internal values to the coordinate system of the display space, and the offsets position the scaled object in the display space.

Each time the image is zoomed or scrolled, update the scaling factors and offsets of the container, and redraw the objects in the window that owns the container.


Note

Scaling factors and offsets can be applied to objects other than the container, but that is not necessary for matching the objects to the displayed image. The scaling factors and offsets of a container apply to all objects within the container.


Scaling Factors

L_ContainerGetScalar

L_ContainerSetScalar

Offsets

L_ContainerGetOffset

L_ContainerSetOffset

/* This example shows how to set the container's scaling factors */ 
L_INT SetScalarTest(pCONTAINERHANDLE pContainer) 
{ 
   if (SUCCESS == L_ContainerIsValid(pContainer)) /* check the validity of container handle */ 
   { 
      VECTORPOINT vptScalarNum, vptScalarDen; 
      /* Set the horizontal scaling factor to 5:1 factor */ 
      vptScalarNum.x = 5; 
      vptScalarDen.x = 1; 
      /* Set the vertical scaling factor to 5:1 factor */ 
      vptScalarNum.y = 5; 
      vptScalarDen.y = 1; 
      /* Set the z scaling factor to 1:1 factor */ 
      vptScalarNum.z = 1; 
      vptScalarDen.z = 1; 
      L_ContainerSetScalar(g_pLeadContainer, &vptScalarNum, &vptScalarDen); 
      return SUCCESS; 
   } 
   else 
   { 
      return FAILURE; 
   } 
} 

After setting the scalar values to some value, mouse movement will be snapped to the grid that represents the scaling factor.

Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Container and Automation C API Help