// mfcdeVw.cpp : implementation of the CMfcdemoView class // #include "stdafx.h" #include "mfcdemo.h" #include "mfcdedoc.h" #include "mfcdevw.h" #include "BrowsDlg.h" #include "maindemo.h" #include "listdlg.h" #include "rangedlg.h" #include "scrlinfo.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern CMfcdemoApp theApp; #define SZ_COMPASS _T("North|North-East|East|South-East|South|South-West|West|North-West|") #define SZ_SHIFTDIFF _T("Diagonal|Horizontal|Vertical|") #define SZ_LINESEG _T("Horizontal|Vertical|Left to Right|Right to Left|") #define SZ_LAPLACE _T("Filter 1|Filter 2|Filter 3|Diagonal|Horizontal|Vertical|") #define SZ_HORZVERT _T("Horizontal|Vertical|"); #define SZ_BINARY _T("Omnidirectional|Horizontal|Vertical|Diagonal|") static int aGradientFlt[] = { FLT_GRADIENT_N, FLT_GRADIENT_NE, FLT_GRADIENT_E, FLT_GRADIENT_SE, FLT_GRADIENT_S, FLT_GRADIENT_SW, FLT_GRADIENT_W, FLT_GRADIENT_NW }; static int aLaplaceFlt[] = { FLT_LAPLACE_1, FLT_LAPLACE_2, FLT_LAPLACE_3, FLT_LAPLACE_DIAG, FLT_LAPLACE_HORZ, FLT_LAPLACE_VERT, }; static int aSobelFlt[] = { FLT_SOBEL_HORZ, FLT_SOBEL_VERT, }; static int aPrewittFlt[] = { FLT_PREWITT_HORZ, FLT_PREWITT_VERT, }; static int aShiftDiffFlt[] = { FLT_SHIFTDIFF_DIAG, FLT_SHIFTDIFF_HORZ, FLT_SHIFTDIFF_VERT, }; static int aLineSegFlt[] = { FLT_LINESEG_HORZ, FLT_LINESEG_VERT, FLT_LINESEG_LTOR, FLT_LINESEG_RTOL, }; static int aErosionFlt[] = { BFLT_EROSION_OMNI, BFLT_EROSION_HORZ, BFLT_EROSION_VERT, BFLT_EROSION_DIAG, }; static int aDilationFlt[] = { BFLT_DILATION_OMNI, BFLT_DILATION_HORZ, BFLT_DILATION_VERT, BFLT_DILATION_DIAG, }; ///////////////////////////////////////////////////////////////////////////// // CMfcdemoView IMPLEMENT_DYNCREATE(CMfcdemoView, CFormView) BEGIN_MESSAGE_MAP(CMfcdemoView, CFormView) //{{AFX_MSG_MAP(CMfcdemoView) ON_MESSAGE(WM_DOREALIZE, OnDoRealize) ON_COMMAND(ID_IMAGE_FLIP, OnImageFlip) ON_COMMAND(ID_IMAGE_REVERSE, OnImageReverse) ON_COMMAND(ID_IMAGE_ROTATE_180CLOCKWISE, OnImageRotate180clockwise) ON_COMMAND(ID_IMAGE_ROTATE_270CLOCKWISE, OnImageRotate270clockwise) ON_COMMAND(ID_IMAGE_ROTATE_90CLOCKWISE, OnImageRotate90clockwise) ON_COMMAND(ID_COLOR_GRAYSCALE, OnColorGrayscale) ON_COMMAND(ID_COLOR_GRAYSCALE12, OnColorGrayscale12) ON_COMMAND(ID_COLOR_GRAYSCALE16, OnColorGrayscale16) ON_COMMAND(ID_COLOR_HISTOGRAMEQUALIZE, OnColorHistogramequalize) ON_COMMAND(ID_COLOR_INVERT, OnColorInvert) ON_COMMAND(ID_COLOR_STRETCHINTENSITY, OnColorStretchintensity) ON_COMMAND(ID_IMAGE_EFFECTS_POSTERIZE, OnImageEffectsPosterize) ON_COMMAND(ID_COLOR_BRIGHTNESS, OnColorBrightness) ON_COMMAND(ID_COLOR_CONTRAST, OnColorContrast) ON_COMMAND(ID_COLOR_HISTOCONTRAST, OnColorHistocontrast) ON_COMMAND(ID_COLOR_HUE, OnColorHue) ON_COMMAND(ID_COLOR_SATURATION, OnColorSaturation) ON_COMMAND(ID_IMAGE_EFFECTS_ADDNOISE, OnImageEffectsAddnoise) ON_COMMAND(ID_IMAGE_EFFECTS_AVERAGE, OnImageEffectsAverage) ON_COMMAND(ID_IMAGE_EFFECTS_DESPECKLE, OnImageEffectsDespeckle) ON_COMMAND(ID_IMAGE_EFFECTS_MEDIAN, OnImageEffectsMedian) ON_COMMAND(ID_IMAGE_EFFECTS_MOSAIC, OnImageEffectsMosaic) ON_COMMAND(ID_IMAGE_EFFECTS_SHARPEN, OnImageEffectsSharpen) ON_COMMAND(ID_IMAGE_BINARYFILTERS_DILATION, OnImageBinaryfiltersDilation) ON_COMMAND(ID_IMAGE_BINARYFILTERS_EROSION, OnImageBinaryfiltersErosion) ON_COMMAND(ID_IMAGE_SPATIALFILTERS_GRADIENT, OnImageSpatialfiltersGradient) ON_COMMAND(ID_IMAGE_SPATIALFILTERS_LAPLACIAN, OnImageSpatialfiltersLaplacian) ON_COMMAND(ID_IMAGE_SPATIALFILTERS_LINESEGMENT, OnImageSpatialfiltersLinesegment) ON_COMMAND(ID_IMAGE_SPATIALFILTERS_PREWITT, OnImageSpatialfiltersPrewitt) ON_COMMAND(ID_IMAGE_SPATIALFILTERS_SHIFTANDDIFFERENCE, OnImageSpatialfiltersShiftanddifference) ON_COMMAND(ID_IMAGE_SPATIALFILTERS_SOBEL, OnImageSpatialfiltersSobel) ON_COMMAND(ID_COLOR_GAMMACORRECT, OnColorGammacorrect) ON_COMMAND(ID_COLOR_INTENSITYDETECT, OnColorIntensitydetect) ON_COMMAND(ID_IMAGE_RESIZE, OnImageResize) ON_COMMAND(ID_IMAGE_ROTATE_ANYANGLE, OnImageRotateAnyangle) ON_COMMAND(ID_IMAGE_SHEAR, OnImageShear) ON_COMMAND(ID_COLOR_COLORRESOLUTION, OnColorColorresolution) ON_COMMAND(ID_VIEW_ZOOM, OnViewZoom) ON_COMMAND(ID_VIEW_NORMAL, OnViewNormal) ON_COMMAND(ID_VIEW_PAINTEFFECTS, OnViewPainteffects) ON_COMMAND(ID_VIEW_SNAPWINDOWTOIMAGE, OnViewSnapwindowtoimage) ON_COMMAND(ID_VIEW_FITIMAGETOWINDOW, OnViewFitimagetowindow) ON_COMMAND(ID_IMAGE_EFFECTS_EMBOSS, OnImageEffectsEmboss) ON_COMMAND(ID_COLOR_HALFTONE, OnColorHalftone) ON_COMMAND(ID_COLOR_FILL, OnColorFill) ON_COMMAND(ID_EDIT_UNDO, OnEditUndo) ON_COMMAND(ID_EDIT_COPY, OnEditCopy) ON_COMMAND(ID_COLOR_SEPARATION, OnColorSeparation) ON_UPDATE_COMMAND_UI(ID_EDIT_UNDO, OnUpdateEditUndo) ON_COMMAND(ID_IMAGE_DESKEW, OnImageDeskew) ON_COMMAND(ID_IMAGE_EFFECTS_UNDERLAY, OnImageEffectsUnderlay) ON_UPDATE_COMMAND_UI(ID_IMAGE_DESKEW, OnUpdateImageDeskew) ON_UPDATE_COMMAND_UI(ID_IMAGE_BINARYFILTERS_DILATION, OnUpdateImageBinaryfiltersDilation) ON_UPDATE_COMMAND_UI(ID_IMAGE_BINARYFILTERS_EROSION, OnUpdateImageBinaryfiltersErosion) ON_UPDATE_COMMAND_UI(ID_IMAGE_EFFECTS_DESPECKLE, OnUpdateImageEffectsDespeckle) ON_WM_SIZE() ON_COMMAND(IDM_TOOLNONE, OnToolnone) ON_UPDATE_COMMAND_UI(IDM_TOOLNONE, OnUpdateToolnone) ON_COMMAND(IDM_TOOLELLIPSE, OnToolellipse) ON_UPDATE_COMMAND_UI(IDM_TOOLELLIPSE, OnUpdateToolellipse) ON_COMMAND(IDM_TOOLFREEHAND, OnToolfreehand) ON_UPDATE_COMMAND_UI(IDM_TOOLFREEHAND, OnUpdateToolfreehand) ON_COMMAND(IDM_TOOLRECT, OnToolrect) ON_UPDATE_COMMAND_UI(IDM_TOOLRECT, OnUpdateToolrect) ON_COMMAND(IDM_TOOLRNDRECT, OnToolrndrect) ON_UPDATE_COMMAND_UI(IDM_TOOLRNDRECT, OnUpdateToolrndrect) ON_UPDATE_COMMAND_UI(ID_IMAGE_REGIONTRANSFORMATIONS_CANCEL, OnUpdateImageRegiontransformationsCancel) ON_COMMAND(ID_IMAGE_REGIONTRANSFORMATIONS_CANCEL, OnImageRegiontransformationsCancel) ON_UPDATE_COMMAND_UI(ID_IMAGE_SHEAR, OnUpdateImageShear) ON_COMMAND(ID_COLOR_WINDOWLEVEL, OnColorWindowlevel) ON_UPDATE_COMMAND_UI(ID_COLOR_WINDOWLEVEL, OnUpdateColorWindowlevel) ON_COMMAND(ID_COLOR_CONTOURFILTER, OnColorContourFilter) ON_COMMAND(ID_COLOR_PICTURIZE, OnColorPicturize) ON_COMMAND(ID_IMAGE_DOCUMENTIMAGING_SMOOTH, OnImageDocumentimagingSmooth) ON_UPDATE_COMMAND_UI(ID_IMAGE_DOCUMENTIMAGING_SMOOTH, OnUpdateImageDocumentimagingSmooth) ON_COMMAND(ID_IMAGE_DOCUMENTIMAGING_LINEREMOVE, OnImageDocumentimagingLineremove) ON_UPDATE_COMMAND_UI(ID_IMAGE_DOCUMENTIMAGING_LINEREMOVE, OnUpdateImageDocumentimagingLineremove) ON_COMMAND(ID_IMAGE_DOCUMENTIMAGING_DOTREMOVE, OnImageDocumentimagingDotremove) ON_UPDATE_COMMAND_UI(ID_IMAGE_DOCUMENTIMAGING_DOTREMOVE, OnUpdateImageDocumentimagingDotremove) ON_COMMAND(ID_IMAGE_DOCUMENTIMAGING_INVERTEDTEXT, OnImageDocumentimagingInvertedtext) ON_UPDATE_COMMAND_UI(ID_IMAGE_DOCUMENTIMAGING_INVERTEDTEXT, OnUpdateImageDocumentimagingInvertedtext) ON_COMMAND(ID_IMAGE_DOCUMENTIMAGING_BORDERREMOVE, OnImageDocumentimagingBorderremove) ON_UPDATE_COMMAND_UI(ID_IMAGE_DOCUMENTIMAGING_BORDERREMOVE, OnUpdateImageDocumentimagingBorderremove) ON_COMMAND(ID_IMAGE_DOCUMENTIMAGING_HOLEPUNCHREMOVE, OnImageDocumentimagingHolepunchremove) ON_UPDATE_COMMAND_UI(ID_IMAGE_DOCUMENTIMAGING_HOLEPUNCHREMOVE, OnUpdateImageDocumentimagingHolepunchremove) ON_COMMAND(ID_VIEW_PANWINDOW, OnViewPanwindow) ON_COMMAND(ID_VIEW_MAGNIFYINGGLASS, OnViewMagnifyingglass) ON_UPDATE_COMMAND_UI(ID_VIEW_MAGNIFYINGGLASS, OnUpdateViewMagnifyingglass) ON_UPDATE_COMMAND_UI(ID_VIEW_PANWINDOW, OnUpdateViewPanwindow) ON_WM_DESTROY() ON_WM_ERASEBKGND() ON_WM_SYSCOMMAND() ON_UPDATE_COMMAND_UI(ID_VIEW_PAINTEFFECTS, OnUpdateViewPainteffects) ON_UPDATE_COMMAND_UI(ID_VIEW_NORMAL, OnUpdateViewNormal) ON_UPDATE_COMMAND_UI(ID_COLOR_HISTOCONTRAST, OnUpdateColorHistocontrast) ON_COMMAND(IDM_REMOVEREDEYE, OnRemoveredeye) ON_UPDATE_COMMAND_UI(IDM_REMOVEREDEYE, OnUpdateRemoveredeye) ON_COMMAND(IDM_ADDBORDER, OnAddborder) ON_COMMAND(IDM_ADDFRAME, OnAddframe) ON_COMMAND(IDM_CANVASSIZE, OnCanvassize) ON_COMMAND(IDM_HISTOGRAM, OnHistogram) ON_COMMAND(IDM_MOTIONBLUR, OnMotionblur) ON_COMMAND(IDM_ZOOMBLUR, OnZoomblur) ON_COMMAND(IDM_RADIALBLUR, OnRadialblur) ON_COMMAND(IDM_GAUSSIANBLUR, OnGaussianblur) ON_COMMAND(IDM_ANTIALIAS, OnAntialias) ON_COMMAND(IDM_MAXFILTER, OnMaxfilter) ON_COMMAND(IDM_MINFILTER, OnMinfilter) ON_COMMAND(IDM_UNSHARPMASK, OnUnsharpmask) ON_COMMAND(IDM_MULTIPLY, OnMultiply) ON_COMMAND(IDM_OILIFY, OnOilify) ON_COMMAND(IDM_PALETTEEDITOR, OnPaletteeditor) ON_COMMAND(IDM_ADDBITMAPS, OnAddbitmaps) ON_COMMAND(IDM_BALANCECOLORS, OnBalancecolors) ON_COMMAND(IDM_BENDING, OnBending) ON_COMMAND(IDM_COLOREDGRAY, OnColoredgray) ON_COMMAND(IDM_COUNTCOLORS, OnCountcolors) ON_COMMAND(IDM_CYLINDRICAL, OnCylindrical) ON_COMMAND(IDM_STITCH, OnStitch) ON_COMMAND(IDM_PIXELATE, OnPixelate) ON_COMMAND(IDM_PNGWEBTUNER, OnPngwebtuner) ON_COMMAND(IDM_POLAR, OnPolar) ON_COMMAND(IDM_PREVIEW, OnPreview) ON_COMMAND(IDM_PRINTSTITCHEDIMAGES, OnPrintstitchedimages) ON_COMMAND(IDM_PUNCH, OnPunch) ON_COMMAND(IDM_RADIALWAVE, OnRadialwave) ON_COMMAND(IDM_REMAPHUE, OnRemaphue) ON_COMMAND(IDM_REMAPINTENSITY, OnRemapintensity) ON_COMMAND(IDM_RIPPLE, OnRipple) ON_COMMAND(IDM_SPHERIZE, OnSpherize) ON_COMMAND(IDM_SWIRL, OnSwirl) ON_COMMAND(IDM_WAVE, OnWave) ON_COMMAND(IDM_WAVESHEAR, OnWaveshear) ON_COMMAND(IDM_WIND, OnWind) ON_COMMAND(IDM_ZOOMWAVE, OnZoomwave) ON_COMMAND(IDM_FREEHANDWAVE, OnFreehandwave) ON_COMMAND(IDM_IMPRESSION, OnImpression) ON_COMMAND(IDM_EDGEDETECT, OnEdgedetect) ON_COMMAND(ID_COLOR_SOLARIZE, OnColorSolarize) ON_COMMAND(IDM_GRAYSCALE, OnGrayscale) ON_COMMAND(IDM_LOCALEQUALIZE, OnLocalequalize) ON_COMMAND(IDM_IMAGEMAPPER, OnImagemapper) ON_COMMAND(IDM_JPEGWEBTUNER, OnJpegwebtuner) ON_COMMAND(IDM_GIFWEBTUNER, OnGifwebtuner) ON_COMMAND(IDM_FILLBLACK, OnFillblack) ON_COMMAND(IDM_FILLBLUE, OnFillblue) ON_COMMAND(IDM_FILLCYAN, OnFillcyan) ON_COMMAND(IDM_FILLGREEN, OnFillgreen) ON_COMMAND(IDM_FILLMAGENTA, OnFillmagenta) ON_COMMAND(IDM_FILLRED, OnFillred) ON_COMMAND(IDM_FILLWHITE, OnFillwhite) ON_COMMAND(IDM_FILLYELLOW, OnFillyellow) ON_COMMAND(IDM_COLORSEP_RGB, OnColorsepRgb) ON_COMMAND(IDM_COLORSEP_ALPHA, OnColorsepAlpha) ON_COMMAND(IDM_COLORSEP_CMY, OnColorsepCmy) ON_COMMAND(IDM_COLORSEP_CMYK, OnColorsepCmyk) ON_COMMAND(IDM_COLORSEP_HLS, OnColorsepHls) ON_COMMAND(IDM_COLORSEP_HSV, OnColorsepHsv) ON_UPDATE_COMMAND_UI(IDM_BALANCECOLORS, OnUpdateBalancecolors) ON_UPDATE_COMMAND_UI(ID_COLOR_BRIGHTNESS, OnUpdateColorBrightness) ON_UPDATE_COMMAND_UI(ID_COLOR_COLORRESOLUTION, OnUpdateColorColorresolution) ON_UPDATE_COMMAND_UI(ID_COLOR_CONTOURFILTER, OnUpdateColorContourfilter) ON_UPDATE_COMMAND_UI(ID_COLOR_CONTRAST, OnUpdateColorContrast) ON_UPDATE_COMMAND_UI(ID_COLOR_GAMMACORRECT, OnUpdateColorGammacorrect) ON_UPDATE_COMMAND_UI(ID_COLOR_GRAYSCALE, OnUpdateColorGrayscale) ON_UPDATE_COMMAND_UI(ID_COLOR_GRAYSCALE12, OnUpdateColorGrayscale12) ON_UPDATE_COMMAND_UI(ID_COLOR_GRAYSCALE16, OnUpdateColorGrayscale16) ON_UPDATE_COMMAND_UI(ID_COLOR_HALFTONE, OnUpdateColorHalftone) ON_UPDATE_COMMAND_UI(ID_COLOR_HISTOGRAMEQUALIZE, OnUpdateColorHistogramequalize) ON_UPDATE_COMMAND_UI(ID_COLOR_HUE, OnUpdateColorHue) ON_UPDATE_COMMAND_UI(ID_COLOR_INTENSITYDETECT, OnUpdateColorIntensitydetect) ON_UPDATE_COMMAND_UI(ID_COLOR_INVERT, OnUpdateColorInvert) ON_UPDATE_COMMAND_UI(ID_COLOR_PICTURIZE, OnUpdateColorPicturize) ON_UPDATE_COMMAND_UI(ID_COLOR_SATURATION, OnUpdateColorSaturation) ON_UPDATE_COMMAND_UI(ID_COLOR_SOLARIZE, OnUpdateColorSolarize) ON_UPDATE_COMMAND_UI(ID_COLOR_STRETCHINTENSITY, OnUpdateColorStretchintensity) ON_UPDATE_COMMAND_UI(ID_EDIT_COPY, OnUpdateEditCopy) ON_UPDATE_COMMAND_UI(ID_FILE_ACQUIRE, OnUpdateFileAcquire) ON_UPDATE_COMMAND_UI(ID_FILE_BROWSE, OnUpdateFileBrowse) ON_UPDATE_COMMAND_UI(ID_FILE_CAPTURESCREEN, OnUpdateFileCapturescreen) ON_UPDATE_COMMAND_UI(ID_FILE_COLORMERGE, OnUpdateFileColormerge) ON_UPDATE_COMMAND_UI(ID_FILE_ISISACQUIRE, OnUpdateFileIsisacquire) ON_UPDATE_COMMAND_UI(ID_FILE_ISISACQUIREMULTI, OnUpdateFileIsisacquiremulti) ON_UPDATE_COMMAND_UI(ID_FILE_ISISSELECTSOURCE, OnUpdateFileIsisselectsource) ON_UPDATE_COMMAND_UI(ID_IMAGE_EFFECTS_ADDNOISE, OnUpdateImageEffectsAddnoise) ON_UPDATE_COMMAND_UI(ID_IMAGE_EFFECTS_AVERAGE, OnUpdateImageEffectsAverage) ON_UPDATE_COMMAND_UI(ID_IMAGE_EFFECTS_EMBOSS, OnUpdateImageEffectsEmboss) ON_UPDATE_COMMAND_UI(ID_IMAGE_EFFECTS_MEDIAN, OnUpdateImageEffectsMedian) ON_UPDATE_COMMAND_UI(ID_IMAGE_EFFECTS_MOSAIC, OnUpdateImageEffectsMosaic) ON_UPDATE_COMMAND_UI(ID_IMAGE_EFFECTS_POSTERIZE, OnUpdateImageEffectsPosterize) ON_UPDATE_COMMAND_UI(ID_IMAGE_EFFECTS_SHARPEN, OnUpdateImageEffectsSharpen) ON_UPDATE_COMMAND_UI(ID_IMAGE_EFFECTS_UNDERLAY, OnUpdateImageEffectsUnderlay) ON_UPDATE_COMMAND_UI(ID_IMAGE_FLIP, OnUpdateImageFlip) ON_UPDATE_COMMAND_UI(ID_IMAGE_RESIZE, OnUpdateImageResize) ON_UPDATE_COMMAND_UI(ID_IMAGE_REVERSE, OnUpdateImageReverse) ON_UPDATE_COMMAND_UI(ID_IMAGE_ROTATE_180CLOCKWISE, OnUpdateImageRotate180clockwise) ON_UPDATE_COMMAND_UI(ID_IMAGE_ROTATE_270CLOCKWISE, OnUpdateImageRotate270clockwise) ON_UPDATE_COMMAND_UI(ID_IMAGE_ROTATE_90CLOCKWISE, OnUpdateImageRotate90clockwise) ON_UPDATE_COMMAND_UI(ID_IMAGE_ROTATE_ANYANGLE, OnUpdateImageRotateAnyangle) ON_UPDATE_COMMAND_UI(ID_IMAGE_SPATIALFILTERS_GRADIENT, OnUpdateImageSpatialfiltersGradient) ON_UPDATE_COMMAND_UI(ID_IMAGE_SPATIALFILTERS_LAPLACIAN, OnUpdateImageSpatialfiltersLaplacian) ON_UPDATE_COMMAND_UI(ID_IMAGE_SPATIALFILTERS_LINESEGMENT, OnUpdateImageSpatialfiltersLinesegment) ON_UPDATE_COMMAND_UI(ID_IMAGE_SPATIALFILTERS_PREWITT, OnUpdateImageSpatialfiltersPrewitt) ON_UPDATE_COMMAND_UI(ID_IMAGE_SPATIALFILTERS_SHIFTANDDIFFERENCE, OnUpdateImageSpatialfiltersShiftanddifference) ON_UPDATE_COMMAND_UI(ID_IMAGE_SPATIALFILTERS_SOBEL, OnUpdateImageSpatialfiltersSobel) ON_UPDATE_COMMAND_UI(ID_NEXT_PANE, OnUpdateNextPane) ON_UPDATE_COMMAND_UI(ID_PREFERENCES_BITONALSCALING_FAVORBLACK, OnUpdatePreferencesBitonalscalingFavorblack) ON_UPDATE_COMMAND_UI(ID_PREFERENCES_BITONALSCALING_NORMAL, OnUpdatePreferencesBitonalscalingNormal) ON_UPDATE_COMMAND_UI(ID_PREFERENCES_BITONALSCALING_SCALETOGRAY, OnUpdatePreferencesBitonalscalingScaletogray) ON_UPDATE_COMMAND_UI(ID_PREFERENCES_DITHERING_ERRORDIFFUSION, OnUpdatePreferencesDitheringErrordiffusion) ON_UPDATE_COMMAND_UI(ID_PREFERENCES_DITHERING_ORDERED, OnUpdatePreferencesDitheringOrdered) ON_UPDATE_COMMAND_UI(ID_PREFERENCES_PAINTSCALING_BICUBIC, OnUpdatePreferencesPaintscalingBicubic) ON_UPDATE_COMMAND_UI(ID_PREFERENCES_PAINTSCALING_NORMAL, OnUpdatePreferencesPaintscalingNormal) ON_UPDATE_COMMAND_UI(ID_PREFERENCES_PAINTSCALING_RESAMPLE, OnUpdatePreferencesPaintscalingResample) ON_UPDATE_COMMAND_UI(ID_PREFERENCES_PALETTE_AUTO, OnUpdatePreferencesPaletteAuto) ON_UPDATE_COMMAND_UI(ID_PREFERENCES_PALETTE_FIXED, OnUpdatePreferencesPaletteFixed) ON_UPDATE_COMMAND_UI(ID_PREV_PANE, OnUpdatePrevPane) ON_UPDATE_COMMAND_UI(IDM_ADDBITMAPS, OnUpdateAddbitmaps) ON_UPDATE_COMMAND_UI(IDM_ADDBORDER, OnUpdateAddborder) ON_UPDATE_COMMAND_UI(IDM_ADDFRAME, OnUpdateAddframe) ON_UPDATE_COMMAND_UI(IDM_ANTIALIAS, OnUpdateAntialias) ON_UPDATE_COMMAND_UI(IDM_BENDING, OnUpdateBending) ON_UPDATE_COMMAND_UI(IDM_CANVASSIZE, OnUpdateCanvassize) ON_UPDATE_COMMAND_UI(IDM_COLOREDGRAY, OnUpdateColoredgray) ON_UPDATE_COMMAND_UI(IDM_COLORSEP_ALPHA, OnUpdateColorsepAlpha) ON_UPDATE_COMMAND_UI(IDM_COLORSEP_CMY, OnUpdateColorsepCmy) ON_UPDATE_COMMAND_UI(IDM_COLORSEP_CMYK, OnUpdateColorsepCmyk) ON_UPDATE_COMMAND_UI(IDM_COLORSEP_HLS, OnUpdateColorsepHls) ON_UPDATE_COMMAND_UI(IDM_COLORSEP_HSV, OnUpdateColorsepHsv) ON_UPDATE_COMMAND_UI(IDM_COLORSEP_RGB, OnUpdateColorsepRgb) ON_UPDATE_COMMAND_UI(IDM_CONVERT, OnUpdateConvert) ON_UPDATE_COMMAND_UI(IDM_COUNTCOLORS, OnUpdateCountcolors) ON_UPDATE_COMMAND_UI(IDM_CYLINDRICAL, OnUpdateCylindrical) ON_UPDATE_COMMAND_UI(IDM_EDGEDETECT, OnUpdateEdgedetect) ON_UPDATE_COMMAND_UI(IDM_FILEFORMATASSOCIATIONS, OnUpdateFileformatassociations) ON_UPDATE_COMMAND_UI(IDM_FILLBLACK, OnUpdateFillblack) ON_UPDATE_COMMAND_UI(IDM_FILLBLUE, OnUpdateFillblue) ON_UPDATE_COMMAND_UI(IDM_FILLCYAN, OnUpdateFillcyan) ON_UPDATE_COMMAND_UI(IDM_FILLGREEN, OnUpdateFillgreen) ON_UPDATE_COMMAND_UI(IDM_FILLMAGENTA, OnUpdateFillmagenta) ON_UPDATE_COMMAND_UI(IDM_FILLRED, OnUpdateFillred) ON_UPDATE_COMMAND_UI(IDM_FILLWHITE, OnUpdateFillwhite) ON_UPDATE_COMMAND_UI(IDM_FILLYELLOW, OnUpdateFillyellow) ON_UPDATE_COMMAND_UI(IDM_FREEHANDWAVE, OnUpdateFreehandwave) ON_UPDATE_COMMAND_UI(IDM_GAUSSIANBLUR, OnUpdateGaussianblur) ON_UPDATE_COMMAND_UI(IDM_GIFWEBTUNER, OnUpdateGifwebtuner) ON_UPDATE_COMMAND_UI(IDM_GRAYSCALE, OnUpdateGrayscale) ON_UPDATE_COMMAND_UI(IDM_HISTOGRAM, OnUpdateHistogram) ON_UPDATE_COMMAND_UI(IDM_IMAGEMAPPER, OnUpdateImagemapper) ON_UPDATE_COMMAND_UI(IDM_IMPRESSION, OnUpdateImpression) ON_UPDATE_COMMAND_UI(IDM_JPEGWEBTUNER, OnUpdateJpegwebtuner) ON_UPDATE_COMMAND_UI(IDM_LOCALEQUALIZE, OnUpdateLocalequalize) ON_UPDATE_COMMAND_UI(IDM_MAXFILTER, OnUpdateMaxfilter) ON_UPDATE_COMMAND_UI(IDM_MINFILTER, OnUpdateMinfilter) ON_UPDATE_COMMAND_UI(IDM_MOTIONBLUR, OnUpdateMotionblur) ON_UPDATE_COMMAND_UI(IDM_MULTIPLY, OnUpdateMultiply) ON_UPDATE_COMMAND_UI(IDM_OILIFY, OnUpdateOilify) ON_UPDATE_COMMAND_UI(IDM_PALETTEEDITOR, OnUpdatePaletteeditor) ON_UPDATE_COMMAND_UI(IDM_PIXELATE, OnUpdatePixelate) ON_UPDATE_COMMAND_UI(IDM_PNGWEBTUNER, OnUpdatePngwebtuner) ON_UPDATE_COMMAND_UI(IDM_POLAR, OnUpdatePolar) ON_UPDATE_COMMAND_UI(IDM_PREVIEW, OnUpdatePreview) ON_UPDATE_COMMAND_UI(IDM_PUNCH, OnUpdatePunch) ON_UPDATE_COMMAND_UI(IDM_RADIALBLUR, OnUpdateRadialblur) ON_UPDATE_COMMAND_UI(IDM_RADIALWAVE, OnUpdateRadialwave) ON_UPDATE_COMMAND_UI(IDM_REMAPHUE, OnUpdateRemaphue) ON_UPDATE_COMMAND_UI(IDM_REMAPINTENSITY, OnUpdateRemapintensity) ON_UPDATE_COMMAND_UI(IDM_RIPPLE, OnUpdateRipple) ON_UPDATE_COMMAND_UI(IDM_SPHERIZE, OnUpdateSpherize) ON_UPDATE_COMMAND_UI(IDM_STITCH, OnUpdateStitch) ON_UPDATE_COMMAND_UI(IDM_SWIRL, OnUpdateSwirl) ON_UPDATE_COMMAND_UI(IDM_UNSHARPMASK, OnUpdateUnsharpmask) ON_UPDATE_COMMAND_UI(IDM_WAVE, OnUpdateWave) ON_UPDATE_COMMAND_UI(IDM_WAVESHEAR, OnUpdateWaveshear) ON_UPDATE_COMMAND_UI(IDM_WIND, OnUpdateWind) ON_UPDATE_COMMAND_UI(IDM_ZOOMBLUR, OnUpdateZoomblur) ON_UPDATE_COMMAND_UI(IDM_ZOOMWAVE, OnUpdateZoomwave) ON_UPDATE_COMMAND_UI(IDM_PRINTSTITCHEDIMAGES, OnUpdatePrintstitchedimages) ON_UPDATE_COMMAND_UI(ID_FILE_SELECTSOURCE, OnUpdateFileSelectsource) //}}AFX_MSG_MAP // Standard printing commands ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMfcdemoView construction/destruction CMfcdemoView::CMfcdemoView() : CFormView(CMfcdemoView::IDD) { //{{AFX_DATA_INIT(CMfcdemoView) //}}AFX_DATA_INIT m_pPalette = NULL; m_nEffect = EFX_EFFECT_NONE; m_nRegionTool = IDM_TOOLNONE; m_nRegionType = 0; m_nZoom = 100; m_bMovingFloater = FALSE; } CMfcdemoView::~CMfcdemoView() { if(m_pPalette) delete m_pPalette; } void CMfcdemoView::DoDataExchange(CDataExchange* pDX) { CFormView::DoDataExchange(pDX); //{{AFX_DATA_MAP(CMfcdemoView) DDX_Control(pDX, IDC_LEADCTRL1, m_Lead); DDX_Control(pDX, IDC_LEADCTRL2, m_Lead3); DDX_Control(pDX, IDC_LEADTHUMBCTRL1, m_LEADThumb); //}}AFX_DATA_MAP } BOOL CMfcdemoView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.style &= ~CS_VREDRAW; cs.style &= ~CS_HREDRAW; return CFormView::PreCreateWindow(cs); } ///////////////////////////////////////////////////////////////////////////// // CMfcdemoView printing BOOL CMfcdemoView::OnPreparePrinting(CPrintInfo* pInfo) { // default preparation return DoPreparePrinting(pInfo); } void CMfcdemoView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: add cleanup after printing } ///////////////////////////////////////////////////////////////////////////// // CMfcdemoView diagnostics #ifdef _DEBUG void CMfcdemoView::AssertValid() const { CFormView::AssertValid(); } void CMfcdemoView::Dump(CDumpContext& dc) const { CFormView::Dump(dc); } CMfcdemoDoc* CMfcdemoView::GetDocument() // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMfcdemoDoc))); return (CMfcdemoDoc*)m_pDocument; } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CMfcdemoView message handlers ///////////////////////////////////////////////////////////////////////////// // CMfcdemoView drawing void CMfcdemoView::OnDraw(CDC* pDC) { CRect rcClip; CSize winext; CSize viewext; CSize paintext; CMfcdemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if(pDC->IsPrinting()) { pDC->SaveDC(); ::GetWindowExtEx(pDC->m_hDC, &winext); ::GetViewportExtEx(pDC->m_hDC, &viewext); paintext.cx = MulDiv((int) m_Lead.GetBitmapWidth(), viewext.cx, winext.cx); paintext.cy = MulDiv((int) m_Lead.GetBitmapHeight(), viewext.cy, winext.cy); ::SetMapMode(pDC->m_hDC, MM_TEXT); // Must use 1,1, in V13 b/c of center option m_Lead.Render((OLE_HANDLE) pDC->m_hDC, (float) 1, (float) 1, (float) paintext.cx, (float) paintext.cy); pDC->RestoreDC(-1); } } void CMfcdemoView::BeginProcessing() { CMfcdemoDoc* pDoc = GetDocument(); pDoc->m_bOldMagGlass = pDoc->m_bMagGlass; if(pDoc->m_bMagGlass) StopMagGlass(); BeginWaitCursor(); GetUndoLead()->SetBitmap(GetDocLead()->GetBitmap()); } void CMfcdemoView::EndProcessing(int nRet) { CMfcdemoDoc* pDoc = GetDocument(); EndWaitCursor(); theApp.DisplayLEADError(nRet); if(nRet == DLG_CANCEL) GetUndoLead()->SetBitmap(0); if(pDoc->m_bOldMagGlass) StartMagGlass(); } void CMfcdemoView::OnChanged() { CMfcdemoDoc* pDoc = GetDocument(); pDoc->SetModifiedFlag(); pDoc->UpdateAllViews(NULL, (LPARAM) 0); } void CMfcdemoView::SetZoom(int nZoom) { CMfcdemoDoc* pDoc = GetDocument(); pDoc->m_bOldMagGlass = pDoc->m_bMagGlass; if(pDoc->m_bMagGlass) StopMagGlass(); m_nZoom = nZoom; OnUpdate(NULL, 0, NULL); if(pDoc->m_bOldMagGlass) StartMagGlass(); } CLead* CMfcdemoView::GetDocLead() { CMfcdemoDoc* pDoc = GetDocument(); return(&pDoc->m_Lead); } CLead* CMfcdemoView::GetUndoLead() { CMfcdemoDoc* pDoc = GetDocument(); return(&pDoc->m_LeadUndo); } void CMfcdemoView::OnInitialUpdate() { CFormView::OnInitialUpdate(); int xExt = (int)m_Lead.GetBitmapWidth(), yExt = (int)m_Lead.GetBitmapHeight(); // Make the CLead control to fit the bitmap and disable CLead's scrolling // Make the form scroll if the window becomes smaller than the bitmap SetScrollSizes(MM_TEXT,CSize(xExt,yExt)); // Make the window fit the image GetParentFrame()->RecalcLayout(); ResizeParentToFit(); // now disable the scroll bars SetScrollSizes(MM_TEXT,CSize(1,1)); CMfcdemoDoc* pDoc = GetDocument(); SetZoom(100); /* this is a hidden control, used only for floater support */ m_Lead3.ShowWindow(SW_HIDE); m_Lead.SetAutoPan(TRUE); } LRESULT CMfcdemoView::OnDoRealize(WPARAM wParam, LPARAM lParam) { if( !IsWindow(m_Lead.m_hWnd) || !m_Lead.GetBitmap() ) return FALSE; if(lParam) { return m_Lead.SendMessage(WM_PALETTECHANGED, wParam); } else { return m_Lead.SendMessage(WM_QUERYNEWPALETTE,0); } } void CMfcdemoView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) { CFormView::OnActivateView(bActivate, pActivateView, pDeactiveView); if (bActivate) { ASSERT(pActivateView == this); OnDoRealize((WPARAM)theApp.m_pMainWnd->m_hWnd, (LPARAM) FALSE); // same as SendMessage(WM_DOREALIZE); } } void CMfcdemoView::OnImageFlip() { if(m_Lead.GetHasRgn()) { OnImageRegiontransformationsFlip(); } else { BeginProcessing(); int nRet = GetDocLead()->Flip(); OnChanged(); EndProcessing(nRet); } } void CMfcdemoView::OnImageReverse() { if(m_Lead.GetHasRgn()) { OnImageRegiontransformationsReverse(); } else { BeginProcessing(); int nRet = GetDocLead()->Reverse(); OnChanged(); EndProcessing(nRet); } } void CMfcdemoView::OnImageRotate180clockwise() { if(m_Lead.GetHasRgn()) { OnImageRegiontransformationsRotate((long) 18000); } else { BeginProcessing(); int nRet = GetDocLead()->Rotate(18000, TRUE, RGB(0, 0, 0)); OnChanged(); EndProcessing(nRet); } } void CMfcdemoView::OnImageRotate270clockwise() { if(m_Lead.GetHasRgn()) { OnImageRegiontransformationsRotate((long) 27000); } else { BeginProcessing(); int nRet = GetDocLead()->Rotate(27000, TRUE, RGB(0, 0, 0)); OnChanged(); EndProcessing(nRet); } } void CMfcdemoView::OnImageRotate90clockwise() { if(m_Lead.GetHasRgn()) { OnImageRegiontransformationsRotate((long) 9000); } else { BeginProcessing(); int nRet = GetDocLead()->Rotate(9000, TRUE, RGB(0, 0, 0)); OnChanged(); EndProcessing(nRet); } } void CMfcdemoView::OnColorGrayscale() { BeginProcessing(); int nRet = GetDocLead()->Grayscale(8); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnColorGrayscale12() { BeginProcessing(); int nRet = GetDocLead()->Grayscale(12); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnColorGrayscale16() { BeginProcessing(); int nRet = GetDocLead()->Grayscale(16); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnColorHistogramequalize() { BeginProcessing(); int nRet = GetDocLead()->HistoEqualize(2 /*YUV_SPACE*/); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnColorInvert() { BeginProcessing(); int nRet = GetDocLead()->Invert(); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnColorStretchintensity() { BeginProcessing(); int nRet = GetDocLead()->StretchIntensity(); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnImageEffectsPosterize() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( POSTERIZE_SHOW_PREVIEW| POSTERIZE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowPosterizeDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->Posterize((short)theApp.m_pRasterClrDlg->Levels); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); return; } void CMfcdemoView::OnColorBrightness() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags(BRIGHTNESS_SHOW_PREVIEW | BRIGHTNESS_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowBrightnessDlg((long)this->m_hWnd); /* the method */ if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->Intensity(theApp.m_pRasterClrDlg->GetChange()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnColorContrast() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags(CONTRAST_SHOW_PREVIEW|CONTRAST_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowContrastDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->Contrast((short)theApp.m_pRasterClrDlg->GetChange()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnColorHistocontrast() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags(HISTOCONTRAST_SHOW_PREVIEW | HISTOCONTRAST_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowHistoContrastDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->HistoContrast((short)theApp.m_pRasterClrDlg->GetChange()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnUpdateColorHistocontrast(CCmdUI* pCmdUI) { pCmdUI->Enable (GetDocument()->m_bStopEffect); } void CMfcdemoView::OnColorHue() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags(HUE_SHOW_PREVIEW | HUE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowHueDlg((long)this->m_hWnd); /* the method */ if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->Hue((short)theApp.m_pRasterClrDlg->GetAngle()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnColorSaturation() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags(SATURATION_SHOW_PREVIEW | SATURATION_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowSaturationDlg((long)this->m_hWnd); /* the method */ if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->Saturation(theApp.m_pRasterClrDlg->GetChange()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageEffectsAddnoise() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( ADDNOISE_SHOW_PREVIEW | ADDNOISE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowAddNoiseDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->AddNoise((short)theApp.m_pRasterImgEfxDlg->GetRange(), (ChannelConstants)theApp.m_pRasterImgEfxDlg->GetChannel()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageEffectsAverage() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( AVERAGE_SHOW_PREVIEW | AVERAGE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowAverageDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->Average((short)theApp.m_pRasterImgEfxDlg->GetDimension()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageEffectsDespeckle() { BeginProcessing(); int nRet = GetDocLead()->Despeckle(); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnImageEffectsMedian() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( MEDIAN_SHOW_PREVIEW | MEDIAN_SHOW_TOOL_ZOOMLEVEL ); nRet = theApp.m_pRasterImgEfxDlg->ShowMedianDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->Median((short)theApp.m_pRasterImgEfxDlg->GetDimension()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageEffectsMosaic() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( MOSAIC_SHOW_PREVIEW| MOSAIC_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowMosaicDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->Mosaic((short)theApp.m_pRasterImgEfxDlg->Dimension); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageEffectsSharpen() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( SHARPENFILTER_SHOW_PREVIEW| SHARPENFILTER_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowSharpenDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->Sharpen((short)theApp.m_pRasterImgEfxDlg->Sharpness); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageBinaryfiltersDilation() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( DILATIONFILTER_SHOW_PREVIEW| DILATIONFILTER_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowDilationFilterDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->BinaryFilter((BinaryFilterConstants)theApp.m_pRasterImgEfxDlg->GetBinaryFilterType()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageBinaryfiltersErosion() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( EROSIONFILTER_SHOW_PREVIEW| EROSIONFILTER_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowErosionFilterDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->BinaryFilter((BinaryFilterConstants)theApp.m_pRasterImgEfxDlg->GetBinaryFilterType()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageSpatialfiltersGradient() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( GRADIENTFILTER_SHOW_PREVIEW| GRADIENTFILTER_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowGradientFilterDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->SpatialFilter((SpatialFilterConstants)theApp.m_pRasterImgEfxDlg->GetSpatialFilterType()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageSpatialfiltersLaplacian() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( LAPLACIANFILTER_SHOW_PREVIEW| LAPLACIANFILTER_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowLaplacianFilterDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->SpatialFilter((SpatialFilterConstants)theApp.m_pRasterImgEfxDlg->GetSpatialFilterType()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageSpatialfiltersLinesegment() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( LINESEGMENTFILTER_SHOW_PREVIEW| LINESEGMENTFILTER_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowLineSegmentFilterDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->SpatialFilter((SpatialFilterConstants)theApp.m_pRasterImgEfxDlg->GetSpatialFilterType()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageSpatialfiltersPrewitt() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( PREWITTFILTER_SHOW_PREVIEW| PREWITTFILTER_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowPrewittFilterDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->SpatialFilter((SpatialFilterConstants)theApp.m_pRasterImgEfxDlg->GetSpatialFilterType()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageSpatialfiltersShiftanddifference() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( SHIFTDIFFERENCEFILTER_SHOW_PREVIEW| SHIFTDIFFERENCEFILTER_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowShiftDifferenceFilterDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->SpatialFilter((SpatialFilterConstants)theApp.m_pRasterImgEfxDlg->GetSpatialFilterType()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageSpatialfiltersSobel() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( SOBELFILTER_SHOW_PREVIEW| SOBELFILTER_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowSobelFilterDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->SpatialFilter((SpatialFilterConstants)theApp.m_pRasterImgEfxDlg->GetSpatialFilterType()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnColorGammacorrect() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags(GAMMAADJUSTMENT_AUTOPROCESS | GAMMAADJUSTMENT_SHOW_PREVIEW | GAMMAADJUSTMENT_SHOW_TOOL_ZOOMLEVEL | GAMMAADJUSTMENT_FORCELINKCHANNELS ); BeginProcessing(); nRet = theApp.m_pRasterClrDlg->ShowGammaAdjustmentDlg((long)this->m_hWnd); /* the method */ OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnImageResize() { int nRet; if(m_Lead.GetHasRgn()) { OnImageRegiontransformationsResize(); return; } //assign the bitmap for preview theApp.m_pRasterImgDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgDlg->PutUIFlags( RESIZE_SHOW_PERCENTAGE | RESIZE_SHOW_IDENTICALVALUE | RESIZE_SHOW_MAINTAINASPECT| RESIZE_SHOW_IDENTICALVALUE | RESIZE_SHOW_RESOLUTION ); theApp.m_pRasterImgDlg->CurrentWidth = (long) GetDocLead()->GetBitmapWidth(); theApp.m_pRasterImgDlg->CurrentHeight= (long) GetDocLead()->GetBitmapHeight(); theApp.m_pRasterImgDlg->CurrentResolutionX = GetDocLead()->GetBitmapXRes(); theApp.m_pRasterImgDlg->CurrentResolutionY = GetDocLead()->GetBitmapYRes(); theApp.m_pRasterImgDlg->PutBitsPerPixel(GetDocLead()->GetBitmapBits()); nRet = theApp.m_pRasterImgDlg->ShowResizeDlg((long)this->m_hWnd); //the method if(nRet == 0 && theApp.m_pRasterImgDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->Size(theApp.m_pRasterImgDlg->GetNewWidth(), theApp.m_pRasterImgDlg->GetNewWidth(), (ResizeConstants)theApp.m_pRasterImgDlg->GetResizeFlags()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageRotateAnyangle() { int nRet; if(m_Lead.GetHasRgn()) { OnImageRegiontransformationsRotate(); } else { theApp.m_pRasterImgDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgDlg->PutBackColor(RGB(255,255,255)); theApp.m_pRasterImgDlg->PutUIFlags( ROTATE_SHOW_BACKCOLOR | ROTATE_SHOW_PREVIEW | ROTATE_SHOW_RESIZE); nRet = theApp.m_pRasterImgDlg->ShowRotateDlg ((long)this->m_hWnd); /* the method */ if(nRet == 0 && theApp.m_pRasterImgDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->Rotate((long) theApp.m_pRasterImgDlg->GetAngle(), /* the property */ theApp.m_pRasterImgDlg->GetRotateFlags(), theApp.m_pRasterImgDlg->GetBackColor() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } } void CMfcdemoView::OnImageShear() { int nRet; if(m_Lead.GetHasRgn()) { OnImageRegiontransformationsShear(); } else { theApp.m_pRasterImgDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgDlg->PutBackColor(RGB(255,255,255)); theApp.m_pRasterImgDlg->PutUIFlags( SHEAR_SHOW_BACKCOLOR | SHEAR_SHOW_PREVIEW | SHEAR_SHOW_HORIZONTAL); nRet = theApp.m_pRasterImgDlg->ShowShearDlg ((long)this->m_hWnd); /* the method */ if(nRet == 0 && theApp.m_pRasterImgDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->Shear((short)theApp.m_pRasterImgDlg->GetAngle(), /* the property */ theApp.m_pRasterImgDlg->GetEnableHorizontal(), theApp.m_pRasterImgDlg->GetBackColor()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } } void CMfcdemoView::OnColorColorresolution() { int nRet; theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutClrResFlags(COLORRES_SHOW_BITALL | COLORRES_SHOW_DITHER_ALL| COLORRES_SHOW_PAL_ALL ); theApp.m_pRasterClrDlg->PutUIFlags( COLORRES_SHOW_PREVIEW | COLORRES_SHOW_TOOL_ZOOMLEVEL | COLORRES_SHOW_OPENPALFILE | COLORRES_SHOW_ORDER ); BeginProcessing(); nRet = theApp.m_pRasterClrDlg->ShowColorResDlg((long)this->m_hWnd); /* the method */ if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); int nPalFlags = theApp.m_pRasterClrDlg->GetPaletteFlags(); int nColors = theApp.m_pRasterClrDlg->GetUserPaletteCount(); int nBPP = theApp.m_pRasterClrDlg->GetBitsPerPixel(); if (nBPP<= 8 && nColors) { for (int i=0; iSetUserPalette(i,theApp.m_pRasterClrDlg->GetUserPalette(i)); } nRet = GetDocLead()->ColorRes(nBPP, (ColorResPaletteConstants)nPalFlags, (ColorResDitherConstants) theApp.m_pRasterClrDlg->GetDitherFlags(), nColors); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnColorIntensitydetect() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( INTENSITYDETECT_AUTOPROCESS | INTENSITYDETECT_SHOW_PREVIEW | INTENSITYDETECT_SHOW_TOOL_ZOOMLEVEL); BeginProcessing(); nRet = theApp.m_pRasterClrDlg->ShowIntensityDetectDlg((long)this->m_hWnd); /* the method */ OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnViewZoom() { CRangeDlg dlg; dlg.m_strTitle = _T("Zoom"); dlg.m_strLabel = _T("&Amount"); dlg.m_nValue = m_nZoom; dlg.m_nMin = 1; dlg.m_nMax = 800; dlg.m_nPage = 100; if(dlg.DoModal() == IDOK) { SetZoom(dlg.m_nValue); } } void CMfcdemoView::OnViewNormal() { SetZoom(100); } void CMfcdemoView::OnUpdateViewNormal(CCmdUI* pCmdUI) { pCmdUI->Enable (TRUE); } static int nEffectIndex[] = { EFX_EFFECT_WIPE_CLASS, EFX_EFFECT_WIPE_MAX, EFX_EFFECT_WIPE_RECTANGLE_CLASS, EFX_EFFECT_WIPE_RECTANGLE_MAX, EFX_EFFECT_WIPE_CIRCLE_CLASS, EFX_EFFECT_WIPE_CIRCLE_MAX, EFX_EFFECT_PUSH_CLASS, EFX_EFFECT_PUSH_MAX, EFX_EFFECT_SLIDE_CLASS, EFX_EFFECT_SLIDE_MAX, EFX_EFFECT_ROLL_CLASS, EFX_EFFECT_ROLL_MAX, EFX_EFFECT_ROTATE_CLASS, EFX_EFFECT_ROTATE_MAX, EFX_EFFECT_ZOOM_CLASS, EFX_EFFECT_ZOOM_MAX, EFX_EFFECT_DRIP_CLASS, EFX_EFFECT_DRIP_MAX, EFX_EFFECT_BLIND_CLASS, EFX_EFFECT_BLIND_MAX, EFX_EFFECT_RANDOM_CLASS, EFX_EFFECT_RANDOM_MAX, EFX_EFFECT_CHECKERBOARD_CLASS, EFX_EFFECT_CHECKERBOARD_MAX, EFX_EFFECT_BLOCKS_CLASS, EFX_EFFECT_BLOCKS_MAX, EFX_EFFECT_CIRCLE_CLASS, EFX_EFFECT_CIRCLE_MAX, EFX_EFFECT_ELLIPSE_CLASS, EFX_EFFECT_ELLIPSE_MAX, }; void CMfcdemoView::OnViewPainteffects() { CClientDC cdc(this); DWORD dw; int i; CMfcdemoDoc* pDoc = GetDocument(); if(pDoc->m_bMagGlass) StopMagGlass(); if(pDoc->m_bPanWin) { m_Lead.ShowPanWin(FALSE); pDoc->m_bPanWin = FALSE; } if (FALSE == GetDocument()->m_bStopEffect) return; if (theApp.m_nEffectsCount) return; theApp.m_nEffectsCount=1; BeginWaitCursor(); BOOL bVal = m_Lead.GetBackErase(); m_Lead.SetBackErase(TRUE); m_Lead.SetEffectDelay(10); GetDocument()->m_bStopEffect=FALSE; m_Lead.SetEnableProgressEvent(TRUE); for (i = 0; i < sizeof(nEffectIndex) / sizeof(nEffectIndex[0]); i += 2) { for (m_nEffect = nEffectIndex[i]; m_nEffect <= nEffectIndex[i+1]; m_nEffect++) { m_Lead.SetPaintEffect(m_nEffect); dw = GetTickCount (); if(GetDocument()->m_bStopEffect) break; while ((GetTickCount () - dw) < 1000); } if(GetDocument()->m_bStopEffect) break; } m_Lead.SetBackErase(FALSE); m_nEffect = EFX_EFFECT_NONE; m_Lead.SetPaintEffect(m_nEffect); m_Lead.SetEnableProgressEvent(FALSE); EndWaitCursor(); if (FALSE == GetDocument()->m_bStopEffect) theApp.m_nEffectsCount = 0; } void CMfcdemoView::OnViewSnapwindowtoimage() { CWnd* pFrame = GetParent(); CRect rcWindow; CRect rcClient; pFrame->ShowWindow(SW_NORMAL); GetClientRect(&rcClient); pFrame->GetWindowRect(&rcWindow); pFrame->GetParent()->ScreenToClient (rcWindow); pFrame->MoveWindow (rcWindow.left, rcWindow.top, rcWindow.Width() + (int) m_Lead.GetDstWidth() - rcClient.Width(), rcWindow.Height() + (int) m_Lead.GetDstHeight() - rcClient.Height()); } void CMfcdemoView::OnViewFitimagetowindow() { m_Lead.SetPaintSizeMode(PAINTSIZEMODE_FIT); } void CMfcdemoView::OnImageEffectsEmboss() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( EMBOSS_SHOW_PREVIEW| EMBOSS_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowEmbossDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->Emboss(theApp.m_pRasterImgEfxDlg->GetDirection(), (short)theApp.m_pRasterImgEfxDlg->Depth); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnColorHalftone() { int nRet; theApp.m_pRasterFileDlg->DialogTitle = "Select Images Folder"; nRet = theApp.m_pRasterFileDlg->ShowDirectoryDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { theApp.m_DlgType = DLG_COLOR; if ( GenerateBitampList ( theApp.m_pRasterFileDlg->GetDirectory(), FALSE ) != 1) { return ; } theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( HALFTONE_SHOW_PREVIEW| HALFTONE_AUTOPROCESS| HALFTONE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowHalftoneDlg((long)this->m_hWnd); OnChanged(); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnColorFill() { CColorDialog dlg; if(dlg.DoModal() == IDOK) { BeginProcessing(); int nRet = GetDocLead()->Fill(dlg.GetColor()); OnChanged(); EndProcessing(nRet); } } void CMfcdemoView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) { CMfcdemoDoc* pDoc = GetDocument(); long hRegion; m_Lead.SetAutoRepaint(FALSE); m_Lead.SetBitmap(GetDocLead()->GetBitmap()); m_Lead.SetPaintPalette(theApp.m_fAutoPalette ? PAINTPALETTE_AUTO : PAINTPALETTE_FIXED); m_Lead.SetPaintDither(theApp.m_fOrderedDither ? PAINTDITHER_ORDERED : PAINTDITHER_DIFFUSION); m_Lead.SetBitonalScaling(theApp.m_nBitonalScaling); m_Lead.SetPaintScaling(theApp.m_nPaintScaling); m_Lead.SetDstRect(m_Lead.GetDstLeft(), m_Lead.GetDstTop(), m_Lead.GetBitmapWidth() * m_nZoom / 100, m_Lead.GetBitmapHeight() * m_nZoom / 100); m_Lead.SetDstClipRect(m_Lead.GetDstLeft(), m_Lead.GetDstTop(), m_Lead.GetDstWidth(), m_Lead.GetDstHeight()); /* copy the region from the document control */ if( GetDocLead()->GetHasRgn() ) { hRegion = GetDocLead()->GetRgnHandle(); m_Lead.SetRgnHandle(hRegion,0.0f,0.0f,L_RGN_SET); m_Lead.SetRgnFrameType(RGNFRAME_ANIMATED); m_Lead.DeleteRgnHandle(hRegion); } else { /* the region processing are only for express toolkits */ if( m_Lead.IsSupportLocked(L_SUPPORT_DOCUMENT) ) { m_Lead.SetRgnFrameType(RGNFRAME_NONE); m_Lead.FreeRgn(); } } m_Lead.SetAutoRepaint(TRUE); } void CMfcdemoView::OnEditUndo() { BeginWaitCursor(); GetDocLead()->SetBitmap(GetUndoLead()->GetBitmap()); GetUndoLead()->SetBitmap(0); OnChanged(); EndWaitCursor(); } void CMfcdemoView::OnUpdateEditUndo(CCmdUI* pCmdUI) { pCmdUI->Enable(GetUndoLead()->GetBitmap() != 0); } void CMfcdemoView::OnEditCopy() { BeginWaitCursor(); GetDocLead()->Copy(COPY_DIB | COPY_DDB | COPY_PALETTE); EndWaitCursor(); } void CMfcdemoView::OnColorSeparation() { CListDlg dlg; int i, nPlanes; dlg.m_strTitle = _T("Separation"); dlg.m_strLabel = _T("&Color Space"); dlg.m_strInit = _T("RGB|CMYK|HSV|HLS|CMY|"); if(dlg.DoModal() == IDOK) { BeginProcessing(); int nRet = GetDocLead()->ColorSeparate(dlg.m_nValue); if(!nRet) { nPlanes = (dlg.m_nValue == COLORSEP_CMYK) ? 4 : 3; for(i = 0; i < nPlanes; i++) { theApp.m_Bitmap = GetDocLead()->GetColorPlanes(i); theApp.OpenDocument(OPENMODE_BITMAP); GetDocLead()->SetColorPlanes(i, 0); } } EndProcessing(nRet); } } void CMfcdemoView::OnImageDeskew() { BeginProcessing(); int nRet = GetDocLead()->Deskew(RGB(255,255,255),0); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnImageEffectsUnderlay() { int nRet; theApp.m_pRasterFileDlg->DialogTitle = "Select Images Folder"; nRet = theApp.m_pRasterFileDlg->ShowDirectoryDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { theApp.m_DlgType = DLG_EFFECT; if ( GenerateBitampList ( theApp.m_pRasterFileDlg->GetDirectory(), FALSE ) != 1) { return ; } theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( UNDERLAY_AUTOPROCESS| UNDERLAY_SHOW_PREVIEW| UNDERLAY_SHOW_TOOL_ZOOMLEVEL); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowUnderlayDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnUpdateImageDeskew(CCmdUI* pCmdUI) { pCmdUI->Enable((GetDocLead()->GetVersionLevel() == VERSIONLEVEL_DOCUMENT||GetDocLead()->GetVersionLevel() == VERSIONLEVEL_MEDICAL) && !m_Lead.GetHasRgn() && GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageShear(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageBinaryfiltersDilation(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocLead()->GetVersionLevel() == VERSIONLEVEL_DOCUMENT||GetDocLead()->GetVersionLevel() == VERSIONLEVEL_MEDICAL && GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageBinaryfiltersErosion(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocLead()->GetVersionLevel() == VERSIONLEVEL_DOCUMENT||GetDocLead()->GetVersionLevel() == VERSIONLEVEL_MEDICAL && GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageEffectsDespeckle(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocLead()->GetVersionLevel() == VERSIONLEVEL_DOCUMENT||GetDocLead()->GetVersionLevel() == VERSIONLEVEL_MEDICAL); } void CMfcdemoView::OnSize(UINT nType, int cx, int cy) { CFormView::OnSize(nType, cx, cy); if( IsWindow(m_Lead.m_hWnd) ) { m_Lead.SetBackErase(FALSE); m_Lead.MoveWindow(0, 0, cx, cy); } } void CMfcdemoView::OnToolnone() { CMfcdemoDoc* pDoc = GetDocument(); SetRegionTool( IDM_TOOLNONE ); if (!pDoc->m_bMagGlass) m_Lead.SetAutoPan(TRUE); } void CMfcdemoView::OnUpdateToolnone(CCmdUI* pCmdUI) { pCmdUI->Enable(!m_Lead.IsSupportLocked(L_SUPPORT_DOCUMENT)); pCmdUI->SetCheck(m_nRegionTool == IDM_TOOLNONE); } void CMfcdemoView::OnToolellipse() { StopMagGlass(); SetRegionTool( IDM_TOOLELLIPSE ); m_Lead.SetAutoPan(FALSE); } void CMfcdemoView::OnUpdateToolellipse(CCmdUI* pCmdUI) { pCmdUI->Enable(!m_Lead.IsSupportLocked(L_SUPPORT_DOCUMENT)); pCmdUI->SetCheck(m_nRegionTool == IDM_TOOLELLIPSE); m_Lead.SetAutoPan(FALSE); } void CMfcdemoView::OnToolfreehand() { StopMagGlass(); SetRegionTool( IDM_TOOLFREEHAND ); m_Lead.SetAutoPan(FALSE); } void CMfcdemoView::OnUpdateToolfreehand(CCmdUI* pCmdUI) { pCmdUI->Enable(!m_Lead.IsSupportLocked(L_SUPPORT_DOCUMENT)); pCmdUI->SetCheck(m_nRegionTool == IDM_TOOLFREEHAND); m_Lead.SetAutoPan(FALSE); } void CMfcdemoView::OnToolrect() { StopMagGlass(); SetRegionTool( IDM_TOOLRECT ); m_Lead.SetAutoPan(FALSE); } void CMfcdemoView::OnUpdateToolrect(CCmdUI* pCmdUI) { pCmdUI->Enable(!m_Lead.IsSupportLocked(L_SUPPORT_DOCUMENT)); pCmdUI->SetCheck(m_nRegionTool == IDM_TOOLRECT); } void CMfcdemoView::OnToolrndrect() { StopMagGlass(); SetRegionTool( IDM_TOOLRNDRECT ); m_Lead.SetAutoPan(FALSE); } void CMfcdemoView::OnUpdateToolrndrect(CCmdUI* pCmdUI) { pCmdUI->Enable(!m_Lead.IsSupportLocked(L_SUPPORT_DOCUMENT)); pCmdUI->SetCheck(m_nRegionTool == IDM_TOOLRNDRECT); } void CMfcdemoView::SetRegionTool( int nNewRegionTool ) { m_nRegionTool = nNewRegionTool; } BEGIN_EVENTSINK_MAP(CMfcdemoView, CFormView) //{{AFX_EVENTSINK_MAP(CMfcdemoView) ON_EVENT(CMfcdemoView, IDC_LEADCTRL1, -605 /* MouseDown */, OnMouseDownLeadctrl1, VTS_I2 VTS_I2 VTS_I4 VTS_I4) ON_EVENT(CMfcdemoView, IDC_LEADCTRL1, -606 /* MouseMove */, OnMouseMoveLeadctrl1, VTS_I2 VTS_I2 VTS_I4 VTS_I4) ON_EVENT(CMfcdemoView, IDC_LEADCTRL1, -607 /* MouseUp */, OnMouseUpLeadctrl1, VTS_I2 VTS_I2 VTS_I4 VTS_I4) ON_EVENT(CMfcdemoView, IDC_LEADCTRL1, 7 /* RgnChange */, OnRgnChangeLeadctrl1, VTS_NONE) ON_EVENT(CMfcdemoView, IDC_LEADCTRL1, -602 /* KeyDown */, OnKeyDownLeadctrl1, VTS_PI2 VTS_I2) ON_EVENT(CMfcdemoView, IDC_LEADCTRL1, 4 /* ProgressStatus */, OnProgressStatusLeadctrl1, VTS_I2) ON_EVENT(CMfcdemoView, IDC_LEADCTRL1, 2 /* Resize */, OnResizeLeadctrl1, VTS_NONE) ON_EVENT(CMfcdemoView, IDC_LEADCTRL1, 23 /* PanWin */, OnPanWinLeadctrl1, VTS_I4 VTS_I2) ON_EVENT(CMfcdemoView, IDC_LEADTHUMBCTRL1, 1 /* ThumbnailEvent */, OnThumbnailEventLeadthumbctrl1, VTS_I4 VTS_BSTR VTS_I2 VTS_I2) //}}AFX_EVENTSINK_MAP END_EVENTSINK_MAP() void CMfcdemoView::OnRgnChangeLeadctrl1() { if(GetDocument()->m_Lead2.GetBitmap() == NULL) SaveBackground(); } void CMfcdemoView::OnMouseDownLeadctrl1(short Button, short Shift, long x, long y) { CMfcdemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if(pDoc->m_bMagGlass) return; /* nothing to do! */ if( Button != 1 ) return; /* nothing to do! */ HCURSOR hOldCursor = SetCursor(LoadCursor(NULL,IDC_WAIT)); if( m_Lead.GetHasRgn() && m_Lead.IsPtInRgn((x - m_Lead.GetDstLeft()) * m_Lead.GetSrcWidth() / m_Lead.GetDstWidth(), (y - m_Lead.GetDstTop()) * m_Lead.GetSrcHeight() / m_Lead.GetDstHeight()) ) { m_Lead.SetAutoRepaint(FALSE); m_Lead.SetRgnMarkingMode(RGNMARK_NONE); m_Lead.SetRgnFrameType(RGNFRAME_NONE); m_xStart = x; m_yStart = y; // we put the floater into the bitmap only when we select another region // if we have a floater at this point, it's because we clicked INSIDE the floater m_Lead.SetFloaterVisible(FALSE); m_Lead.SetFloater(m_Lead.GetBitmap()); // the floater coordinates are relative to the window, while the // ocx region coordinates are relative to the bitmap. Adding m_Lead.DstLeft // converts m_Lead.RgnLeft to window coordinates m_rcFloater.left = (int) ((m_Lead.GetRgnLeft() * m_Lead.GetDstWidth() + m_Lead.GetSrcWidth() - 1) / m_Lead.GetSrcWidth() + m_Lead.GetDstLeft()); m_rcFloater.top = (int) (m_Lead.GetRgnTop() * m_Lead.GetDstHeight() / m_Lead.GetSrcHeight() + m_Lead.GetDstTop()); m_rcFloater.right = (int) (((m_Lead.GetFloaterWidth() + m_Lead.GetRgnLeft()) * m_Lead.GetDstWidth() + m_Lead.GetSrcWidth() - 1) / m_Lead.GetSrcWidth() + m_Lead.GetDstLeft()); m_rcFloater.bottom = (int) ((m_Lead.GetFloaterHeight() + m_Lead.GetRgnTop()) * m_Lead.GetDstHeight() / m_Lead.GetSrcHeight() + m_Lead.GetDstTop()); m_Lead.SetFloaterDstRect((float) m_rcFloater.left, (float) m_rcFloater.top, (float) m_rcFloater.Width(), (float) m_rcFloater.Height()); if( GetDocument()->m_Lead2.GetBitmap() != NULL ) { m_Lead.Combine(m_Lead.GetRgnLeft(), m_Lead.GetRgnTop(), m_Lead.GetFloaterWidth(), m_Lead.GetFloaterHeight(), GetDocument()->m_Lead2.GetBitmap(), 0.0f, 0.0f, L_SRC_COPY ); // RepaintRect uses window coordinates like the floater bitmap m_Lead.RepaintRect(m_Lead.GetFloaterDstLeft(), m_Lead.GetFloaterDstTop(), m_Lead.GetFloaterDstWidth(), m_Lead.GetFloaterDstHeight(), FALSE); } m_Lead.SetFloaterVisible(TRUE); m_bMovingFloater = TRUE; } else if (m_nRegionTool != IDM_TOOLNONE) { m_Lead.SetRgnFrameType(RGNFRAME_NONE); switch(m_nRegionTool) { case IDM_TOOLRECT: m_Lead.SetRgnMarkingMode(RGNMARK_RECT); break; case IDM_TOOLELLIPSE: m_Lead.SetRgnMarkingMode(RGNMARK_ELLIPSE); break; case IDM_TOOLRNDRECT: m_Lead.SetRgnMarkingMode(RGNMARK_ROUNDRECT); break; case IDM_TOOLFREEHAND: m_Lead.SetRgnMarkingMode(RGNMARK_FREEHAND); break; } } GetDocument()->m_Lead2.SetBitmap(0); // the background bitmap is not needed anymore SetCursor(hOldCursor); } void CMfcdemoView::OnMouseMoveLeadctrl1(short Button, short Shift, long x, long y) { if( (Button == 1) && m_bMovingFloater ) { m_Lead.SetFloaterDstRect((float) (m_rcFloater.left + x - m_xStart), (float) (m_rcFloater.top + y - m_yStart), m_Lead.GetFloaterDstWidth(), m_Lead.GetFloaterDstHeight()); } } void CMfcdemoView::OnMouseUpLeadctrl1(short Button, short Shift, long x, long y) { HRGN hRegion; long dx, dy; if (Button != 1) return; /* nothing to do ! */ HCURSOR hOldCursor = SetCursor(LoadCursor(NULL,IDC_WAIT)); if( m_Lead.GetRgnMarkingMode() != RGNMARK_NONE ) { m_Lead.SetRgnMarkingMode(RGNMARK_NONE); m_Lead.SetRgnFrameType(RGNFRAME_ANIMATED); if( m_Lead.GetHasRgn() ) { hRegion = (HRGN)m_Lead.GetRgnHandle(); GetDocLead()->SetRgnHandle((long)hRegion,0.0f,0.0f,L_RGN_SET); m_Lead.DeleteRgnHandle((long)hRegion); } else GetDocLead()->FreeRgn(); GetDocument()->UpdateAllViews(this, (LPARAM)0); } else if(m_bMovingFloater) { m_bMovingFloater = FALSE; m_Lead.SetRgnFrameType(RGNFRAME_NONE); hRegion = (HRGN)m_Lead.GetFloaterHandle(); // Calculate the region offset if(x >= m_xStart) dx = (x - m_xStart) * (long) m_Lead.GetSrcWidth() / (long) m_Lead.GetDstWidth(); else dx = ((x - m_xStart) * (long) m_Lead.GetSrcWidth() - (long) m_Lead.GetDstWidth() + 1) / (long) m_Lead.GetDstWidth(); if(y >= m_yStart) dy = (y - m_yStart) * (long) m_Lead.GetSrcHeight() / (long) m_Lead.GetDstHeight(); else dy = ((y - m_yStart) * (long) m_Lead.GetSrcHeight() - (long) m_Lead.GetDstHeight() + 1) / (long) m_Lead.GetDstHeight(); m_Lead.OffsetRgn((float) dx, (float) dy); // save the background in case we want to move the floater again GetDocument()->m_Lead2.CreateBitmap(m_Lead.GetFloaterWidth(), m_Lead.GetFloaterHeight(), m_Lead.GetBitmapBits() ); if((m_Lead.GetIsGrayscale() != GRAY_NO) && (m_Lead.GetBitmapBits()>8)) GetDocument()->m_Lead2.Grayscale(m_Lead.GetBitmapBits()); GetDocument()->m_Lead2.Combine( 0.0f, 0.0f, m_Lead.GetFloaterWidth(), m_Lead.GetFloaterHeight(), m_Lead.GetBitmap(), m_Lead.GetRgnLeft(), m_Lead.GetRgnTop(), L_SRC_COPY); // now blend the floater into the bitmap and make it dissapear // if we leave it, when we scroll, the floater won't move with the bitmap // that's because the floater is independent of the bitmap m_Lead.Combine( m_Lead.GetRgnLeft(), m_Lead.GetRgnTop(), m_Lead.GetFloaterWidth(), m_Lead.GetFloaterHeight(), m_Lead.GetFloater(), 0.0f, 0.0f, L_SRC_COPY); // free the floater m_Lead.SetFloater(NULL); // draw the frame m_Lead.SetRgnFrameType(RGNFRAME_ANIMATED); m_Lead.DeleteRgnHandle ((long)hRegion); // delete the region object m_Lead.SetAutoRepaint(TRUE); /* update the changes back into the master document and all other views */ UpdateMasterDocument(); } SetCursor(hOldCursor); } void CMfcdemoView::OnImageRegiontransformationsFlip() { long hRegion; float xCenter; float yCenter; HCURSOR hOldCursor = SetCursor(LoadCursor(NULL,IDC_WAIT)); m_Lead.SetAutoRepaint(FALSE); m_Lead.SetFloaterVisible(FALSE); m_Lead.SetFloater(m_Lead.GetBitmap()); RestoreBackground(); m_Lead3.SetBitmap(m_Lead.GetFloater()); m_Lead.SetFloater(0); // do the transformation on the copy m_Lead3.Flip(); m_Lead.SetRgnFrameType(RGNFRAME_NONE); hRegion = m_Lead3.GetRgnHandle(); xCenter = m_Lead.GetRgnLeft() + m_Lead.GetRgnWidth() / 2; yCenter = m_Lead.GetRgnTop() + m_Lead.GetRgnHeight() / 2; /* the next two statements m_Lead.SetRgnHandle(hRegion, 0, 0, L_RGN_SET); m_Lead.OffsetRgn( xCenter - m_Lead3.GetBitmapWidth() / 2, yCenter - m_Lead3.GetBitmapHeight() / 2); do exactly the same thing as the following statement: */ m_Lead.SetRgnHandle(hRegion, xCenter - m_Lead3.GetBitmapWidth() / 2, yCenter - m_Lead3.GetBitmapHeight() / 2, L_RGN_SET); m_Lead.DeleteRgnHandle (hRegion); SaveBackground(); m_Lead.Combine( xCenter - m_Lead3.GetBitmapWidth() / 2, yCenter - m_Lead3.GetBitmapHeight() / 2, m_Lead3.GetBitmapWidth(), m_Lead3.GetBitmapHeight(), m_Lead3.GetBitmap(), 0.0f, 0.0f, L_SRC_COPY); m_Lead.RepaintRect( m_Lead.GetRgnLeft() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth() + m_Lead.GetDstLeft(), m_Lead.GetRgnTop() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth() + m_Lead.GetDstTop(), m_Lead.GetRgnWidth() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth(), m_Lead.GetRgnHeight() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth(), FALSE); m_Lead.SetRgnFrameType(RGNFRAME_ANIMATED); m_Lead3.SetBitmap(0); m_Lead.SetAutoRepaint(TRUE); /* update the changes back into the master document and all other views */ UpdateMasterDocument(); SetCursor(hOldCursor); } void CMfcdemoView::OnImageRegiontransformationsResize() { int nRet; int nWidth, nHeight, nResizeMethod; theApp.m_pRasterImgDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgDlg->CurrentWidth = (long) GetDocLead()->GetRgnWidth(); theApp.m_pRasterImgDlg->CurrentHeight= (long) GetDocLead()->GetRgnHeight(); theApp.m_pRasterImgDlg->CurrentResolutionX = GetDocLead()->GetBitmapXRes(); theApp.m_pRasterImgDlg->CurrentResolutionY = GetDocLead()->GetBitmapYRes(); theApp.m_pRasterImgDlg->PutBitsPerPixel(GetDocLead()->GetBitmapBits ()); nRet = theApp.m_pRasterImgDlg->ShowResizeDlg((long)this->m_hWnd); //the method if (nRet == 0 && theApp.m_pRasterImgDlg->DialogStatus == DLG_OK) { long hRegion; float xCenter; float yCenter; nWidth = theApp.m_pRasterImgDlg->GetNewWidth(); nHeight = theApp.m_pRasterImgDlg->GetNewHeight(); nResizeMethod = theApp.m_pRasterImgDlg->GetResizeFlags(); HCURSOR hOldCursor = SetCursor(LoadCursor(NULL,IDC_WAIT)); m_Lead.SetAutoRepaint(FALSE); m_Lead.SetFloaterVisible(FALSE); m_Lead.SetFloater(m_Lead.GetBitmap()); RestoreBackground(); m_Lead3.SetBitmap(m_Lead.GetFloater()); m_Lead.SetFloater(0); // do the transformation on the copy nRet = m_Lead3.Size((float)nWidth,(float)nHeight, nResizeMethod); m_Lead.SetRgnFrameType(RGNFRAME_NONE); hRegion = m_Lead3.GetRgnHandle(); xCenter = m_Lead.GetRgnLeft() + m_Lead.GetRgnWidth() / 2; yCenter = m_Lead.GetRgnTop() + m_Lead.GetRgnHeight() / 2; m_Lead.SetRgnHandle(hRegion, xCenter - m_Lead3.GetBitmapWidth() / 2, yCenter - m_Lead3.GetBitmapHeight() / 2, L_RGN_SET); m_Lead.DeleteRgnHandle (hRegion); SaveBackground(); m_Lead.Combine( xCenter - m_Lead3.GetBitmapWidth() / 2, yCenter - m_Lead3.GetBitmapHeight() / 2, m_Lead3.GetBitmapWidth(), m_Lead3.GetBitmapHeight(), m_Lead3.GetBitmap(), 0.0f, 0.0f, L_SRC_COPY); m_Lead.RepaintRect( m_Lead.GetRgnLeft() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth() + m_Lead.GetDstLeft(), m_Lead.GetRgnTop() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth() + m_Lead.GetDstTop(), m_Lead.GetRgnWidth() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth(), m_Lead.GetRgnHeight() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth(), FALSE); m_Lead.SetRgnFrameType(RGNFRAME_ANIMATED); m_Lead3.SetBitmap(0); m_Lead.SetAutoRepaint(TRUE); /* update the changes back into the master document and all other views */ UpdateMasterDocument(); SetCursor(hOldCursor); } } void CMfcdemoView::OnImageRegiontransformationsReverse() { long hRegion; float xCenter; float yCenter; HCURSOR hOldCursor = SetCursor(LoadCursor(NULL,IDC_WAIT)); m_Lead.SetAutoRepaint(FALSE); m_Lead.SetFloaterVisible(FALSE); m_Lead.SetFloater(m_Lead.GetBitmap()); RestoreBackground(); m_Lead3.SetBitmap(m_Lead.GetFloater()); m_Lead.SetFloater(0); // do the transformation on the copy m_Lead3.Reverse(); m_Lead.SetRgnFrameType(RGNFRAME_NONE); hRegion = m_Lead3.GetRgnHandle(); xCenter = m_Lead.GetRgnLeft() + m_Lead.GetRgnWidth() / 2; yCenter = m_Lead.GetRgnTop() + m_Lead.GetRgnHeight() / 2; m_Lead.SetRgnHandle(hRegion, xCenter - m_Lead3.GetBitmapWidth() / 2, yCenter - m_Lead3.GetBitmapHeight() / 2, L_RGN_SET); m_Lead.DeleteRgnHandle (hRegion); SaveBackground(); m_Lead.Combine( xCenter - m_Lead3.GetBitmapWidth() / 2, yCenter - m_Lead3.GetBitmapHeight() / 2, m_Lead3.GetBitmapWidth(), m_Lead3.GetBitmapHeight(), m_Lead3.GetBitmap(), 0.0f, 0.0f, L_SRC_COPY); m_Lead.RepaintRect( m_Lead.GetRgnLeft() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth() + m_Lead.GetDstLeft(), m_Lead.GetRgnTop() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth() + m_Lead.GetDstTop(), m_Lead.GetRgnWidth() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth(), m_Lead.GetRgnHeight() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth(), FALSE); m_Lead.SetRgnFrameType(RGNFRAME_ANIMATED); m_Lead3.SetBitmap(0); m_Lead.SetAutoRepaint(TRUE); /* update the changes back into the master document and all other views */ UpdateMasterDocument(); SetCursor(hOldCursor); } void CMfcdemoView::OnImageRegiontransformationsRotate() { int nRet; theApp.m_pRasterImgDlg->PutBitmap(m_Lead.GetBitmap()); theApp.m_pRasterImgDlg->PutBackColor(RGB(255,255,255)); theApp.m_pRasterImgDlg->PutUIFlags(ROTATE_SHOW_BACKCOLOR| ROTATE_SHOW_PREVIEW | ROTATE_SHOW_RESIZE ); nRet = theApp.m_pRasterImgDlg->ShowRotateDlg((long)this->m_hWnd); /* the method */ if(nRet == 0 && theApp.m_pRasterImgDlg->GetDialogStatus() == DLG_OK) { int m_nAngle = (short) theApp.m_pRasterImgDlg->GetAngle(); BOOL m_bResize = theApp.m_pRasterImgDlg->GetEnableResize (); OnImageRegiontransformationsRotate(m_nAngle , m_bResize ); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageRegiontransformationsShear() { int nRet; theApp.m_pRasterImgDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgDlg->PutBackColor(RGB(255,255,255)); theApp.m_pRasterImgDlg->PutUIFlags(SHEAR_SHOW_BACKCOLOR | SHEAR_SHOW_PREVIEW | SHEAR_SHOW_HORIZONTAL); nRet = theApp.m_pRasterImgDlg->ShowShearDlg((long)this->m_hWnd); /* the method */ if(nRet == 0 && theApp.m_pRasterImgDlg->GetDialogStatus() == DLG_OK) { OnImageRegiontransformationsShear(theApp.m_pRasterImgDlg->GetAngle(), theApp.m_pRasterImgDlg->GetEnableResize()); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageRegiontransformationsRotate(long nAngle, BOOL fResize) { long hRegion; float xCenter; float yCenter; HCURSOR hOldCursor = SetCursor(LoadCursor(NULL,IDC_WAIT)); m_Lead.SetAutoRepaint(FALSE); m_Lead.SetFloaterVisible(FALSE); m_Lead.SetFloater(m_Lead.GetBitmap()); RestoreBackground(); m_Lead3.SetBitmap(m_Lead.GetFloater()); m_Lead.SetFloater(0); // do the transformation on the copy m_Lead3.Rotate(nAngle, fResize, RGB(255, 255, 255)); m_Lead.SetRgnFrameType(RGNFRAME_NONE); hRegion = m_Lead3.GetRgnHandle(); xCenter = m_Lead.GetRgnLeft() + m_Lead.GetRgnWidth() / 2; yCenter = m_Lead.GetRgnTop() + m_Lead.GetRgnHeight() / 2; m_Lead.SetRgnHandle(hRegion, xCenter - m_Lead3.GetBitmapWidth() / 2, yCenter - m_Lead3.GetBitmapHeight() / 2, L_RGN_SET); m_Lead.DeleteRgnHandle (hRegion); SaveBackground(); m_Lead.Combine( xCenter - m_Lead3.GetBitmapWidth() / 2, yCenter - m_Lead3.GetBitmapHeight() / 2, m_Lead3.GetBitmapWidth(), m_Lead3.GetBitmapHeight(), m_Lead3.GetBitmap(), 0.0f, 0.0f, L_SRC_COPY); m_Lead.RepaintRect( m_Lead.GetRgnLeft() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth() + m_Lead.GetDstLeft(), m_Lead.GetRgnTop() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth() + m_Lead.GetDstTop(), m_Lead.GetRgnWidth() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth(), m_Lead.GetRgnHeight() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth(), FALSE); m_Lead.SetRgnFrameType(RGNFRAME_ANIMATED); m_Lead3.SetBitmap(0); m_Lead.SetAutoRepaint(TRUE); /* update the changes back into the master document and all other views */ UpdateMasterDocument(); SetCursor(hOldCursor); } void CMfcdemoView::OnImageRegiontransformationsShear(long nAngle, BOOL fResize) { long hRegion; float xCenter; float yCenter; HCURSOR hOldCursor = SetCursor(LoadCursor(NULL,IDC_WAIT)); m_Lead.SetAutoRepaint(FALSE); m_Lead.SetFloaterVisible(FALSE); m_Lead.SetFloater(m_Lead.GetBitmap()); RestoreBackground(); m_Lead3.SetBitmap(m_Lead.GetFloater()); m_Lead.SetFloater(0); // do the transformation on the copy m_Lead3.Shear((short)nAngle, fResize, RGB(255, 255, 255)); m_Lead.SetRgnFrameType(RGNFRAME_NONE); hRegion = m_Lead3.GetRgnHandle(); xCenter = m_Lead.GetRgnLeft() + m_Lead.GetRgnWidth() / 2; yCenter = m_Lead.GetRgnTop() + m_Lead.GetRgnHeight() / 2; m_Lead.SetRgnHandle(hRegion, xCenter - m_Lead3.GetBitmapWidth() / 2, yCenter - m_Lead3.GetBitmapHeight() / 2, L_RGN_SET); m_Lead.DeleteRgnHandle (hRegion); SaveBackground(); m_Lead.Combine( xCenter - m_Lead3.GetBitmapWidth() / 2, yCenter - m_Lead3.GetBitmapHeight() / 2, m_Lead3.GetBitmapWidth(), m_Lead3.GetBitmapHeight(), m_Lead3.GetBitmap(), 0.0f, 0.0f, L_SRC_COPY); m_Lead.RepaintRect( m_Lead.GetRgnLeft() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth() + m_Lead.GetDstLeft(), m_Lead.GetRgnTop() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth() + m_Lead.GetDstTop(), m_Lead.GetRgnWidth() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth(), m_Lead.GetRgnHeight() * m_Lead.GetDstWidth() / m_Lead.GetSrcWidth(), FALSE); m_Lead.SetRgnFrameType(RGNFRAME_ANIMATED); m_Lead3.SetBitmap(0); m_Lead.SetAutoRepaint(TRUE); /* update the changes back into the master document and all other views */ UpdateMasterDocument(); SetCursor(hOldCursor); } void CMfcdemoView::UpdateMasterDocument() { /* merge the changes back into the master document */ long hRegion = m_Lead.GetRgnHandle(); GetDocLead()->SetBitmap(m_Lead.GetBitmap()); GetDocLead()->SetRgnHandle(hRegion,0.0f,0.0f,L_RGN_SET); m_Lead.DeleteRgnHandle(hRegion); GetDocument()->UpdateAllViews(this, (LPARAM)0); } void CMfcdemoView::SaveBackground() { GetDocument()->m_Lead2.CreateBitmap(m_Lead.GetRgnWidth(), m_Lead.GetRgnHeight(), m_Lead.GetBitmapBits()); if((m_Lead.GetIsGrayscale() != GRAY_NO) && (m_Lead.GetBitmapBits()>8)) GetDocument()->m_Lead2.Grayscale(m_Lead.GetBitmapBits()); GetDocument()->m_Lead2.Combine( 0.0f, 0.0f, m_Lead.GetRgnWidth(), m_Lead.GetRgnHeight(), m_Lead.GetBitmap(), m_Lead.GetRgnLeft(), m_Lead.GetRgnTop(), L_SRC_COPY); } void CMfcdemoView::RestoreBackground() { if(GetDocument()->m_Lead2.GetBitmap()) m_Lead.Combine( m_Lead.GetRgnLeft(), m_Lead.GetRgnTop(), m_Lead.GetRgnWidth(), m_Lead.GetRgnHeight(), GetDocument()->m_Lead2.GetBitmap(), 0.0f, 0.0f, L_SRC_COPY); } void CMfcdemoView::OnUpdateImageRegiontransformationsCancel(CCmdUI* pCmdUI) { pCmdUI->Enable(m_Lead.GetHasRgn()); } void CMfcdemoView::OnImageRegiontransformationsCancel() { HCURSOR hOldCursor = SetCursor(LoadCursor(NULL,IDC_WAIT)); RestoreBackground(); /* delete the regions from the master document and all other views */ m_Lead.SetRgnFrameType(RGNFRAME_NONE); m_Lead.FreeRgn(); GetDocLead()->SetBitmap(m_Lead.GetBitmap()); GetDocLead()->FreeRgn(); GetDocument()->UpdateAllViews(this, (LPARAM)0); SetCursor(hOldCursor); } void CMfcdemoView::OnColorWindowlevel() { int nRet; long MaxVal; long MinVal; GetDocLead()->GetMinMaxBits(); theApp.m_pRasterClrDlg->PutLowBit(GetDocLead()->GetMinBit()); theApp.m_pRasterClrDlg->PutHighBit(GetDocLead()->GetMaxBit()); GetDocLead()->GetMinMaxVal(); MinVal = GetDocLead()->GetMinVal(); MaxVal = GetDocLead()->GetMaxVal(); theApp.m_pRasterClrDlg->PutWindowLevelLow(MinVal); theApp.m_pRasterClrDlg->PutWindowLevelHigh(MaxVal); switch ( GetDocLead()->GetIsGrayscale()) { case GRAY_ORDEREDNORMAL: { theApp.m_pRasterClrDlg->StartColor = RGB ( 0, 0, 0 ) ; theApp.m_pRasterClrDlg->EndColor = RGB ( 255, 255, 255 ) ; break ; } case GRAY_ORDEREDINVERSE: { theApp.m_pRasterClrDlg->StartColor = RGB ( 255, 255, 255 ) ; theApp.m_pRasterClrDlg->EndColor = RGB ( 0, 0, 0 ) ; break ; } case GRAY_NOTORDERED: { theApp.m_pRasterClrDlg->StartColor = RGB ( 0, 0, 0 ) ; theApp.m_pRasterClrDlg->EndColor = RGB ( 255, 255, 255 ) ; break ; } default: { MessageBox ( TEXT ( "Window Level is not supported for this bitmap order" ), TEXT ( "Window Level Error" ), MB_OK ) ; return; } } theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutWindowLevelFlags(18/*FILLLUT_OUTSIDE | FILLLUT_LINEAR*/); theApp.m_pRasterClrDlg->PutUIFlags(WINDOWLEVEL_SHOW_PREVIEW |WINDOWLEVEL_SHOW_TOOL_ZOOMLEVEL| WINDOWLEVEL_SHOW_RANGE |WINDOWLEVEL_AUTOPROCESS); nRet = theApp.m_pRasterClrDlg->ShowWindowLevelDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { OnChanged(); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnUpdateColorWindowlevel(CCmdUI* pCmdUI) { BOOL bVal; bVal = FALSE; if((GetDocLead()->GetBitmapBits() == 12) || (GetDocLead()->GetBitmapBits() == 16)) bVal = TRUE; if(GetDocLead()->GetIsGrayscale() == GRAY_NO) bVal = FALSE; pCmdUI->Enable(bVal); } void CMfcdemoView::OnColorContourFilter() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags ( CONTOURFILTER_AUTOPROCESS | CONTOURFILTER_SHOW_PREVIEW | CONTOURFILTER_SHOW_OPTION | CONTOURFILTER_SHOW_OPTION | CONTOURFILTER_SHOW_THRESHOLD | CONTOURFILTER_SHOW_DELTADIRECTION| CONTOURFILTER_SHOW_MAXIMUMERROR | CONTOURFILTER_SHOW_TOOL_ZOOMLEVEL ); nRet = theApp.m_pRasterImgEfxDlg->ShowContourFilterDlg((long)this->m_hWnd); /* the method */ if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { OnChanged(); GetDocLead()->ForceRepaint(); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnColorPicturize() { int nRet; int nWidth = (int) GetDocLead()->GetBitmapWidth(); int nHeight = (int) GetDocLead()->GetBitmapHeight(); theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutBitmapWidth(nWidth); theApp.m_pRasterImgEfxDlg->PutBitmapHeight(nHeight); theApp.m_pRasterImgEfxDlg->PutCellHeight(8); theApp.m_pRasterImgEfxDlg->PutCellWidth(10); theApp.m_pRasterImgEfxDlg->PutPicturizeResizeFlags(PICTURIZE_RESAMPLE); theApp.m_pRasterImgEfxDlg->PutUIFlags(PICTURIZE_AUTOPROCESS); nRet = theApp.m_pRasterImgEfxDlg->ShowPicturizeDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { OnChanged(); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnImageDocumentimagingSmooth() { int nRet; theApp.m_pRasterImgDocDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgDocDlg->GetSmooth()->PutFlags(0); theApp.m_pRasterImgDocDlg->GetSmooth()->PutLength(1); theApp.m_pRasterImgDocDlg->PutUIFlags(SMOOTH_SHOW_PREVIEW | SMOOTH_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgDocDlg->ShowSmoothDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgDocDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->Smooth( theApp.m_pRasterImgDocDlg->GetSmooth()->GetLength(), (SmoothFlags)theApp.m_pRasterImgDocDlg->GetSmooth()->GetFlags()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnUpdateImageDocumentimagingSmooth(CCmdUI* pCmdUI) { pCmdUI->Enable((GetDocLead()->GetBitmapBits() == 1) && (GetDocLead()->GetVersionLevel() == VERSIONLEVEL_DOCUMENT|| GetDocLead()->GetVersionLevel() == VERSIONLEVEL_MEDICAL) ); } void CMfcdemoView::OnImageDocumentimagingLineremove() { int nRet; theApp.m_pRasterImgDocDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgDocDlg->GetLineRemove()->PutFlags(LINE_USE_GAP | LINE_USE_VARIANCE); theApp.m_pRasterImgDocDlg->GetLineRemove()->PutRemoveFlags(LINEREMOVE_HORIZONTAL); theApp.m_pRasterImgDocDlg->PutUIFlags(LINEREMOVE_SHOW_PREVIEW | LINEREMOVE_SHOW_TOOL_ZOOMLEVEL); theApp.m_pRasterImgDocDlg->GetLineRemove()->PutGapLength(3); theApp.m_pRasterImgDocDlg->GetLineRemove()->PutMaxLineWidth(9); theApp.m_pRasterImgDocDlg->GetLineRemove()->PutMaxWallPercent(10); theApp.m_pRasterImgDocDlg->GetLineRemove()->PutMinLineLength(400); theApp.m_pRasterImgDocDlg->GetLineRemove()->PutVariance(3); theApp.m_pRasterImgDocDlg->GetLineRemove()->PutWall(15); nRet = theApp.m_pRasterImgDocDlg->ShowLineRemoveDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgDocDlg->GetDialogStatus() == DLG_OK) { OnChanged(); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnUpdateImageDocumentimagingLineremove(CCmdUI* pCmdUI) { pCmdUI->Enable((GetDocLead()->GetBitmapBits() == 1) && (GetDocLead()->GetVersionLevel() == VERSIONLEVEL_DOCUMENT|| GetDocLead()->GetVersionLevel() == VERSIONLEVEL_MEDICAL) ); } void CMfcdemoView::OnImageDocumentimagingDotremove() { theApp.m_pRasterImgDocDlg->PutUIFlags(DOTREMOVE_AUTOPROCESS | DOTREMOVE_SHOW_PREVIEW | DOTREMOVE_SHOW_TOOL_ZOOMLEVEL); theApp.m_pRasterImgDocDlg->GetDotRemove()->PutMinDotWidth (6); theApp.m_pRasterImgDocDlg->GetDotRemove()->PutMinDotHeight (6); theApp.m_pRasterImgDocDlg->GetDotRemove()->PutMaxDotWidth (8); theApp.m_pRasterImgDocDlg->GetDotRemove()->PutMaxDotHeight (8); theApp.m_pRasterImgDocDlg->GetDotRemove()->PutFlags((DotRemoveFlags)(DOT_USE_SIZE | DOT_USE_DIAGONALS )); theApp.m_pRasterImgDocDlg->PutBitmap(GetDocLead()->GetBitmap()); int nRet = theApp.m_pRasterImgDocDlg->ShowDotRemoveDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgDocDlg->GetDialogStatus() == DLG_OK) { OnChanged(); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnUpdateImageDocumentimagingDotremove(CCmdUI* pCmdUI) { pCmdUI->Enable((GetDocLead()->GetBitmapBits() == 1) && (GetDocLead()->GetVersionLevel() == VERSIONLEVEL_DOCUMENT|| GetDocLead()->GetVersionLevel() == VERSIONLEVEL_MEDICAL) ); } void CMfcdemoView::OnImageDocumentimagingInvertedtext() { int nRet; theApp.m_pRasterImgDocDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgDocDlg->PutUIFlags(INVERTEDTEXT_AUTOPROCESS | INVERTEDTEXT_SHOW_PREVIEW | INVERTEDTEXT_SHOW_TOOL_ZOOMLEVEL); theApp.m_pRasterImgDocDlg->GetInvertedText()->PutMinInvertHeight (375); theApp.m_pRasterImgDocDlg->GetInvertedText()->PutMinInvertWidth (6000); theApp.m_pRasterImgDocDlg->GetInvertedText()->PutMinBlackPercent(75); theApp.m_pRasterImgDocDlg->GetInvertedText()->PutMaxBlackPercent(95); theApp.m_pRasterImgDocDlg->GetInvertedText()->PutFlags(INVERTEDTEXT_USE_DPI); nRet = theApp.m_pRasterImgDocDlg->ShowInvertTextDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgDocDlg->GetDialogStatus() == DLG_OK) { OnChanged(); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnUpdateImageDocumentimagingInvertedtext(CCmdUI* pCmdUI) { pCmdUI->Enable((GetDocLead()->GetBitmapBits() == 1) && (GetDocLead()->GetVersionLevel() == VERSIONLEVEL_DOCUMENT|| GetDocLead()->GetVersionLevel() == VERSIONLEVEL_MEDICAL) ); } void CMfcdemoView::OnImageDocumentimagingBorderremove() { int nRet; theApp.m_pRasterImgDocDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgDocDlg->PutUIFlags(BORDERREMOVE_AUTOPROCESS |BORDERREMOVE_SHOW_PREVIEW | BORDERREMOVE_SHOW_TOOL_ZOOMLEVEL); theApp.m_pRasterImgDocDlg->GetBorderRemove()->PutBorderPercent (20); theApp.m_pRasterImgDocDlg->GetBorderRemove()->PutVariance (3); theApp.m_pRasterImgDocDlg->GetBorderRemove()->PutWhiteNoiseLength(9); theApp.m_pRasterImgDocDlg->GetBorderRemove()->PutBorderToRemove (15); theApp.m_pRasterImgDocDlg->GetBorderRemove()->PutFlags(0); nRet = theApp.m_pRasterImgDocDlg->ShowBorderRemoveDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgDocDlg->GetDialogStatus() == DLG_OK) { OnChanged(); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnUpdateImageDocumentimagingBorderremove(CCmdUI* pCmdUI) { pCmdUI->Enable((GetDocLead()->GetBitmapBits() == 1) && (GetDocLead()->GetVersionLevel() == VERSIONLEVEL_DOCUMENT|| GetDocLead()->GetVersionLevel() == VERSIONLEVEL_MEDICAL) ); } void CMfcdemoView::OnImageDocumentimagingHolepunchremove() { int nRet; theApp.m_pRasterImgDocDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgDocDlg->PutUIFlags(HOLEPUNCHREMOVE_AUTOPROCESS | HOLEPUNCHREMOVE_SHOW_PREVIEW | HOLEPUNCHREMOVE_SHOW_TOOL_ZOOMLEVEL ); theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->PutMinHoleWidth(1); theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->PutMinHoleHeight(1); theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->PutMaxHoleWidth(2); theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->PutMaxHoleHeight(2); theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->PutMinHoleCount(2); theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->PutMaxHoleCount(4); theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->PutFlags (HOLEPUNCH_USE_LOCATION | HOLEPUNCH_USE_DPI | HOLEPUNCH_USE_COUNT ); theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->PutLocation(HOLEPUNCH_LEFT); nRet = theApp.m_pRasterImgDocDlg->ShowHolePunchRemoveDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgDocDlg->GetDialogStatus() == DLG_OK) { OnChanged(); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnUpdateImageDocumentimagingHolepunchremove(CCmdUI* pCmdUI) { pCmdUI->Enable((GetDocLead()->GetBitmapBits() == 1) && (GetDocLead()->GetVersionLevel() == VERSIONLEVEL_DOCUMENT|| GetDocLead()->GetVersionLevel() == VERSIONLEVEL_MEDICAL) ); } void CMfcdemoView::OnViewPanwindow() { short nRet; CMfcdemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if(pDoc->m_bPanWin) { // GetDocLead()->ShowPanWin(FALSE); m_Lead.ShowPanWin(FALSE); pDoc->m_bPanWin = FALSE; } else { CRect rcWin; GetWindowRect(&rcWin); m_Lead.SetPanWinX((float)(max(0, (rcWin.left - 100)))); m_Lead.SetPanWinY((float)(max(0, (rcWin.top - 100)))); m_Lead.SetPanWinWidth(150.0f); m_Lead.SetPanWinHeight(200.0f); m_Lead.SetPanWinTitle("PanWindow"); m_Lead.SetPanWinRectColor(RGB(255,0,0)); m_Lead.SetPanWinSysMenu(TRUE); m_Lead.SetPanWinPaintPalette(m_Lead.GetPaintPalette()); m_Lead.SetPanWinBitonalScaling(m_Lead.GetBitonalScaling()); m_Lead.SetPanWinPaintScaling(m_Lead.GetPaintScaling()); m_Lead.SetPanWinPaintDither(m_Lead.GetPaintDither()); nRet = m_Lead.ShowPanWin(TRUE); if(nRet == 0) pDoc->m_bPanWin = TRUE; } } void CMfcdemoView::OnViewMagnifyingglass() { CMfcdemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if(pDoc->m_bMagGlass) StopMagGlass(); else StartMagGlass(); } void CMfcdemoView::StartMagGlass() { CMfcdemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if(!pDoc->m_bMagGlass) { if(m_Lead.GetHasRgn()) OnImageRegiontransformationsCancel(); m_nRegionTool = IDM_TOOLNONE; m_Lead.SetAutoPan(FALSE); m_Lead.StartMagGlass(150.0f, 100.0f, 200, 0, m_Lead.GetBackColor(), FALSE, 1.0f, TRUE, CROSSHAIR_FINE, TRUE, TRUE); pDoc->m_bMagGlass = TRUE; } } void CMfcdemoView::StopMagGlass() { CMfcdemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if(pDoc->m_bMagGlass) { if(m_Lead.GetHasRgn()) { m_Lead.FreeRgn(); OnImageRegiontransformationsCancel(); } m_nRegionTool = IDM_TOOLNONE; BOOL bVal = m_Lead.GetEnableMethodErrors(); m_Lead.SetEnableMethodErrors(FALSE); m_Lead.StopMagGlass(); m_Lead.SetAutoPan(TRUE); pDoc->m_bMagGlass = FALSE; m_Lead.SetEnableMethodErrors(bVal); } } void CMfcdemoView::OnPanWinLeadctrl1(long hPanWin, short iFlag) { CMfcdemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if(iFlag == PANWIN_DESTROYED) pDoc->m_bPanWin = FALSE; } void CMfcdemoView::OnUpdateViewMagnifyingglass(CCmdUI* pCmdUI) { CMfcdemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); pCmdUI->SetCheck(pDoc->m_bMagGlass); pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateViewPanwindow(CCmdUI* pCmdUI) { CMfcdemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); pCmdUI->SetCheck(pDoc->m_bPanWin); pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnDestroy() { theApp.m_pRasterFileDlg->Bitmap = 0; theApp.m_pRasterClrDlg->Bitmap = 0; theApp.m_pRasterImgDlg->Bitmap = 0; theApp.m_pRasterImgDocDlg->Bitmap = 0; theApp.m_pRasterWebDlg->Bitmap = 0; theApp.m_pRasterImgEfxDlg->Bitmap = 0; StopMagGlass(); CFormView::OnDestroy(); } BOOL CMfcdemoView::OnEraseBkgnd(CDC* pDC) { //return CFormView::OnEraseBkgnd(pDC); return TRUE; } void CMfcdemoView::OnKeyDownLeadctrl1(short FAR* KeyCode, short Shift) { GetDocument()->m_bStopEffect = TRUE; } void CMfcdemoView::OnProgressStatusLeadctrl1(short iPercent) { MSG msg; // are there any messages in the queue (like a button being pressed) ? while( PeekMessage(&msg,NULL, 0, 0, PM_REMOVE) ) { TranslateMessage( &msg ); /* Translates virtual key codes. */ DispatchMessage( &msg ); /* Dispatches message to window. */ } if(GetDocument()->m_bStopEffect) { theApp.m_nEffectsCount=0; m_Lead.SetEnableProgressEvent(FALSE); // Cancel the task } } void CMfcdemoView::OnResizeLeadctrl1() { if(!m_Lead.m_hWnd) return; if(m_Lead.GetHScrollInfo().GetVisible()) { m_Lead.GetHScrollInfo().SetPage(m_Lead.GetHScrollInfo().GetMax() / 10); m_Lead.GetHScrollInfo().SetLine(10); } if(m_Lead.GetVScrollInfo().GetVisible()) { m_Lead.GetVScrollInfo().SetPage(m_Lead.GetVScrollInfo().GetMax() / 10); m_Lead.GetVScrollInfo().SetLine(10); } } void CMfcdemoView::OnSysCommand(UINT nID, LPARAM lParam) { // TODO: Add your message handler code here and/or call default if (nID == SC_CLOSE) AfxMessageBox("Closing"); CFormView::OnSysCommand(nID, lParam); } void CMfcdemoView::OnUpdateViewPainteffects(CCmdUI* pCmdUI) { pCmdUI->Enable( theApp.m_nEffectsCount == 0); } int CMfcdemoView::GenerateBitampList ( TCHAR * pszFolder, BOOL fThumbnail ) { theApp.m_nBitmapsCount = -1 ; //Create the RasterThumbnail object m_LEADThumb.SetEnableMethodErrors(FALSE); m_LEADThumb.SetStopOnError(FALSE); m_LEADThumb.SetFilter("*.*"); //search for all files m_LEADThumb.SetThumbnailWidth((fThumbnail)? 150 : 0); m_LEADThumb.SetThumbnailHeight((fThumbnail)?150 : 0); m_LEADThumb.SetThumbnailBitsPerPixel(24); m_LEADThumb.SetMaintainAspect(fThumbnail); m_LEADThumb.SetForceSize(FALSE); m_LEADThumb.SetPaletteFlags(CRP_BYTEORDERBGR); m_LEADThumb.SetThumbnailBackgroundColor(GetSysColor ( COLOR_BTNFACE ) ); m_LEADThumb.SetLoadStamp(FALSE); m_LEADThumb.SetResample(FALSE); m_LEADThumb.SetIncludeSubDirectories(FALSE); m_LEADThumb.SetExpandMultipage(FALSE); if(theApp.m_DlgType == DLG_EFFECT) theApp.m_pRasterImgEfxDlg->ItemsCount = 15; else if(theApp.m_DlgType == DLG_IMAGE) theApp.m_pRasterImgDlg->ItemsCount = 15; else if(theApp.m_DlgType == DLG_COLOR) theApp.m_pRasterClrDlg->ItemsCount = 15; else if(theApp.m_DlgType == DLG_FILE) theApp.m_pRasterFileDlg->ItemsCount = 15; ((CMainFrame*)theApp.m_pMainWnd)->m_bBrowseQuit = FALSE; int nRet = m_LEADThumb.BrowseDir(pszFolder); if ( theApp.m_nBitmapsCount <= 0 ) { MessageBox ( TEXT("There are file(s) cannot be loaded"), TEXT("Error"), 0 ) ; return -1; } else { if(theApp.m_DlgType == DLG_EFFECT) theApp.m_pRasterImgEfxDlg->ItemsCount = theApp.m_nBitmapsCount + 1 ; else if(theApp.m_DlgType == DLG_IMAGE) theApp.m_pRasterImgDlg->ItemsCount = theApp.m_nBitmapsCount + 1 ; else if(theApp.m_DlgType == DLG_COLOR) theApp.m_pRasterClrDlg->ItemsCount = theApp.m_nBitmapsCount + 1 ; else if(theApp.m_DlgType == DLG_FILE) theApp.m_pRasterFileDlg->ItemsCount = theApp.m_nBitmapsCount + 1 ; } return 1; } void CMfcdemoView::OnRemoveredeye() { int nRet; theApp.m_pRasterImgDocDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgDocDlg->PutUIFlags(REMOVEREDEYE_SHOW_PREVIEW| REMOVEREDEYE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgDocDlg->ShowRemoveRedEyeDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgDocDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->RemoveRedeye( theApp.m_pRasterImgDocDlg->GetNewColor() , (short)theApp.m_pRasterImgDocDlg->GetThreshold() , (short)theApp.m_pRasterImgDocDlg->GetLightness()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnUpdateRemoveredeye(CCmdUI* pCmdUI) { pCmdUI->Enable((GetDocLead()->GetVersionLevel() == VERSIONLEVEL_DOCUMENT||GetDocLead()->GetVersionLevel() == VERSIONLEVEL_MEDICAL) && (GetDocLead()->GetBitmapBits() != 1) && GetDocument()->m_bStopEffect); } void CMfcdemoView::OnAddborder() { int nRet; theApp.m_pRasterFileDlg->DialogTitle = "Select Images Folder"; nRet = theApp.m_pRasterFileDlg->ShowDirectoryDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { theApp.m_DlgType = DLG_IMAGE; if ( GenerateBitampList ( theApp.m_pRasterFileDlg->GetDirectory(), FALSE ) != 1) { return ; } OnImageRegiontransformationsCancel(); theApp.m_pRasterImgDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgDlg->LeftThickness = (long) GetDocLead()->GetBitmapWidth() / 20; theApp.m_pRasterImgDlg->TopThickness = (long) GetDocLead()->GetBitmapHeight() / 20; theApp.m_pRasterImgDlg->RightThickness = (long) GetDocLead()->GetBitmapWidth() / 20; theApp.m_pRasterImgDlg->BottomThickness = (long) GetDocLead()->GetBitmapHeight() / 20; theApp.m_pRasterImgDlg->Location = OUTSIDE_BITMAP; theApp.m_pRasterImgDlg->PutBorderStyle(BORDER_STYLE_GRADIENT); theApp.m_pRasterImgDlg->PutEffectStyle (BORDER_EFFECT_CURVEDIN); theApp.m_pRasterImgDlg->PutGradientStyle(BORDER_GRAD_CENTEROUT); theApp.m_pRasterImgDlg->GradientStartColor = RGB(95, 72, 20); theApp.m_pRasterImgDlg->GradientEndColor = RGB(156, 120, 34); theApp.m_pRasterImgDlg->CurveIntensity = 200; theApp.m_pRasterImgDlg->EnableSoftCurve = true; theApp.m_pRasterImgDlg->EnableShadow = true; theApp.m_pRasterImgDlg->ShadowSize = 3; theApp.m_pRasterImgDlg->PutShadowDirection(BORDER_SHADOW_LEFT); theApp.m_pRasterImgDlg->EnableBumpyShadow = false; theApp.m_pRasterImgDlg->PutUIFlags(ADDBORDER_SHOW_PREVIEW | ADDBORDER_SHOW_TOOL_ZOOMLEVEL | ADDBORDER_AUTOPROCESS); nRet = theApp.m_pRasterImgDlg->ShowAddBorderDlg((long)this->m_hWnd); OnChanged(); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnAddframe() { int nRet; theApp.m_pRasterFileDlg->DialogTitle = "Select Images Folder"; nRet = theApp.m_pRasterFileDlg->ShowDirectoryDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { theApp.m_DlgType = DLG_IMAGE;; if ( GenerateBitampList ( theApp.m_pRasterFileDlg->GetDirectory(), FALSE ) != 1) { return ; } OnImageRegiontransformationsCancel(); theApp.m_pRasterImgDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgDlg->EnableKeepFrameState = false; theApp.m_pRasterImgDlg->EnableUseMask = false; theApp.m_pRasterImgDlg->SmoothEdge = 0; theApp.m_pRasterImgDlg->Location = INSIDE_BITMAP; theApp.m_pRasterImgDlg->PutQuality(FRAME_QUALITY_LOW); theApp.m_pRasterImgDlg->PutUIFlags(ADDFRAME_SHOW_PREVIEW | ADDFRAME_SHOW_TOOL_ZOOMLEVEL | ADDFRAME_AUTOPROCESS); nRet = theApp.m_pRasterImgDlg->ShowAddFrameDlg((long)this->m_hWnd); OnChanged(); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnCanvassize() { int nRet; theApp.m_pRasterImgDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgDlg->CurrentHeight = (long) GetDocLead()->GetBitmapHeight(); theApp.m_pRasterImgDlg->CurrentWidth = (long) GetDocLead()->GetBitmapWidth(); theApp.m_pRasterImgDlg->NewHeight = (short) GetDocLead()->GetBitmapHeight(); theApp.m_pRasterImgDlg->NewWidth = (short) GetDocLead()->GetBitmapWidth(); theApp.m_pRasterImgDlg->PutUIFlags( CANVASRESIZE_AUTOPROCESS| CANVASRESIZE_SHOW_BACKCOLOR| CANVASRESIZE_SHOW_HORIZPOS| CANVASRESIZE_SHOW_VERTZPOS| CANVASRESIZE_SHOW_CURRENT_HEIGHT| CANVASRESIZE_SHOW_CURRENT_WIDTH| CANVASRESIZE_SHOW_KEEPASPECT); nRet = theApp.m_pRasterImgDlg->ShowCanvasResizeDlg((long)this->m_hWnd); OnChanged(); } void CMfcdemoView::OnHistogram() { int nRet; theApp.m_pRasterImgDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgDlg->BlueChannelPenColor = RGB(0, 0, 255); theApp.m_pRasterImgDlg->RedChannelPenColor = RGB(255, 0, 0); theApp.m_pRasterImgDlg->GreenChannelPenColor = RGB(0,255,0); theApp.m_pRasterImgDlg->PutUIFlags( HISTOGRAM_SHOW_VIEWSTYLE| HISTOGRAM_USERPENCOLORS ); nRet = theApp.m_pRasterImgDlg->ShowHistogramDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->BalanceColors( (float)theApp.m_pRasterClrDlg->RedToRed, (float)theApp.m_pRasterClrDlg->RedToGreen, (float)theApp.m_pRasterClrDlg->RedToBlue, (float)theApp.m_pRasterClrDlg->GreenToRed, (float)theApp.m_pRasterClrDlg->GreenToGreen, (float)theApp.m_pRasterClrDlg->GreenToBlue, (float)theApp.m_pRasterClrDlg->BlueToRed, (float)theApp.m_pRasterClrDlg->BlueToGreen, (float)theApp.m_pRasterClrDlg->BlueToBlue ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnMotionblur() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( MOTIONBLUR_SHOW_PREVIEW | MOTIONBLUR_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowMotionBlurDlg ((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->MotionBlur( (short)theApp.m_pRasterImgEfxDlg->GetDimension(), /* the property */ (long)theApp.m_pRasterImgEfxDlg->GetAngle(), theApp.m_pRasterImgEfxDlg->GetEnableUniDirectional()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnZoomblur() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( ZOOMBLUR_SHOW_PREVIEW | ZOOMBLUR_SHOW_TOOL_ZOOMLEVEL| ZOOMBLUR_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowZoomBlurDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnRadialblur() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( RADIALBLUR_SHOW_PREVIEW | RADIALBLUR_SHOW_TOOL_ZOOMLEVEL| RADIALBLUR_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowRadialBlurDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnGaussianblur() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( GAUSSIANBLUR_SHOW_PREVIEW | GAUSSIANBLUR_SHOW_TOOL_ZOOMLEVEL| GAUSSIANBLUR_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowGaussianBlurDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnAntialias() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( ANTIALIAS_SHOW_PREVIEW | ANTIALIAS_SHOW_TOOL_ZOOMLEVEL| ANTIALIAS_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowAntiAliasDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnMaxfilter() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( MAXFILTER_SHOW_PREVIEW | MAXFILTER_SHOW_TOOL_ZOOMLEVEL| MAXFILTER_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowMaxFilterDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnMinfilter() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( MINFILTER_SHOW_PREVIEW | MINFILTER_SHOW_TOOL_ZOOMLEVEL| MINFILTER_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowMinFilterDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnUnsharpmask() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( UNSHARPMASKFILTER_SHOW_PREVIEW | UNSHARPMASKFILTER_SHOW_TOOL_ZOOMLEVEL| UNSHARPMASKFILTER_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowUnsharpMaskDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnMultiply() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( MULTIPLY_SHOW_PREVIEW | MULTIPLY_SHOW_TOOL_ZOOMLEVEL| MULTIPLY_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowMultiplyDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnOilify() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( OILIFY_SHOW_PREVIEW | OILIFY_SHOW_TOOL_ZOOMLEVEL | OILIFY_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowOilifyDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnPaletteeditor() { int nRet; theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( CUSTOMIZEPALETTE_SHOW_SORT | CUSTOMIZEPALETTE_SHOW_FINDCLOSEST | CUSTOMIZEPALETTE_SHOW_ADDOPTION | CUSTOMIZEPALETTE_SHOW_REMOVEOPTION | CUSTOMIZEPALETTE_SHOW_COLORMODEL | CUSTOMIZEPALETTE_SHOW_RGBLEFTPAN | CUSTOMIZEPALETTE_SHOW_HTMLLEFTPAN | CUSTOMIZEPALETTE_SHOW_INDEXLEFTPAN | CUSTOMIZEPALETTE_SHOW_RGBRIGHTPAN | CUSTOMIZEPALETTE_SHOW_HTMLRIGHTPAN | CUSTOMIZEPALETTE_SHOW_INDEXRIGHTPAN | CUSTOMIZEPALETTE_SHOW_NEW | CUSTOMIZEPALETTE_SHOW_OPEN | CUSTOMIZEPALETTE_SHOW_SAVE | CUSTOMIZEPALETTE_SHOW_SAVEAS | CUSTOMIZEPALETTE_GENERATE_PALETTE ); nRet = theApp.m_pRasterClrDlg->ShowCustomizePaletteDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = GetDocLead()->HistoContrast((short)theApp.m_pRasterClrDlg->Change); OnChanged(); EndProcessing(nRet); } OnChanged(); } void CMfcdemoView::OnAddbitmaps() { int nRet; theApp.m_pRasterFileDlg->DialogTitle = "Select Images Folder"; nRet = theApp.m_pRasterFileDlg->ShowDirectoryDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { theApp.m_DlgType = DLG_EFFECT; if ( GenerateBitampList ( theApp.m_pRasterFileDlg->GetDirectory(), FALSE ) != 1) { return ; } theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( ADDBITMAPS_SHOW_PREVIEW| ADDBITMAPS_AUTOPROCESS| ADDBITMAPS_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowAddBitmapsDlg((long)this->m_hWnd); OnChanged(); if(nRet != 0 ) theApp.DisplayLEADError(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnBalancecolors() { int nRet; theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( BALANCECOLORS_SHOW_PREVIEW| BALANCECOLORS_AUTOPROCESS | BALANCECOLORS_SHOW_TOOL_ZOOMLEVEL); BeginProcessing(); nRet = theApp.m_pRasterClrDlg->ShowBalanceColorsDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnBending() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( BENDING_SHOW_PREVIEW | BENDING_SHOW_TOOL_ZOOMLEVEL| BENDING_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowBendingDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnColoredgray() { int nRet; theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( COLOREDGRAY_SHOW_PREVIEW | COLOREDGRAY_SHOW_TOOL_ZOOMLEVEL| COLOREDGRAY_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterClrDlg->ShowColoredGrayDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnCountcolors() { unsigned long ulColors; BeginProcessing(); ulColors = GetDocLead()->GetColorCount(); char szText[40]; wsprintf(szText,"Bitmap contains %lu unique colors", ulColors); MessageBox(szText,"color count"); OnChanged(); } void CMfcdemoView::OnCylindrical() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( CYLINDRICAL_SHOW_PREVIEW | CYLINDRICAL_SHOW_TOOL_ZOOMLEVEL| CYLINDRICAL_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowCylindricalDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnStitch() { int nRet; theApp.m_pRasterFileDlg->DialogTitle = "Select Images Folder"; nRet = theApp.m_pRasterFileDlg->ShowDirectoryDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { theApp.m_DlgType = DLG_EFFECT; if ( GenerateBitampList ( theApp.m_pRasterFileDlg->GetDirectory(), FALSE ) != 1) { return ; } theApp.m_pRasterImgEfxDlg->StitchBitmapHeight = 200; theApp.m_pRasterImgEfxDlg->StitchBitmapWidth = 320; theApp.m_pRasterImgEfxDlg->StitchBitsPerPixel = 24; theApp.m_pRasterImgEfxDlg->StitchResolution = 72; theApp.m_pRasterImgEfxDlg->StitchBackGroundColor = 72; nRet = theApp.m_pRasterImgEfxDlg->ShowStitchDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_EXPORTANDEXIT) { theApp.m_Bitmap = theApp.m_pRasterImgEfxDlg->GetStitchBitmap(); theApp.OpenDocument(OPENMODE_BITMAP); OnChanged(); } else theApp.DisplayLEADError(nRet); theApp.m_pRasterImgEfxDlg->ItemsCount = 0; } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnPixelate() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( PIXELATE_SHOW_PREVIEW| PIXELATE_SHOW_TOOL_ZOOMLEVEL| PIXELATE_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowPixelateDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnPngwebtuner() { int nRet; theApp.m_pRasterWebDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterWebDlg->PutUIFlags(PNGWEBTUNER_SHOW_INFORMATION | PNGWEBTUNER_SHOW_PREVIEW | PNGWEBTUNER_SHOW_TOOL_ZOOMLEVEL | PNGWEBTUNER_SHOW_EXPORT | PNGWEBTUNER_SHOW_TOOL_COLORPICKER | PNGWEBTUNER_SHOW_TRANSPARENCY | PNGWEBTUNER_SHOW_ADDWINDOWCOLOR ); BeginProcessing(); nRet = theApp.m_pRasterWebDlg->ShowPNGWebTunerDlg ((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnPolar() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( POLAR_SHOW_PREVIEW| POLAR_SHOW_TOOL_ZOOMLEVEL| POLAR_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowPolarDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnPreview() { int nRet; theApp.m_pRasterFileDlg->PutBitmap(GetDocLead()->GetBitmap()); nRet = theApp.m_pRasterFileDlg->ShowPrintPreviewDlg ((long)this->m_hWnd); OnChanged(); if(nRet != 0 ) theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnPrintstitchedimages() { int nRet; theApp.m_pRasterFileDlg->DialogTitle = "Select Images Folder"; nRet = theApp.m_pRasterFileDlg->ShowDirectoryDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { theApp.m_DlgType = DLG_FILE; if ( GenerateBitampList ( theApp.m_pRasterFileDlg->GetDirectory(), TRUE) != 1) { return ; } theApp.m_pRasterFileDlg->Visible = TRUE; nRet = theApp.m_pRasterFileDlg->ShowPrintStitchedImagesDlg((long)this->m_hWnd); if(nRet != 0 ) theApp.DisplayLEADError(nRet); } else theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnPunch() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( PUNCH_SHOW_PREVIEW| PUNCH_SHOW_TOOL_ZOOMLEVEL| PUNCH_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowPunchDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnRadialwave() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( RADIALWAVE_SHOW_PREVIEW| RADIALWAVE_SHOW_TOOL_ZOOMLEVEL| RADIALWAVE_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowRadialWaveDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnRemaphue() { int nRet; theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( REMAPHUE_SHOW_PREVIEW| REMAPHUE_SHOW_TOOL_ZOOMLEVEL| REMAPHUE_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterClrDlg->ShowRemapHueDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnRemapintensity() { int nRet; theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( REMAPINTENSITY_SHOW_PREVIEW| REMAPINTENSITY_SHOW_TOOL_ZOOMLEVEL| REMAPINTENSITY_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterClrDlg->ShowRemapIntensityDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnRipple() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( RIPPLE_SHOW_PREVIEW| RIPPLE_SHOW_TOOL_ZOOMLEVEL| RIPPLE_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowRippleDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnSpherize() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( SPHERIZE_SHOW_PREVIEW| SPHERIZE_SHOW_TOOL_ZOOMLEVEL| SPHERIZE_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowSpherizeDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnSwirl() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( SWIRL_SHOW_PREVIEW| SWIRL_SHOW_TOOL_ZOOMLEVEL| SWIRL_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowSwirlDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnWave() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( WAVE_SHOW_PREVIEW| SWIRL_SHOW_TOOL_ZOOMLEVEL| SWIRL_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowWaveDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnWaveshear() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( WAVESHEAR_SHOW_PREVIEW| WAVESHEAR_SHOW_TOOL_ZOOMLEVEL| WAVESHEAR_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowWaveShearDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnWind() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( WIND_SHOW_PREVIEW| WIND_SHOW_TOOL_ZOOMLEVEL| WIND_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowWindDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnZoomwave() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( ZOOMWAVE_SHOW_PREVIEW| ZOOMWAVE_SHOW_TOOL_ZOOMLEVEL| ZOOMWAVE_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowZoomWaveDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnFreehandwave() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( FREEHANDWAVE_SHOW_PREVIEW| FREEHANDWAVE_SHOW_TOOL_ZOOMLEVEL| FREEHANDWAVE_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowFreeHandWaveDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnImpression() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( IMPRESSIONIST_SHOW_PREVIEW| IMPRESSIONIST_SHOW_TOOL_ZOOMLEVEL| IMPRESSIONIST_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowImpressionistDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnEdgedetect() { int nRet; theApp.m_pRasterImgEfxDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( EDGEDETECTOR_SHOW_PREVIEW| EDGEDETECTOR_SHOW_TOOL_ZOOMLEVEL| EDGEDETECTOR_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgEfxDlg->ShowEdgeDetectorDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnColorSolarize() { int nRet; theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( SOLARIZE_SHOW_PREVIEW| SOLARIZE_SHOW_TOOL_ZOOMLEVEL| SOLARIZE_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterClrDlg->ShowSolarizeDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnGrayscale() { int nRet; theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( GRAYSCALE_SHOW_PREVIEW| GRAYSCALE_SHOW_TOOL_ZOOMLEVEL| GRAYSCALE_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterClrDlg->ShowGrayScaleDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnLocalequalize() { int nRet; theApp.m_pRasterClrDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( LOCALHISTOEQUALIZE_SHOW_PREVIEW| LOCALHISTOEQUALIZE_SHOW_TOOL_ZOOMLEVEL| LOCALHISTOEQUALIZE_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterClrDlg->ShowLocalHistoEqualizeDlg((long)this->m_hWnd); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnImagemapper() { theApp.m_pRasterWebDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterWebDlg->PutUIFlags(0); theApp.m_pRasterWebDlg->PutURLMaxLength(35); theApp.m_pRasterWebDlg->PutALTMaxLength(35); theApp.m_pRasterWebDlg->PutTargetMaxLength(10); theApp.m_pRasterWebDlg->PutRolloverMaxLength(MAX_PATH); theApp.m_pRasterWebDlg->PutURLEntryCount(5); theApp.m_pRasterWebDlg->PutALTEntryCount(5); theApp.m_pRasterWebDlg->PutTargetEntryCount(5); theApp.m_pRasterWebDlg->PutRolloverEntryCount(5); theApp.m_pRasterWebDlg->PutURLValidEntryCount(2); theApp.m_pRasterWebDlg->PutALTValidEntryCount(1); theApp.m_pRasterWebDlg->PutTargetValidEntryCount (1); theApp.m_pRasterWebDlg->PutRolloverValidEntryCount(3); theApp.m_pRasterWebDlg->PutTarget(0,"_parent"); theApp.m_pRasterWebDlg->ShowHTMLMapperDlg ((long)this->m_hWnd); } void CMfcdemoView::OnJpegwebtuner() { int nRet; theApp.m_pRasterWebDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterWebDlg->PutUIFlags( JPEGWEBTUNER_SHOW_INFORMATION | JPEGWEBTUNER_SHOW_PREVIEW | JPEGWEBTUNER_SHOW_TOOL_ZOOMLEVEL| JPEGWEBTUNER_SHOW_SAVETHUMBNAIL | JPEGWEBTUNER_SHOW_OPTIONS | JPEGWEBTUNER_SHOW_EXPORT); nRet = theApp.m_pRasterWebDlg->ShowJPEGWebTunerDlg ((long)this->m_hWnd); if(nRet != 0 ) theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnGifwebtuner() { int nRet; theApp.m_pRasterWebDlg->PutBitmap(GetDocLead()->GetBitmap()); theApp.m_pRasterWebDlg->PutUIFlags( GIFWEBTUNER_SHOW_INFORMATION | GIFWEBTUNER_SHOW_PREVIEW | GIFWEBTUNER_SHOW_TOOL_ZOOMLEVEL | GIFWEBTUNER_SHOW_OPTIONS | GIFWEBTUNER_SHOW_EXPORT | GIFWEBTUNER_SHOW_ADDWINDOWCOLOR | GIFWEBTUNER_SHOW_TOOL_COLORPICKER | GIFWEBTUNER_SHOW_TRANSPARENCY ); nRet = theApp.m_pRasterWebDlg->ShowGIFWebTunerDlg ((long)this->m_hWnd); if(nRet != 0 ) theApp.DisplayLEADError(nRet); } void CMfcdemoView::OnFillblack() { BeginProcessing(); int nRet = GetDocLead()->Fill(RGB(0,0,0)); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnFillblue() { BeginProcessing(); int nRet = GetDocLead()->Fill(RGB(0,0,255)); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnFillcyan() { BeginProcessing(); int nRet = GetDocLead()->Fill(RGB(0,255,255)); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnFillgreen() { BeginProcessing(); int nRet = GetDocLead()->Fill(RGB(0,255,0)); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnFillmagenta() { BeginProcessing(); int nRet = GetDocLead()->Fill(RGB(255,0,255)); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnFillred() { BeginProcessing(); int nRet = GetDocLead()->Fill(RGB(255,0,0)); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnFillwhite() { BeginProcessing(); int nRet = GetDocLead()->Fill(RGB(255,255,255)); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnFillyellow() { BeginProcessing(); int nRet = GetDocLead()->Fill(RGB(255,255,0)); OnChanged(); EndProcessing(nRet); } void CMfcdemoView::OnColorsepRgb() { int i; BeginProcessing(); int nRet = GetDocLead()->ColorSeparate(COLORSEP_RGB); if(!nRet) { for(i = 0; i < 3; i++) { theApp.m_Bitmap = GetDocLead()->GetColorPlanes(i); theApp.OpenDocument(OPENMODE_BITMAP); GetDocLead()->SetColorPlanes(i, 0); } } EndProcessing(nRet); } void CMfcdemoView::OnColorsepAlpha() { theApp.m_Bitmap = GetDocLead()->GetBitmapAlpha(); theApp.OpenDocument(OPENMODE_BITMAP); } void CMfcdemoView::OnColorsepCmy() { int i; BeginProcessing(); int nRet = GetDocLead()->ColorSeparate(COLORSEP_CMY); if(!nRet) { for(i = 0; i < 3; i++) { theApp.m_Bitmap = GetDocLead()->GetColorPlanes(i); theApp.OpenDocument(OPENMODE_BITMAP); GetDocLead()->SetColorPlanes(i, 0); } } EndProcessing(nRet); } void CMfcdemoView::OnColorsepCmyk() { int i; BeginProcessing(); int nRet = GetDocLead()->ColorSeparate(COLORSEP_CMYK); if(!nRet) { for(i = 0; i < 4; i++) { theApp.m_Bitmap = GetDocLead()->GetColorPlanes(i); theApp.OpenDocument(OPENMODE_BITMAP); GetDocLead()->SetColorPlanes(i, 0); } } EndProcessing(nRet); } void CMfcdemoView::OnColorsepHls() { int i; BeginProcessing(); int nRet = GetDocLead()->ColorSeparate(COLORSEP_HLS); if(!nRet) { for(i = 0; i < 3; i++) { theApp.m_Bitmap = GetDocLead()->GetColorPlanes(i); theApp.OpenDocument(OPENMODE_BITMAP); GetDocLead()->SetColorPlanes(i, 0); } } EndProcessing(nRet); } void CMfcdemoView::OnColorsepHsv() { int i; BeginProcessing(); int nRet = GetDocLead()->ColorSeparate(COLORSEP_HSV); if(!nRet) { for(i = 0; i < 3; i++) { theApp.m_Bitmap = GetDocLead()->GetColorPlanes(i); theApp.OpenDocument(OPENMODE_BITMAP); GetDocLead()->SetColorPlanes(i, 0); } } EndProcessing(nRet); } void CMfcdemoView::OnUpdateBalancecolors(CCmdUI* pCmdUI) { pCmdUI->Enable((GetDocLead()->GetBitmapBits() != 1) && GetDocument()->m_bStopEffect); } void CMfcdemoView::OnThumbnailEventLeadthumbctrl1(long Bitmap, LPCTSTR pszFilename, short nStatusCode, short nPercent) { // theApp.m_pRasterThumbnail->ContinueBrowse = (StatusCode == 0? AfxMessageBox(pszFilename, MB_YESNO)==IDYES: TRUE); MSG msg; // are there any messages in the queue (like a key being pressed) ? while( PeekMessage(&msg,NULL, 0, 0, PM_REMOVE) ) { TranslateMessage( &msg ); /* Translates virtual key codes. */ DispatchMessage( &msg ); /* Dispatches message to window. */ } if(nStatusCode == BROWSE_LOADING) //loading a file goto EVENTOUT; if (nStatusCode == 0) { theApp.m_nBitmapsCount++ ; if ( theApp.m_nBitmapsCount >= 15) { theApp.m_nBitmapsCount-- ; return; } if(theApp.m_DlgType == DLG_EFFECT) { theApp.m_pRasterImgEfxDlg->PutItemBitmap(theApp.m_nBitmapsCount, Bitmap); theApp.m_pRasterImgEfxDlg->PutItemFileName(theApp.m_nBitmapsCount, pszFilename); theApp.m_pRasterImgEfxDlg->PutItemDescription(theApp.m_nBitmapsCount, pszFilename); } else if(theApp.m_DlgType == DLG_IMAGE) { theApp.m_pRasterImgDlg->PutItemBitmap(theApp.m_nBitmapsCount, Bitmap); theApp.m_pRasterImgDlg->PutItemFileName(theApp.m_nBitmapsCount, pszFilename); theApp.m_pRasterImgDlg->PutItemDescription(theApp.m_nBitmapsCount, pszFilename); } else if(theApp.m_DlgType == DLG_COLOR) { theApp.m_pRasterClrDlg->PutItemBitmap(theApp.m_nBitmapsCount, Bitmap); theApp.m_pRasterClrDlg->PutItemFileName(theApp.m_nBitmapsCount, pszFilename); theApp.m_pRasterClrDlg->PutItemDescription(theApp.m_nBitmapsCount, pszFilename); } else if(theApp.m_DlgType == DLG_FILE) { theApp.m_pRasterFileDlg->PutItemBitmap(theApp.m_nBitmapsCount, Bitmap); theApp.m_pRasterFileDlg->PutItemFileName(theApp.m_nBitmapsCount, pszFilename); theApp.m_pRasterFileDlg->PutItemDescription(theApp.m_nBitmapsCount, pszFilename); } } EVENTOUT: if(((CMainFrame*)theApp.m_pMainWnd)->m_bBrowseQuit) m_LEADThumb.SetContinueBrowse(FALSE); else m_LEADThumb.SetContinueBrowse(TRUE); } void CMfcdemoView::OnUpdateColorBrightness(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorColorresolution(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorContourfilter(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorContrast(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorGammacorrect(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorGrayscale(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorGrayscale12(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorGrayscale16(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorHalftone(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorHistogramequalize(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorHue(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorIntensitydetect(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorInvert(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorPicturize(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorSaturation(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorSolarize(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorStretchintensity(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateEditCopy(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFileAcquire(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect || theApp.m_pRasterTwain->IsAvailable((long)this->m_hWnd)); } void CMfcdemoView::OnUpdateFileBrowse(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFileCapturescreen(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFileColormerge(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFileIsisacquire(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFileIsisacquiremulti(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFileIsisselectsource(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageEffectsAddnoise(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageEffectsAverage(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageEffectsEmboss(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageEffectsMedian(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageEffectsMosaic(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageEffectsPosterize(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageEffectsSharpen(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageEffectsUnderlay(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageFlip(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageResize(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageReverse(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageRotate180clockwise(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageRotate270clockwise(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageRotate90clockwise(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageRotateAnyangle(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageSpatialfiltersGradient(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageSpatialfiltersLaplacian(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageSpatialfiltersLinesegment(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageSpatialfiltersPrewitt(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageSpatialfiltersShiftanddifference(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImageSpatialfiltersSobel(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateNextPane(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePreferencesBitonalscalingFavorblack(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePreferencesBitonalscalingNormal(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePreferencesBitonalscalingScaletogray(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePreferencesDitheringErrordiffusion(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePreferencesDitheringOrdered(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePreferencesPaintscalingBicubic(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePreferencesPaintscalingNormal(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePreferencesPaintscalingResample(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePreferencesPaletteAuto(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePreferencesPaletteFixed(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePrevPane(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateAddbitmaps(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateAddborder(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateAddframe(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateAntialias(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateBending(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateCanvassize(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColoredgray(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorsepAlpha(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorsepCmy(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorsepCmyk(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorsepHls(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorsepHsv(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateColorsepRgb(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateConvert(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateCountcolors(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateCylindrical(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateEdgedetect(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFileformatassociations(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFillblack(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFillblue(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFillcyan(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFillgreen(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFillmagenta(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFillred(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFillwhite(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFillyellow(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFreehandwave(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateGaussianblur(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateGifwebtuner(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateGrayscale(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateHistogram(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImagemapper(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateImpression(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateJpegwebtuner(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateLocalequalize(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateMaxfilter(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateMinfilter(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateMotionblur(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateMultiply(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateOilify(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePaletteeditor(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePixelate(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePngwebtuner(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePolar(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePreview(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePrintstitchedimages(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdatePunch(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateRadialblur(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateRadialwave(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateRemaphue(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateRemapintensity(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateRipple(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateSpherize(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateStitch(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateSwirl(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateUnsharpmask(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateWave(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateWaveshear(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateWind(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateZoomblur(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateZoomwave(CCmdUI* pCmdUI) { pCmdUI->Enable(GetDocument()->m_bStopEffect); } void CMfcdemoView::OnUpdateFileSelectsource(CCmdUI* pCmdUI) { pCmdUI->Enable(theApp.m_pRasterTwain->IsAvailable((long)this->m_hWnd)); }