ImageGear for C and C++ on Windows v20.1 - Updated
IG_dspl_layout_set
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Display Functions > IG_dspl_layout_set

This function sets layout parameters.

Declaration:

 
Copy Code
AT_ERRCOUNT   ACCUAPI  IG_dspl_layout_set( 
        [IN] HIGEAR hIGear, 
        [IN] DWORD dwGrpID,
        [IN] DWORD nFlags,
        [IN] const LPAT_RECTANGLE lpImageRect,
        [IN] const LPAT_RECTANGLE lpDeviceRect,
        [IN] const LPAT_RECTANGLE lpClipRect,
        [IN] AT_MODE nFitMode,
        [IN] AT_MODE nAlignMode,
        [IN] AT_MODE nAspectMode,
        [IN] DOUBLE dblAspectValue
);

Arguments:

Name Type Description
hIGear HIGEAR ImageGear handle of image.
dwGrpID DWORD Identifier of group in which to set layout options.
nFlags DWORD Combination of flags where each one specifies if the appropriate parameter is to be used or ignored: IG_DSPL_IMAGE_RECT - if (nFlags&IG_DSPL_IMAGE_RECT)!=0 then the lpImageRect parameter of this function is not ignored IG_DSPL_DEVICE_RECT - if (nFlags&IG_DSPL_DEVICE_RECT)!=0 then the lpDeviceRect parameter of this function is not ignored IG_DSPL_CLIP_RECT - if (nFlags&IG_DSPL_CLIP_RECT)!=0 then the lpClipRect parameter of this function is not ignored IG_DSPL_FIT_MODE - if (nFlags&IG_DSPL_FIT_MODE)!=0 then the nFitMode parameter of this function is not ignored IG_DSPL_ALIGN_MODE - if (nFlags&IG_DSPL_ALIGN_MODE)!=0 then the nAlignMode parameter of this function is not ignored IG_DSPL_ASPECT_MODE - if (nFlags&IG_DSPL_ASPECT_MODE)!=0 then the nAspectMode parameter of this function is not ignored IG_DSPL_ASPECT_VALUE - if (nFlags&IG_DSPL_ASPECT_VALUE)!=0 then the dblAspectValue parameter of this function is not ignored
lpImageRect const LPAT_RECTANGLE A new value of ImageRect option to set. If NULL then it is reset with the default value which means the whole image will be used.
lpDeviceRect const LPAT_RECTANGLE A new value of DeviceRect option to set. If NULL, then it is reset with the default value (an empty rectangle). This means it is calculated every time from the destination output device.
lpClipRect const LPAT_RECTANGLE A new value of ClipRect option to set. If NULL, then it is reset with the default value (an empty rectangle). This means it is calculated every time and assigned to the whole client area of the destination output device.
nFitMode AT_MODE New value of FitMode option to set. Possible values are:
  • IG_DSPL_FIT_TO_DEVICE
  • IG_DSPL_FIT_TO_WIDTH
  • IG_DSPL_FIT_TO_HEIGHT
  • IG_DSPL_ACTUAL_SIZE
nAlignMode AT_MODE New value of AlignMode option to set. Possible value is OR combination of one constant that sets the horizontal alignment:
  • IG_DSPL_ALIGN_X_LEFT
  • IG_DSPL_ALIGN_X_CENTER
  • IG_DSPL_ALIGN_X_RIGHT
and one that sets the vertical alignment:
  • IG_DSPL_ALIGN_Y_TOP
  • IG_DSPL_ALIGN_Y_CENTER
  • IG_DSPL_ALIGN_Y_BOTTOM
nAspectMode AT_MODE New value of AspectMode option to set. Possible values are:
  • IG_DSPL_ASPECT_FIXED
  • IG_DSPL_ASPECT_NOT_FIXED
dblAspectValue DOUBLE Sets new value to AspectValue option. Possible value may be any positive double.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Sample:

ASCII, Display, GUI Windows, Image Processing, Image Util, Medical, MFC, Poster, Print, Timing, MFC Threads, ArtX, Vector

Example:

 
Copy Code
HIGEAR           hIGear;    /* HIGEAR handle of image  */
DWORD           nGrpID;     /* display group identifier */
AT_RECTANGLE             ImageRect;  /* Image rectangle   */
AT_RECTANGLE             DeviceRect;  /* Device rectangle   */
AT_RECTANGLE             ClipRect;     /* Clip rectangle  */
AT_MODE          nFitMode;     /* Fit mode     */
AT_MODE          nAlignMode;    /* Align mode     */
AT_MODE          nAspectMode;   /* Aspect mode     */
DOUBLE          dAspectValue;      /* Aspect value  */
AT_MODE          nFlags;        /* flags which specify what to set */
/* set all layout parameters */
nFlags =
IG_DSPL_IMAGE_RECT|IG_DSPL_DEVICE_RECT|IG_DSPL_CLIP_RECT|IG_DSPL_FIT_MODE|IG_DSPL_ALIGN_M
ODE|IG_DSPL_ASPECT_MODE|IG_DSPL_ASPECT_VALUE;
IG_dspl_layout_get( hIGear, nGrpID, &ImageRect, &DeviceRect, &ClipRect, nFitMode,
nAlignMode, nAspectMode, dAspectValue );
 ... ...
/* reset image, device and clip rectangles to its default values */
nFlags = IG_DSPL_IMAGE_RECT|IG_DSPL_DEVICE_RECT|IG_DSPL_CLIP_RECT;
IG_dspl_layout_set( hIGear, nGrpID, nFlags, NULL, NULL, NULL, 0, 0, 0, 0.0 );
 ...
/* set new fit mode */
IG_dspl_layout_set( hIGear, nGrpID, IG_DSPL_FIT_MODE, NULL, NULL, NULL,
IG_DSPL_FIT_TO_WIDTH, 0, 0, 0.0 );
 ...
/* set align mode so that the image located at right bottom of device rectangle */
IG_dspl_layout_set( hIGear, nGrpID, IG_DSPL_ALIGN_MODE, NULL, NULL, NULL, 0,
IG_DSPL_ALIGN_X_RIGHT| IG_DSPL_ALIGN_Y_BOTTOM, 0, 0.0 );
 ...

Remarks:

If some of the values are out of range, then it does not change, and an error is returned.

Is this page helpful?
Yes No
Thanks for your feedback.