LDialogImageEffect::DoModalPixelate
#include "ltwrappr.h"
virtual L_INT LDialogImageEffect::DoModalPixelate(hWndOwner)
HWND hWndOwner; |
/* handle of the window which owns the dialog */ |
Displays the Pixelate dialog box, and gets the options for LBitmap::Pixelate. This function is available in the Raster Pro and above toolkits.
Parameter |
Description |
hWndOwner |
Handle of the window which owns the dialog. |
Returns
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. |
Comments
LDialogImageEffect::SetPixelateParams must be called before using this function to set the initial values for the dialog. You can get the updated PIXELATEDLGPARAMS with the values entered by the user through the dialog by using LDialogImageEffect::GetPixelateParams.
This dialog has the following fields:
Zoom to fit
Use this button to fit entire preview images on both the Before and After views.
Zoom to Normal
Use this button to view images with normal scale on both the Before and After views.
Before View
This view shows the original image before the dialog applies any changes to it.
The view can be dragged when it is not in Zoom to Fit zoom mode. Place the mouse cursor over the view window (the cursor will change to a hand), then click and drag.
After View
This view shows the original image with the dialog changes applied. This enables the user to see a preview of what the image should look like when the changes are applied.
The view can be dragged when it is not in Zoom to Fit zoom mode. Place the mouse cursor over the view window (the cursor will change to a hand), then click and drag.
Mode Drop-down list box:
Use this to set the cell division shape. There are two choices:
Rectangle. Divide the image into rectangular cells.
Radial: Divide the image into circular cells. You can specify the center point of these circular cells by right clicking on the Before view. The pivot point appears on the point you just clicked. You can also set the pivot point using the X and Y edit boxes in the Pivot section of the dialog.
Type Drop-down list box:
Use this to set the operation type. There are three choices:
Maximum: fills the cell with its maximum pixel value.
Minimum: fills the cell with its minimum pixel value.
Average: fills the cell with its average pixels value.
Width Section:
The width section contains a drop-down list box and an edit box for setting the cell width. In the drop-down list box there are two choices:
Period. Determines the width of each cell, in pixels. Enter the value directly in the edit box or use the arrows to set the desired value.
Frequency. Determines the number of cells along the width. Enter the value directly in the edit box or use the arrows to set the desired value.
Height Section:
The height section contains a drop-down list box and an edit box for setting the cell height. In the drop-down list box there are two choices:
Period. Determines the height of each cell, in pixels. Enter the value directly in the edit box or use the arrows to set the desired value.
Frequency. Determines the number of cells along the height. Enter the value directly in the edit box or use the arrows to set the desired value.
X Edit box:
Use this to set the pivot's x-axis position in the image. Enter the value directly in the edit box or use the arrows to set the desired value.
Y Edit box:
Use this to set the pivot's y-axis position in the image. Enter the value directly in the edit box or use the arrows to set the desired value.
Cursor Pos (x,y)
Displays the mouse position, with respect to the image.
Opacity Edit box:
Use this to set a percentage value that represents how transparent the cells are, compared to the original pixels. Enter the value directly in the edit box or use the arrows to set the desired value.
Center Button:
Use the Center button to center the Before and After views, with respect to the pivot point position.
OK
Use the OK button to close the dialog and apply the changes.
Cancel
Use the Cancel button to close the dialog and discard the changes.
Progress Bar
Located at the bottom of the dialog, this progress bar shows the percentage of the current dialog operation that has been completed.
Required DLLs and Libraries
LTDLGIMGEFX 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
Example
L_INT LDialogImageEffect_DoModalPixelateExample(LBitmap * pBitmap, HWND hWnd) { L_INT nRet; LDialogImageEffect DlgImageEffect; nRet = LDialogImageEffect::Initialize(DLG_INIT_COLOR ); if(nRet != SUCCESS) return nRet; DlgImageEffect.SetBitmap(pBitmap); PIXELATEDLGPARAMS DlgParams; memset ( &DlgParams, 0, sizeof ( PIXELATEDLGPARAMS ) ); DlgParams.uStructSize = sizeof ( PIXELATEDLGPARAMS ); DlgParams.uDlgFlags = DLG_PIXELATE_SHOW_PREVIEW | DLG_PIXELATE_SHOW_TOOL_ZOOMLEVEL; DlgImageEffect.EnableCallBack (FALSE); DlgImageEffect.EnablePreview(TRUE); DlgImageEffect.EnableAutoProcess(TRUE); DlgImageEffect.EnableToolbar(TRUE); nRet = DlgImageEffect.SetPixelateParams(&DlgParams); if(nRet != SUCCESS) return nRet; nRet = DlgImageEffect.DoModalPixelate(hWnd); if(nRet < 1) return nRet; // Gets the updated values for the structure nRet = DlgImageEffect.GetPixelateParams(&DlgParams, sizeof(DlgParams)); if(nRet != SUCCESS) return nRet; nRet = LDialogImageEffect::Free(); if(nRet != SUCCESS) return nRet; return SUCCESS; }