Displays the Canvas Resize dialog box.
#include "l_bitmap.h"
L_LTDLG_API L_INT L_DlgCanvasResize(hWndOwner, pDlgParams)
Handle of the window which owns the dialog.
Pointer to a CANVASRESIZEDLGPARAMS structure to be updated with the values entered by the user, through the dialog. Set members of this structure, before calling this function, to set the dialogs initial values.
Value | Meaning |
---|---|
SUCCESS_DLG_OK | The "OK" button was pressed, and the dialog exited successfully. |
SUCCESS_DLG_CANCEL | The "Cancel" button was pressed, and the dialog exited successfully. |
< 1 | An error occurred. Refer to Return Codes. |
L_INT DlgCanvasResizeExample(HWND hWnd,pBITMAPHANDLE pBitmap)
{
CANVASRESIZEDLGPARAMS DlgParams ;
L_INT nRet ;
memset ( &DlgParams, 0, sizeof ( CANVASRESIZEDLGPARAMS ) ) ;
DlgParams.uStructSize = sizeof ( CANVASRESIZEDLGPARAMS ) ;
DlgParams.pBitmap = pBitmap ;
DlgParams.uDlgFlags = DLG_CANVASRESIZE_SHOW_CURRENT_HEIGHT |
DLG_CANVASRESIZE_SHOW_CURRENT_WIDTH |
DLG_CANVASRESIZE_SHOW_HORIZPOS |
DLG_CANVASRESIZE_SHOW_VERTZPOS |
DLG_CANVASRESIZE_SHOW_BACKCOLOR |
DLG_CANVASRESIZE_SHOW_KEEPASPECT ;
DlgParams.nCurrentWidth = BITMAPWIDTH ( pBitmap ) ;
DlgParams.nCurrentHeight = BITMAPHEIGHT ( pBitmap ) ;
DlgParams.crBkgnd = RGB ( 255, 255, 255 ) ;
nRet = L_DlgInit ( DLG_INIT_COLOR ) ;
if(nRet != SUCCESS && nRet != ERROR_DLG_ALREADYINITIATED)
return nRet;
nRet = L_DlgCanvasResize ( hWnd, &DlgParams ) ;
L_DlgFree ( ) ;
if ( SUCCESS_DLG_OK == nRet )
{
BITMAPHANDLE BitmapTemp ;
nRet = L_CreateBitmap(&BitmapTemp,
sizeof(BITMAPHANDLE),
TYPE_CONV,
DlgParams.nNewWidth,
DlgParams.nNewHeight,
pBitmap->BitsPerPixel,
pBitmap->Order,
NULL,
pBitmap->ViewPerspective,
NULL,
0 ) ;
if(nRet != SUCCESS)
return nRet;
nRet = L_CombineBitmap(&BitmapTemp,
DlgParams.ptTopLeft.x,
DlgParams.ptTopLeft.y,
BITMAPWIDTH ( pBitmap ),
BITMAPHEIGHT ( pBitmap ),
pBitmap,
0,
0,
CB_OP_AND | CB_DST_1, 0) ;
if(nRet != SUCCESS)
return nRet;
nRet = L_CopyBitmap(pBitmap, &BitmapTemp, sizeof(BITMAPHANDLE)) ;
if(nRet != SUCCESS)
return nRet;
L_FreeBitmap( &BitmapTemp ) ;
}
else if(nRet < 1)
return nRet;
return SUCCESS;
}