Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.11.1
LEADTOOLS Raster Imaging C DLL Help

L_2DSetViewMode

Show in webframe

#include "l_bitmap.h"

L_LTFIL_API L_INT L_2DSetViewMode(nViewMode)

L_INT nViewMode;

/* viewport mode */

Sets the current viewport mode used when loading 3D file formats.

Parameter

Description

nViewMode

New viewport mode. Possible values are:

 

Value

Meaning

 

L2D_USE_BEST

Fit the drawing into current viewport width and height. Final image size is less than or equal to viewport size.

 

L2D_USE_WIDTH

Use the current viewport width. Calculate new height, preserving the aspect ratio. Final image size has the same width as the current viewport width, with the height less than or equal to the current viewport height.

 

L2D_USE_HEIGHT

Use the current viewport height. Calculate the new width, preserving the aspect ratio. Final image size has the same height as the current viewport height, with the width less than or equal to the current viewport width.

 

L2D_USE_WIDTH_HEIGHT

Use both the width and the height (stretch image if necessary). Final image size has the same width and height as the current viewport size.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

A 3D file format usually doesn't have a physical size. The user can specify a viewport (physical size upto which the drawing can be rendered) with L_2DSetViewport . How the drawing is to be rendered inside this viewport depends on the current viewport mode set with L_2DSetViewMode. Default viewport size is 640x480 pixels.

When working with Vector files, you can use the Vector features, available in selected products, or you can use the Raster C DLL. If you use the Main C DLL for loading, using the standard loading functions, you can modify the view port and view mode using the following functions:

L_2DGetViewMode

L_2DSetViewMode

L_2DGetViewport

L_2DSetViewport

This function may be used with the following Vector file formats: DXF, DWG, WMF, EMF, PCT, CGM, DRW, PLT, TIF (with a DXF saved internally) and Intergraph Vector. For more information on these file formats and their availability, refer to LEADTOOLS Vector Formats.

Required DLLs and Libraries

LTFIL

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

Platforms

Win32, x64.

See Also

Functions:

L_SetLoadResolution, L_SetPCDResolution, L_SetWMFResolution
For Vector files: L_2DGetViewMode, L_2DGetViewport,

 

L_2DSetViewport

Topics:

Raster Image Functions: Rasterizing Files

Example

This example will set current viewport mode to L2D_USE_WIDTH_AND_HEIGHT, and its size to 400*400 pixels and then loads a DXF file

 L_INT Set2DViewModeExample(L_TCHAR * pszDXFFileName , pBITMAPHANDLE pBitmap)
{
   L_INT nRet;
   /* Set viewport mode to L2D_USE_WIDTH_HEIGHT */
   nRet = L_2DSetViewMode( L2D_USE_WIDTH_HEIGHT );
   if(nRet != SUCCESS)
      return nRet;

   /* Set viewport size to 400*400 pixels */
   nRet = L_2DSetViewport( 400, 400 );
   if(nRet != SUCCESS)
      return nRet;

   /* Loads a DXF file */
   if(pBitmap->Flags.Allocated)
      L_FreeBitmap(pBitmap);
   nRet = L_LoadBitmap( pszDXFFileName, pBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL );
   if(nRet != SUCCESS)
      return nRet;

   return SUCCESS;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.