// demoView.cpp : implementation of the CDemoView class // #include "stdafx.h" #include "leadraster.h" #include "Rangedlg.h" #include "LeadScrollinfo.h" #include "SliceDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern CDemoApp theApp; #define SRC_COPY ((CombineConstants)(CB_DST_0 | CB_SRC_NOP | CB_OP_OR)) ///////////////////////////////////////////////////////////////////////////// // CDemoView IMPLEMENT_DYNCREATE(CDemoView, CFormView) BEGIN_MESSAGE_MAP(CDemoView, CFormView) //{{AFX_MSG_MAP(CDemoView) ON_WM_SIZE() ON_COMMAND(ID_VIEW_FITIMAGETOWINDOW, OnViewFitimagetowindow) ON_COMMAND(ID_VIEW_MAGNIFYINGGLASS, OnViewMagnifyingglass) ON_UPDATE_COMMAND_UI(ID_VIEW_MAGNIFYINGGLASS, OnUpdateViewMagnifyingglass) ON_COMMAND(ID_VIEW_NORMAL, OnViewNormal) ON_COMMAND(ID_VIEW_PAINTEFFECTS, OnViewPainteffects) ON_COMMAND(ID_VIEW_PANWINDOW, OnViewPanwindow) ON_UPDATE_COMMAND_UI(ID_VIEW_PANWINDOW, OnUpdateViewPanwindow) ON_COMMAND(ID_VIEW_SNAPWINDOWTOIMAGE, OnViewSnapwindowtoimage) ON_COMMAND(ID_VIEW_ZOOM, OnViewZoom) ON_COMMAND(ID_EDIT_CANCELREGION, OnEditCancelregion) ON_UPDATE_COMMAND_UI(ID_EDIT_CANCELREGION, OnUpdateEditCancelregion) ON_COMMAND(IDM_COLORSEP_CMYK , OnColorSeparationCMYK) ON_COMMAND(IDM_COLORSEP_CMY , OnColorSeparationCMY) ON_COMMAND(IDM_COLORSEP_RGB, OnColorSeparationRGB) ON_COMMAND(IDM_COLORSEP_HSV , OnColorSeparationHSV) ON_COMMAND(IDM_COLORSEP_HLS , OnColorSeparationHLS) ON_COMMAND(IDM_COLORSEP_ALPHA, OnColorSeparationALPHA) 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_COMMAND(IDM_TOOLFREEHAND, OnToolfreehand) ON_UPDATE_COMMAND_UI(IDM_TOOLFREEHAND, OnUpdateToolfreehand) ON_COMMAND(IDM_TOOLELLIPSE, OnToolellipse) ON_UPDATE_COMMAND_UI(IDM_TOOLELLIPSE, OnUpdateToolellipse) ON_COMMAND(IDM_TOOLNONE, OnToolnone) ON_UPDATE_COMMAND_UI(IDM_TOOLNONE, OnUpdateToolnone) ON_COMMAND(ID_EDIT_UNDO, OnEditUndo) ON_UPDATE_COMMAND_UI(ID_EDIT_UNDO, OnUpdateEditUndo) ON_COMMAND(ID_EDIT_COPY, OnEditCopy) 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_IMAGE_ROTATE_ANYANGLE, OnImageRotateAnyangle) ON_COMMAND(ID_IMAGE_SHEAR, OnImageShear) ON_COMMAND(ID_IMAGE_DESKEW, OnImageDeskew) ON_UPDATE_COMMAND_UI(ID_IMAGE_DESKEW, OnUpdateImageDeskew) ON_COMMAND(ID_IMAGE_RESIZE, OnImageResize) ON_COMMAND(ID_COLOR_GRAYSCALE8, OnColorGrayscale8) ON_COMMAND(ID_COLOR_GRAYSCALE16, OnColorGrayscale16) ON_COMMAND(ID_COLOR_GRAYSCALE12, OnColorGrayscale12) ON_COMMAND(ID_COLOR_COLORRESOLUTION, OnColorColorresolution) ON_COMMAND(ID_COLOR_WINDOWLEVEL, OnColorWindowlevel) ON_UPDATE_COMMAND_UI(ID_COLOR_WINDOWLEVEL, OnUpdateColorWindowlevel) ON_COMMAND(IDM_BRIGHTNESS, OnColorBrightness) ON_COMMAND(IDM_CONTOURFILTER, OnColorContourfilter) ON_COMMAND(IDM_CONTRAST, OnColorContrast) ON_COMMAND(ID_COLOR_HISTOCONTRAST, OnColorHistocontrast) ON_COMMAND(ID_COLOR_HISTOGRAMEQUALIZE, OnColorHistogramequalize) ON_COMMAND(ID_COLOR_HUE, OnColorHue) ON_COMMAND(ID_COLOR_INTENSITYDETECT, OnColorIntensitydetect) ON_COMMAND(ID_COLOR_INVERT, OnColorInvert) ON_COMMAND(ID_COLOR_SATURATION, OnColorSaturation) ON_COMMAND(ID_COLOR_STRETCHINTENSITY, OnColorStretchintensity) ON_COMMAND(IDM_PICTURIZE, OnColorPicturize) ON_COMMAND(ID_IMAGE_DOCUMENTIMAGING_BORDERREMOVE, OnImageDocumentimagingBorderremove) ON_UPDATE_COMMAND_UI(ID_IMAGE_DOCUMENTIMAGING_BORDERREMOVE, OnUpdateImageDocumentimagingBorderremove) ON_COMMAND(ID_IMAGE_DOCUMENTIMAGING_DOTREMOVE, OnImageDocumentimagingDotremove) ON_UPDATE_COMMAND_UI(ID_IMAGE_DOCUMENTIMAGING_DOTREMOVE, OnUpdateImageDocumentimagingDotremove) ON_COMMAND(ID_IMAGE_DOCUMENTIMAGING_HOLEPUNCHREMOVE, OnImageDocumentimagingHolepunchremove) ON_UPDATE_COMMAND_UI(ID_IMAGE_DOCUMENTIMAGING_HOLEPUNCHREMOVE, OnUpdateImageDocumentimagingHolepunchremove) ON_COMMAND(ID_IMAGE_DOCUMENTIMAGING_INVERTEDTEXT, OnImageDocumentimagingInvertedtext) ON_UPDATE_COMMAND_UI(ID_IMAGE_DOCUMENTIMAGING_INVERTEDTEXT, OnUpdateImageDocumentimagingInvertedtext) ON_COMMAND(ID_IMAGE_DOCUMENTIMAGING_LINEREMOVE, OnImageDocumentimagingLineremove) ON_UPDATE_COMMAND_UI(ID_IMAGE_DOCUMENTIMAGING_LINEREMOVE, OnUpdateImageDocumentimagingLineremove) ON_COMMAND(ID_IMAGE_DOCUMENTIMAGING_SMOOTH, OnImageDocumentimagingSmooth) ON_UPDATE_COMMAND_UI(ID_IMAGE_DOCUMENTIMAGING_SMOOTH, OnUpdateImageDocumentimagingSmooth) ON_UPDATE_COMMAND_UI(ID_VIEW_NORMAL, OnUpdateViewNormal) ON_UPDATE_COMMAND_UI(ID_VIEW_FITIMAGETOWINDOW, OnUpdateViewFitimagetowindow) ON_COMMAND(ID_VIEW_STRETCHIMAGETOWINDOW, OnViewStretchimagetowindow) ON_UPDATE_COMMAND_UI(ID_VIEW_STRETCHIMAGETOWINDOW, OnUpdateViewStretchimagetowindow) ON_WM_DESTROY() ON_UPDATE_COMMAND_UI(ID_VIEW_ZOOM, OnUpdateViewZoom) ON_WM_ERASEBKGND() ON_UPDATE_COMMAND_UI(ID_COLOR_BRIGHTNESS, OnUpdateColorBrightness) ON_UPDATE_COMMAND_UI(ID_COLOR_COLORRESOLUTION, OnUpdateColorColorresolution) ON_UPDATE_COMMAND_UI(IDM_CONTOURFILTER, OnUpdateColorContourfilter) ON_UPDATE_COMMAND_UI(ID_COLOR_CONTRAST, OnUpdateColorContrast) ON_UPDATE_COMMAND_UI(ID_COLOR_FILL, OnUpdateColorFill) ON_UPDATE_COMMAND_UI(ID_COLOR_GRAYSCALE12, OnUpdateColorGrayscale12) ON_UPDATE_COMMAND_UI(ID_COLOR_GRAYSCALE16, OnUpdateColorGrayscale16) ON_UPDATE_COMMAND_UI(ID_COLOR_GRAYSCALE8, OnUpdateColorGrayscale8) ON_UPDATE_COMMAND_UI(ID_COLOR_HALFTONE, OnUpdateColorHalftone) ON_UPDATE_COMMAND_UI(ID_COLOR_HISTOCONTRAST, OnUpdateColorHistocontrast) 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(IDM_PICTURIZE, OnUpdateColorPicturize) ON_UPDATE_COMMAND_UI(ID_COLOR_SATURATION, OnUpdateColorSaturation) ON_UPDATE_COMMAND_UI(ID_COLOR_SEPARATION, OnUpdateColorSeparation) ON_UPDATE_COMMAND_UI(ID_COLOR_STRETCHINTENSITY, OnUpdateColorStretchintensity) ON_UPDATE_COMMAND_UI(ID_EDIT_COPY, OnUpdateEditCopy) ON_UPDATE_COMMAND_UI(ID_FILE_BROWSE, OnUpdateFileBrowse) ON_UPDATE_COMMAND_UI(ID_FILE_CLOSE, OnUpdateFileClose) ON_UPDATE_COMMAND_UI(ID_FILE_COLORMERGE, OnUpdateFileColormerge) ON_UPDATE_COMMAND_UI(ID_FILE_ISISACQUIRE, OnUpdateFileIsisacquire) ON_UPDATE_COMMAND_UI(ID_EDIT_PASTE, OnUpdateEditPaste) ON_UPDATE_COMMAND_UI(ID_FILE_ISISACQUIREMULTI, OnUpdateFileIsisacquiremulti) ON_UPDATE_COMMAND_UI(ID_FILE_ISISSELECTSOURCE, OnUpdateFileIsisselectsource) ON_UPDATE_COMMAND_UI(ID_FILE_TWAINACQUIRE, OnUpdateFileTwainacquire) ON_UPDATE_COMMAND_UI(ID_FILE_TWAINSELECT, OnUpdateFileTwainselect) 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_SHEAR, OnUpdateImageShear) ON_UPDATE_COMMAND_UI(ID_VIEW_PAINTEFFECTS, OnUpdateViewPainteffects) ON_UPDATE_COMMAND_UI(ID_VIEW_SNAPWINDOWTOIMAGE, OnUpdateViewSnapwindowtoimage) ON_COMMAND(IDM_ADDBORDER, OnAddborder) ON_COMMAND(IDM_MOTIONBLUR, OnMotionblur) ON_COMMAND(IDM_RADIALBLUR, OnRadialblur) ON_COMMAND(IDM_ZOOMBLUR, OnZoomblur) ON_COMMAND(IDM_GAUSSIANBLUR, OnGaussianblur) ON_COMMAND(IDM_ANTIALIAS, OnAntialias) ON_COMMAND(IDM_AVERAGE, OnAverage) ON_COMMAND(IDM_MEDIAN, OnMedian) ON_COMMAND(IDM_ADDNOISE, OnAddnoise) ON_COMMAND(IDM_MAXFILTER, OnMaxfilter) ON_COMMAND(IDM_MINFILTER, OnMinfilter) ON_COMMAND(IDM_UNSHARPMASK, OnUnsharpmask) ON_COMMAND(IDM_SHARPEN, OnSharpen) ON_COMMAND(IDM_MULTIPLY, OnMultiply) ON_COMMAND(IDM_ADDBITMAPS, OnAddbitmaps) ON_COMMAND(IDM_STITCH, OnStitch) ON_COMMAND(IDM_FREEHANDWAVE, OnFreehandwave) ON_COMMAND(IDM_WIND, OnWind) ON_COMMAND(IDM_POLAR, OnPolar) ON_COMMAND(IDM_ZOOMWAVE, OnZoomwave) ON_COMMAND(IDM_RADIALWAVE, OnRadialwave) ON_COMMAND(IDM_SWIRL, OnSwirl) ON_COMMAND(IDM_WAVE, OnWave) ON_COMMAND(IDM_WAVESHEAR, OnWaveshear) ON_COMMAND(IDM_EMBOSS, OnEmboss) ON_COMMAND(IDM_PUNCH, OnPunch) ON_COMMAND(IDM_RIPPLE, OnRipple) ON_COMMAND(IDM_BENDING, OnBending) ON_COMMAND(IDM_CYLINDRICAL, OnCylindrical) ON_COMMAND(IDM_SPHERIZE, OnSpherize) ON_COMMAND(IDM_IMPRESSION, OnImpression) ON_COMMAND(IDM_OILIFY, OnOilify) ON_COMMAND(IDM_UNDERLAY, OnUnderlay) ON_COMMAND(IDM_PIXELATE, OnPixelate) ON_COMMAND(IDM_MOSAIC, OnMosaic) ON_COMMAND(IDM_EDGEDETECT, OnEdgedetect) ON_COMMAND(IDM_EROSION, OnErosion) ON_COMMAND(IDM_DILATION, OnDilation) ON_COMMAND(IDM_GRADIENT, OnGradient) ON_COMMAND(IDM_LAPLACE, OnLaplace) ON_COMMAND(IDM_SOBEL, OnSobel) ON_COMMAND(IDM_PREWITT, OnPrewitt) ON_COMMAND(IDM_SHIFTDIFF, OnShiftdiff) ON_COMMAND(IDM_LINESEG, OnLineseg) ON_COMMAND(IDM_CANVASSIZE, OnCanvassize) ON_COMMAND(IDM_HISTOGRAM, OnHistogram) ON_COMMAND(IDM_BALANCECOLORS, OnBalancecolors) ON_COMMAND(IDM_GAMMA, OnGamma) ON_COMMAND(IDM_SATURATION, OnSaturation) ON_COMMAND(IDM_HUE, OnHue) ON_COMMAND(IDM_HALFTONE, OnHalftone) ON_COMMAND(IDM_GRAYSCALE, OnGrayscale) ON_COMMAND(IDM_COLOREDGRAY, OnColoredgray) ON_COMMAND(IDM_REMAPINTENSITY, OnRemapintensity) ON_COMMAND(IDM_REMAPHUE, OnRemaphue) ON_COMMAND(IDM_HISTOEQUALIZE, OnHistoequalize) ON_COMMAND(IDM_STRETCHINTENSITY, OnStretchintensity) ON_COMMAND(IDM_LOCALEQUALIZE, OnLocalequalize) ON_COMMAND(IDM_HISTOCONTRAST, OnHistocontrast) ON_COMMAND(IDM_PALETTEEDITOR, OnPaletteeditor) ON_COMMAND(IDM_COUNTCOLORS, OnCountcolors) ON_COMMAND(IDM_INVERT, OnInvert) ON_COMMAND(IDM_DETECT, OnDetect) ON_COMMAND(IDM_SOLARIZE, OnSolarize) ON_COMMAND(IDM_POSTERIZE, OnPosterize) ON_COMMAND(IDM_PREVIEW, OnPreview) ON_COMMAND(IDM_JPEGWEBTUNER, OnJPEGWebTuner) ON_COMMAND(IDM_HTMLMAPPER, OnHtmlMapper) ON_COMMAND(IDM_GIFWEBTUNER, OnGIFWebTuner) ON_COMMAND(IDM_PNGWEBTUNER, OnPngWebTuner) ON_COMMAND(IDM_FILLBLACK, OnFillblack) ON_COMMAND(IDM_FILLWHITE, OnFillwhite) ON_COMMAND(IDM_FILLRED, OnFillred) ON_COMMAND(IDM_FILLGREEN, OnFillgreen) ON_COMMAND(IDM_FILLBLUE, OnFillblue) ON_COMMAND(IDM_FILLCYAN, OnFillcyan) ON_COMMAND(IDM_FILLMAGENTA, OnFillmagenta) ON_COMMAND(IDM_FILLYELLOW, OnFillyellow) ON_COMMAND(IDM_FILEFORMATASSOCIATIONS, OnFileFormatAssociations) ON_COMMAND(IDM_PRINTSTITCHEDIMAGES, OnPrintStitchedImages) ON_COMMAND(IDM_ADDFRAME, OnAddframe) ON_UPDATE_COMMAND_UI(IDM_ADDBORDER, OnUpdateAddborder) ON_UPDATE_COMMAND_UI(IDM_ADDFRAME, OnUpdateAddframe) ON_UPDATE_COMMAND_UI(IDM_CANVASSIZE, OnUpdateCanvassize) ON_UPDATE_COMMAND_UI(IDM_HISTOGRAM, OnUpdateHistogram) ON_UPDATE_COMMAND_UI(IDM_MOTIONBLUR, OnUpdateMotionblur) ON_UPDATE_COMMAND_UI(IDM_RADIALBLUR, OnUpdateRadialblur) ON_UPDATE_COMMAND_UI(IDM_ZOOMBLUR, OnUpdateZoomblur) ON_UPDATE_COMMAND_UI(IDM_GAUSSIANBLUR, OnUpdateGaussianblur) ON_UPDATE_COMMAND_UI(IDM_ANTIALIAS, OnUpdateAntialias) ON_UPDATE_COMMAND_UI(IDM_AVERAGE, OnUpdateAverage) ON_UPDATE_COMMAND_UI(IDM_MEDIAN, OnUpdateMedian) ON_UPDATE_COMMAND_UI(IDM_ADDNOISE, OnUpdateAddnoise) ON_UPDATE_COMMAND_UI(IDM_MAXFILTER, OnUpdateMaxfilter) ON_UPDATE_COMMAND_UI(IDM_MINFILTER, OnUpdateMinfilter) ON_UPDATE_COMMAND_UI(IDM_UNSHARPMASK, OnUpdateUnsharpmask) ON_UPDATE_COMMAND_UI(IDM_SHARPEN, OnUpdateSharpen) ON_UPDATE_COMMAND_UI(IDM_MULTIPLY, OnUpdateMultiply) ON_UPDATE_COMMAND_UI(IDM_ADDBITMAPS, OnUpdateAddbitmaps) ON_UPDATE_COMMAND_UI(IDM_STITCH, OnUpdateStitch) ON_UPDATE_COMMAND_UI(IDM_FREEHANDWAVE, OnUpdateFreehandwave) ON_UPDATE_COMMAND_UI(IDM_WIND, OnUpdateWind) ON_UPDATE_COMMAND_UI(IDM_POLAR, OnUpdatePolar) ON_UPDATE_COMMAND_UI(IDM_ZOOMWAVE, OnUpdateZoomwave) ON_UPDATE_COMMAND_UI(IDM_RADIALWAVE, OnUpdateRadialwave) ON_UPDATE_COMMAND_UI(IDM_SWIRL, OnUpdateSwirl) ON_UPDATE_COMMAND_UI(IDM_WAVE, OnUpdateWave) ON_UPDATE_COMMAND_UI(IDM_WAVESHEAR, OnUpdateWaveshear) ON_UPDATE_COMMAND_UI(IDM_EMBOSS, OnUpdateEmboss) ON_UPDATE_COMMAND_UI(IDM_PUNCH, OnUpdatePunch) ON_UPDATE_COMMAND_UI(IDM_RIPPLE, OnUpdateRipple) ON_UPDATE_COMMAND_UI(IDM_BENDING, OnUpdateBending) ON_UPDATE_COMMAND_UI(IDM_CYLINDRICAL, OnUpdateCylindrical) ON_UPDATE_COMMAND_UI(IDM_SPHERIZE, OnUpdateSpherize) ON_UPDATE_COMMAND_UI(IDM_IMPRESSION, OnUpdateImpression) ON_UPDATE_COMMAND_UI(IDM_OILIFY, OnUpdateOilify) ON_UPDATE_COMMAND_UI(IDM_UNDERLAY, OnUpdateUnderlay) ON_UPDATE_COMMAND_UI(IDM_PIXELATE, OnUpdatePixelate) ON_UPDATE_COMMAND_UI(IDM_MOSAIC, OnUpdateMosaic) ON_UPDATE_COMMAND_UI(IDM_EDGEDETECT, OnUpdateEdgedetect) ON_UPDATE_COMMAND_UI(IDM_EROSION, OnUpdateErosion) ON_UPDATE_COMMAND_UI(IDM_DILATION, OnUpdateDilation) ON_UPDATE_COMMAND_UI(IDM_GRADIENT, OnUpdateGradient) ON_UPDATE_COMMAND_UI(IDM_LAPLACE, OnUpdateLaplace) ON_UPDATE_COMMAND_UI(IDM_SOBEL, OnUpdateSobel) ON_UPDATE_COMMAND_UI(IDM_PREWITT, OnUpdatePrewitt) ON_UPDATE_COMMAND_UI(IDM_SHIFTDIFF, OnUpdateShiftdiff) ON_UPDATE_COMMAND_UI(IDM_LINESEG, OnUpdateLineseg) ON_UPDATE_COMMAND_UI(IDM_DETECT, OnUpdateDetect) ON_UPDATE_COMMAND_UI(IDM_SOLARIZE, OnUpdateSolarize) ON_UPDATE_COMMAND_UI(IDM_POSTERIZE, OnUpdatePosterize) ON_UPDATE_COMMAND_UI(IDM_BRIGHTNESS, OnUpdateBrightness) ON_UPDATE_COMMAND_UI(IDM_CONTRAST, OnUpdateContrast) ON_UPDATE_COMMAND_UI(IDM_HUE, OnUpdateHue) ON_UPDATE_COMMAND_UI(IDM_SATURATION, OnUpdateSaturation) ON_UPDATE_COMMAND_UI(IDM_GAMMA, OnUpdateGamma) ON_UPDATE_COMMAND_UI(IDM_BALANCECOLORS, OnUpdateBalancecolors) ON_UPDATE_COMMAND_UI(IDM_HALFTONE, OnUpdateHalftone) ON_UPDATE_COMMAND_UI(IDM_GRAYSCALE, OnUpdateGrayscale) ON_UPDATE_COMMAND_UI(IDM_COLOREDGRAY, OnUpdateColoredgray) ON_UPDATE_COMMAND_UI(IDM_REMAPINTENSITY, OnUpdateRemapintensity) ON_UPDATE_COMMAND_UI(IDM_REMAPHUE, OnUpdateRemaphue) ON_UPDATE_COMMAND_UI(IDM_HISTOEQUALIZE, OnUpdateHistoequalize) ON_UPDATE_COMMAND_UI(IDM_STRETCHINTENSITY, OnUpdateStretchintensity) ON_UPDATE_COMMAND_UI(IDM_LOCALEQUALIZE, OnUpdateLocalequalize) ON_UPDATE_COMMAND_UI(IDM_HISTOCONTRAST, OnUpdateHistocontrast) ON_UPDATE_COMMAND_UI(IDM_FILLBLACK, OnUpdateFillblack) ON_UPDATE_COMMAND_UI(IDM_FILLWHITE, OnUpdateFillwhite) ON_UPDATE_COMMAND_UI(IDM_FILLRED, OnUpdateFillred) ON_UPDATE_COMMAND_UI(IDM_FILLGREEN, OnUpdateFillgreen) ON_UPDATE_COMMAND_UI(IDM_FILLBLUE, OnUpdateFillblue) ON_UPDATE_COMMAND_UI(IDM_FILLCYAN, OnUpdateFillcyan) ON_UPDATE_COMMAND_UI(IDM_FILLMAGENTA, OnUpdateFillmagenta) ON_UPDATE_COMMAND_UI(IDM_FILLYELLOW, OnUpdateFillyellow) ON_UPDATE_COMMAND_UI(IDM_COLORSEP_RGB, OnUpdateColorsepRgb) ON_UPDATE_COMMAND_UI(IDM_COLORSEP_CMYK, OnUpdateColorsepCmyk) ON_UPDATE_COMMAND_UI(IDM_COLORSEP_HSV, OnUpdateColorsepHsv) ON_UPDATE_COMMAND_UI(IDM_COLORSEP_HLS, OnUpdateColorsepHls) ON_UPDATE_COMMAND_UI(IDM_COLORSEP_CMY, OnUpdateColorsepCmy) ON_UPDATE_COMMAND_UI(IDM_COLORSEP_ALPHA, OnUpdateColorsepAlpha) ON_UPDATE_COMMAND_UI(IDM_COUNTCOLORS, OnUpdateCountcolors) ON_UPDATE_COMMAND_UI(IDM_PALETTEEDITOR, OnUpdatePaletteeditor) ON_UPDATE_COMMAND_UI(IDM_INVERT, OnUpdateInvert) ON_UPDATE_COMMAND_UI(IDM_JPEGWEBTUNER, OnUpdateJpegwebtuner) ON_UPDATE_COMMAND_UI(IDM_PNGWEBTUNER, OnUpdatePngwebtuner) ON_UPDATE_COMMAND_UI(IDM_GIFWEBTUNER, OnUpdateGifwebtuner) ON_UPDATE_COMMAND_UI(IDM_HTMLMAPPER, OnUpdateHtmlmapper) ON_UPDATE_COMMAND_UI(IDM_FILEFORMATASSOCIATIONS, OnUpdateFileformatassociations) ON_UPDATE_COMMAND_UI(IDM_PRINTSTITCHEDIMAGES, OnUpdatePrintstitchedimages) ON_UPDATE_COMMAND_UI(IDM_PREVIEW, OnUpdatePreview) ON_COMMAND(IDM_REMOVEREDEYE, OnRemoveRedEye) ON_COMMAND(ID_IMAGE_SLICE, OnImageSlice) //}}AFX_MSG_MAP ON_MESSAGE(WM_DOREALIZE, OnDoRealize) // Standard printing commands ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDemoView construction/destruction CDemoView::CDemoView() : CFormView(CDemoView::IDD) { //{{AFX_DATA_INIT(CDemoView) //}}AFX_DATA_INIT m_pPalette = NULL; m_nEffect = EFX_EFFECT_NONE; m_nRegionTool = IDM_TOOLNONE; m_nRegionType = 0; m_nZoom = 100; m_bMovingFloater = FALSE; } CDemoView::~CDemoView() { } void CDemoView::DoDataExchange(CDataExchange* pDX) { CFormView::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDemoView) DDX_Control(pDX, IDC_LEADRASTERVIEW1, m_RasterView); //}}AFX_DATA_MAP } BOOL CDemoView::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); } ///////////////////////////////////////////////////////////////////////////// // CDemoView printing BOOL CDemoView::OnPreparePrinting(CPrintInfo* pInfo) { // default preparation return DoPreparePrinting(pInfo); } ///////////////////////////////////////////////////////////////////////////// // CDemoView diagnostics #ifdef _DEBUG void CDemoView::AssertValid() const { CFormView::AssertValid(); } void CDemoView::Dump(CDumpContext& dc) const { CFormView::Dump(dc); } CDemoDoc* CDemoView::GetDocument() // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDemoDoc))); return (CDemoDoc*)m_pDocument; } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CDemoView message handlers void CDemoView::OnInitialUpdate() { CFormView::OnInitialUpdate(); CDemoDoc *pDoc = (CDemoDoc *)GetDocument(); ILEADRaster *pRaster =pDoc->m_pRaster; pRaster->RefBitmap = TRUE; m_RasterView.GetRaster().SetBitmap(pRaster->Bitmap); GetDocument()->m_pRasterViewForSave = &m_RasterView; int xExt = (int)pRaster->BitmapWidth, yExt = (int)pRaster->BitmapHeight; // 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)); m_RasterView.SetAutoPan(TRUE); m_RasterView.SetBackErase(FALSE); } void CDemoView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) { CDemoDoc* pDoc = GetDocument(); m_RasterView.SetAutoRepaint(FALSE); m_RasterView.SetPaintPalette(theApp.m_bAutoPalette ? PAINTPALETTE_AUTO : PAINTPALETTE_FIXED); m_RasterView.SetPaintDither(theApp.m_bOrderedDither ? PAINTDITHER_ORDERED : PAINTDITHER_DIFFUSION); m_RasterView.SetBitonalScaling(theApp.m_nBitonalScaling); m_RasterView.SetPaintScaling(theApp.m_nPaintScaling); m_RasterView.SetAutoRepaint(TRUE); } void CDemoView::OnSize(UINT nType, int cx, int cy) { CFormView::OnSize(nType, cx, cy); if( IsWindow(m_RasterView.m_hWnd) ) { m_RasterView.SetBackErase(FALSE); m_RasterView.MoveWindow(0, 0, cx, cy); } } //View Menu Item void CDemoView::OnViewZoom() { CDemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); 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); } if(pDoc->m_bMagGlass) { StopMagGlass(); StartMagGlass(); } } void CDemoView::OnUpdateViewZoom(CCmdUI* pCmdUI) { bool bCheck; bCheck = ((m_RasterView.GetPaintSizeMode()==PAINTSIZEMODE_ZOOM) && (m_RasterView.GetPaintZoomFactor()!=100.0f)); pCmdUI->SetCheck(bCheck); pCmdUI->Enable(!theApp.m_bStartEffect); } 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 CDemoView::OnViewPainteffects() { CClientDC cdc(this); DWORD dw; int i; if(m_RasterView.GetRaster().GetHasRgn()) OnEditCancelregion(); theApp.m_bStartEffect = TRUE; m_RasterView.SetEnableProgressStatus(TRUE); m_bQuit = FALSE; BeginWaitCursor(); EnableSysMenu(FALSE); BOOL bVal = m_RasterView.GetBackErase(); m_RasterView.SetBackErase(TRUE); m_RasterView.SetEffectDelay(10); for (i = 0; i < sizeof(nEffectIndex) / sizeof(nEffectIndex[0]); i += 2) { for (m_nEffect = nEffectIndex[i]; m_nEffect <= nEffectIndex[i+1]; m_nEffect++) { m_RasterView.SetPaintEffect(m_nEffect); if(m_bQuit) { m_nEffect = EFX_EFFECT_NONE; m_RasterView.SetPaintEffect(0); theApp.m_bStartEffect = FALSE; break; } dw = GetTickCount (); while ((GetTickCount () - dw) < 1000); } if(m_bQuit) { m_nEffect = EFX_EFFECT_NONE; m_RasterView.SetPaintEffect(0); theApp.m_bStartEffect = FALSE; break; } } m_RasterView.SetBackErase(FALSE); m_nEffect = EFX_EFFECT_NONE; m_RasterView.SetPaintEffect(0); m_RasterView.SetEnableProgressStatus(FALSE); theApp.m_bStartEffect = FALSE; EnableSysMenu(TRUE); EndWaitCursor(); } void CDemoView::OnViewNormal() { CDemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); m_RasterView.SetPaintSizeMode(PAINTSIZEMODE_NORMAL); SetZoom(100); if(pDoc->m_bMagGlass) { StopMagGlass(); StartMagGlass(); } } void CDemoView::OnUpdateViewNormal(CCmdUI* pCmdUI) { bool bCheck; // bCheck = (GetZoom() == 100) && (m_RasterView.GetPaintSizeMode() == PAINTSIZEMODE_NORMAL); bCheck = (m_RasterView.GetPaintZoomFactor()==100); // pCmdUI->SetCheck(GetZoom() == 100); pCmdUI->SetCheck(bCheck); pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::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_RasterView.GetDstWidth() - rcClient.Width() + (int)(m_RasterView.GetVScrollInfo().GetWidth() / 2), rcWindow.Height() + (int) m_RasterView.GetDstHeight() - rcClient.Height() + (int)(m_RasterView.GetHScrollInfo().GetWidth() / 2)); } void CDemoView::OnViewFitimagetowindow() { m_RasterView.SetPaintSizeMode(PAINTSIZEMODE_FIT); } void CDemoView::OnUpdateViewFitimagetowindow(CCmdUI* pCmdUI) { pCmdUI->SetCheck(m_RasterView.GetPaintSizeMode() == PAINTSIZEMODE_FIT); } void CDemoView::OnViewStretchimagetowindow() { m_RasterView.SetPaintSizeMode(PAINTSIZEMODE_STRETCH); } void CDemoView::OnUpdateViewStretchimagetowindow(CCmdUI* pCmdUI) { pCmdUI->SetCheck(m_RasterView.GetPaintSizeMode() == PAINTSIZEMODE_STRETCH); } void CDemoView::OnViewPanwindow() { short nRet; CDemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if(pDoc->m_bPanWin) { m_RasterView.ShowPanWin(FALSE); pDoc->m_bPanWin = FALSE; } else { m_RasterView.SetPanWinX(0); m_RasterView.SetPanWinY(0); m_RasterView.SetPanWinWidth(150.0f); m_RasterView.SetPanWinHeight(150.0f); m_RasterView.SetPanWinTitle(TEXT("PanWindow")); m_RasterView.SetPanWinRectColor(RGB(255,0,0)); m_RasterView.SetPanWinSysMenu(TRUE); m_RasterView.SetPanWinPaintPalette(m_RasterView.GetPaintPalette()); m_RasterView.SetPanWinBitonalScaling(m_RasterView.GetBitonalScaling()); m_RasterView.SetPanWinPaintScaling(m_RasterView.GetPaintScaling()); m_RasterView.SetPanWinPaintDither(m_RasterView.GetPaintDither()); nRet = m_RasterView.ShowPanWin(TRUE); if(nRet == 0) pDoc->m_bPanWin = TRUE; } } void CDemoView::OnViewMagnifyingglass() { CDemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if(pDoc->m_bMagGlass) StopMagGlass(); else StartMagGlass(); } void CDemoView::StartMagGlass() { CDemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if(!pDoc->m_bMagGlass) { if(m_RasterView.GetRaster().GetHasRgn()) OnEditCancelregion(); m_nRegionTool = IDM_TOOLNONE; m_RasterView.StartMagGlass(150.0f, 100.0f, 200, 0, m_RasterView.GetBackColor(), FALSE, 1.0f, TRUE, CROSSHAIR_FINE, TRUE, TRUE); pDoc->m_bMagGlass = TRUE; } } void CDemoView::StopMagGlass() { CDemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if(pDoc->m_bMagGlass) { if(m_RasterView.GetRaster().GetHasRgn()) { m_RasterView.GetRaster().FreeRgn(); OnEditCancelregion(); } m_nRegionTool = IDM_TOOLNONE; m_RasterView.StopMagGlass(); m_RasterView.SetAutoPan(TRUE); pDoc->m_bMagGlass = FALSE; } } void CDemoView::OnUpdateViewMagnifyingglass(CCmdUI* pCmdUI) { CDemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); pCmdUI->SetCheck(pDoc->m_bMagGlass); pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateViewPanwindow(CCmdUI* pCmdUI) { CDemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); pCmdUI->SetCheck(pDoc->m_bPanWin); pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::SetZoom(int nZoom) { m_nZoom = nZoom; if (m_RasterView.GetRaster().GetBitmap()) { m_RasterView.SetPaintZoomFactor((float)m_nZoom); } } int CDemoView::GetZoom() { return m_nZoom; } void CDemoView::RestoreBackground() { if (GetDocument()->m_pRasterFloaterBackground->Bitmap != NULL ) { theApp.m_pRasterProcess->Combine( m_RasterView.GetRaster(), m_RasterView.GetRaster().GetRgnLeft(), m_RasterView.GetRaster().GetRgnTop(), m_RasterView.GetRaster().GetRgnWidth(), m_RasterView.GetRaster().GetRgnHeight(), GetDocument()->m_pRasterFloaterBackground, 0.0f, 0.0f, SRC_COPY ); } } BEGIN_EVENTSINK_MAP(CDemoView, CFormView) //{{AFX_EVENTSINK_MAP(CDemoView) ON_EVENT(CDemoView, IDC_LEADRASTERVIEW1, 14 /* PanWin */, OnPanWinLeadrasterview1, VTS_I4 VTS_I2) ON_EVENT(CDemoView, IDC_LEADRASTERVIEW1, 4 /* MouseDown */, OnMouseDownLeadrasterview1, VTS_I2 VTS_I2 VTS_R4 VTS_R4) ON_EVENT(CDemoView, IDC_LEADRASTERVIEW1, 3 /* MouseMove */, OnMouseMoveLeadrasterview1, VTS_I2 VTS_I2 VTS_R4 VTS_R4) ON_EVENT(CDemoView, IDC_LEADRASTERVIEW1, 5 /* MouseUp */, OnMouseUpLeadrasterview1, VTS_I2 VTS_I2 VTS_R4 VTS_R4) ON_EVENT(CDemoView, IDC_LEADRASTERVIEW1, 2 /* RgnChange */, OnRgnChangeLeadrasterview1, VTS_NONE) ON_EVENT(CDemoView, IDC_LEADRASTERVIEW1, 17 /* KeyUp */, OnKeyUpLeadrasterview1, VTS_I2 VTS_I2) ON_EVENT(CDemoView, IDC_LEADRASTERVIEW1, 10 /* ProgressStatus */, OnProgressStatusLeadrasterview1, VTS_I2) //}}AFX_EVENTSINK_MAP END_EVENTSINK_MAP() void CDemoView::OnPanWinLeadrasterview1(long hPanWin, short iFlag) { CDemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if(iFlag == PANWIN_DESTROYED) pDoc->m_bPanWin = FALSE; } void CDemoView::OnColorSeparationCMYK() { int i; BeginProcessing(); int nRet = theApp.m_pRasterProcess->ColorSeparate(m_RasterView.GetRaster(), COLORSEP_CMYK); if(!nRet) { for(i = 0; i < 4; i++) { theApp.m_pBitmap = theApp.m_pRasterProcess->GetColorPlanes(i); theApp.OpenDocument(OPENMODE_BITMAP); theApp.m_pRasterProcess->PutColorPlanes(i,0); } } EndProcessing(nRet); } void CDemoView::OnColorSeparationCMY() { int i; BeginProcessing(); int nRet = theApp.m_pRasterProcess->ColorSeparate(m_RasterView.GetRaster(), COLORSEP_CMY); if(!nRet) { for(i = 0; i < 3; i++) { theApp.m_pBitmap = theApp.m_pRasterProcess->GetColorPlanes(i); theApp.OpenDocument(OPENMODE_BITMAP); theApp.m_pRasterProcess->PutColorPlanes(i,0); } } EndProcessing(nRet); } void CDemoView::OnColorSeparationRGB() { int i; BeginProcessing(); int nRet = theApp.m_pRasterProcess->ColorSeparate(m_RasterView.GetRaster(), COLORSEP_RGB); if(!nRet) { for(i = 0; i < 3; i++) { theApp.m_pBitmap = theApp.m_pRasterProcess->GetColorPlanes(i); theApp.OpenDocument(OPENMODE_BITMAP); theApp.m_pRasterProcess->PutColorPlanes(i,0); } } EndProcessing(nRet); } void CDemoView::OnColorSeparationHSV() { int i; BeginProcessing(); int nRet = theApp.m_pRasterProcess->ColorSeparate(m_RasterView.GetRaster(), COLORSEP_HSV); if(!nRet) { for(i = 0; i < 3; i++) { theApp.m_pBitmap = theApp.m_pRasterProcess->GetColorPlanes(i); theApp.OpenDocument(OPENMODE_BITMAP); theApp.m_pRasterProcess->PutColorPlanes(i,0); } } EndProcessing(nRet); } void CDemoView::OnColorSeparationHLS() { int i; BeginProcessing(); int nRet = theApp.m_pRasterProcess->ColorSeparate(m_RasterView.GetRaster(), COLORSEP_HLS); if(!nRet) { for(i = 0; i < 3; i++) { theApp.m_pBitmap = theApp.m_pRasterProcess->GetColorPlanes(i); theApp.OpenDocument(OPENMODE_BITMAP); theApp.m_pRasterProcess->PutColorPlanes(i,0); } } EndProcessing(nRet); } void CDemoView::OnColorSeparationALPHA() { BeginProcessing(); theApp.m_pBitmap = m_RasterView.GetRaster().GetBitmapAlpha(); theApp.OpenDocument(OPENMODE_BITMAP); theApp.m_pRasterProcess->PutColorPlanes(0,0); EndProcessing(SUCCESS); } void CDemoView::BeginProcessing() { BeginWaitCursor(); GetUndoRaster()->Bitmap = m_RasterView.GetRaster().GetBitmap(); } void CDemoView::EndProcessing(int nRet) { EndWaitCursor(); theApp.DisplayLEADError(nRet); } ILEADRaster * CDemoView::GetUndoRaster() { CDemoDoc* pDoc = GetDocument(); return(pDoc->m_pRasterUndo); } static const WCHAR BASED_CODE _szLicString[] = L"LEADTOOLS OCX Copyright (c) 1991-2001 LEAD Technologies, Inc."; void CDemoView::OnChanged() { CDemoDoc* pDoc = GetDocument(); pDoc->SetModifiedFlag(); pDoc->UpdateAllViews(NULL, (LPARAM) 0); } void CDemoView::SetRegionTool(int nRegionTool) { m_nRegionTool = nRegionTool; } void CDemoView::OnMouseDownLeadrasterview1(short Button, short Shift, float x, float y) { CDemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if(pDoc->m_bMagGlass) return; /* nothing to do! */ if( Button != 1 ) return; /* nothing to do! */ if (theApp.m_bStartEffect) return; HCURSOR hOldCursor = SetCursor(LoadCursor(NULL,IDC_WAIT)); if( m_RasterView.GetRaster().GetHasRgn() && m_RasterView.GetRaster().IsPtInRgn( (x - m_RasterView.GetDstLeft()) * m_RasterView.GetSrcWidth() / m_RasterView.GetDstWidth(), (y - m_RasterView.GetDstTop()) * m_RasterView.GetSrcHeight() / m_RasterView.GetDstHeight()) ) { m_RasterView.SetAutoRepaint(FALSE); m_RasterView.SetRgnMarkingMode(RGNMARK_NONE); m_RasterView.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_RasterView.SetFloaterVisible(FALSE); m_RasterView.SetFloater(m_RasterView.GetRaster().GetBitmap()); // the floater coordinates are relative to the window, while the // ocx region coordinates are relative to the bitmap. Adding m_RasterView.DstLeft // converts m_RasterView.RgnLeft to window coordinates m_rcFloater.left = (int) ((m_RasterView.GetRaster().GetRgnLeft() * m_RasterView.GetDstWidth() + m_RasterView.GetSrcWidth() - 1) / m_RasterView.GetSrcWidth() + m_RasterView.GetDstLeft()); m_rcFloater.top = (int) (m_RasterView.GetRaster().GetRgnTop() * m_RasterView.GetDstHeight() / m_RasterView.GetSrcHeight() + m_RasterView.GetDstTop()); m_rcFloater.right = (int) (((m_RasterView.GetFloaterWidth() + m_RasterView.GetRaster().GetRgnLeft()) * m_RasterView.GetDstWidth() + m_RasterView.GetSrcWidth() - 1) / m_RasterView.GetSrcWidth() + m_RasterView.GetDstLeft()); m_rcFloater.bottom = (int) ((m_RasterView.GetFloaterHeight() + m_RasterView.GetRaster().GetRgnTop()) * m_RasterView.GetDstHeight() / m_RasterView.GetSrcHeight() + m_RasterView.GetDstTop()); m_RasterView.SetFloaterDstRect((float) m_rcFloater.left, (float) m_rcFloater.top, (float) m_rcFloater.Width(), (float) m_rcFloater.Height()); if( GetDocument()->m_pRasterFloaterBackground->Bitmap != NULL ) { theApp.m_pRasterProcess->Combine( m_RasterView.GetRaster(), m_RasterView.GetRaster().GetRgnLeft(), m_RasterView.GetRaster().GetRgnTop(), m_RasterView.GetFloaterWidth(), m_RasterView.GetFloaterHeight(), GetDocument()->m_pRasterFloaterBackground, 0.0f, 0.0f, SRC_COPY ); // RepaintRect uses window coordinates like the floater bitmap m_RasterView.RepaintRect(m_RasterView.GetFloaterDstLeft(), m_RasterView.GetFloaterDstTop(), m_RasterView.GetFloaterDstWidth(), m_RasterView.GetFloaterDstHeight(), FALSE); } m_RasterView.SetFloaterVisible(TRUE); m_bMovingFloater = TRUE; } else if (m_nRegionTool != IDM_TOOLNONE) { m_RasterView.SetRgnFrameType(RGNFRAME_NONE); switch(m_nRegionTool) { case IDM_TOOLRECT: m_RasterView.SetRgnMarkingMode(RGNMARK_RECT); break; case IDM_TOOLELLIPSE: m_RasterView.SetRgnMarkingMode(RGNMARK_ELLIPSE); break; case IDM_TOOLRNDRECT: m_RasterView.SetRgnMarkingMode(RGNMARK_ROUNDRECT); break; case IDM_TOOLFREEHAND: m_RasterView.SetRgnMarkingMode(RGNMARK_FREEHAND); break; } } GetDocument()->m_pRasterFloaterBackground->Bitmap = 0; // the background bitmap is not needed anymore SetCursor(hOldCursor); } void CDemoView::OnMouseMoveLeadrasterview1(short Button, short Shift, float x, float y) { if( (Button == 1) && m_bMovingFloater ) { if (theApp.m_bStartEffect) return; m_RasterView.SetFloaterDstRect( (float) (m_rcFloater.left + x - m_xStart), (float) (m_rcFloater.top + y - m_yStart), m_RasterView.GetFloaterDstWidth(), m_RasterView.GetFloaterDstHeight() ); } } void CDemoView::OnMouseUpLeadrasterview1(short Button, short Shift, float x, float y) { HRGN hRegion; float dx, dy; if (Button != 1) return; /* nothing to do ! */ HCURSOR hOldCursor = SetCursor(LoadCursor(NULL,IDC_WAIT)); ILEADRaster *pRasterFloaterBackground = GetDocument()->m_pRasterFloaterBackground; if( m_RasterView.GetRgnMarkingMode() != RGNMARK_NONE ) { m_RasterView.SetRgnMarkingMode(RGNMARK_NONE); m_RasterView.SetRgnFrameType(RGNFRAME_STATIC); GetDocument()->UpdateAllViews(this, (LPARAM)0); } else if(m_bMovingFloater) { m_bMovingFloater = FALSE; m_RasterView.SetRgnFrameType(RGNFRAME_NONE); hRegion = (HRGN)m_RasterView.GetFloaterHandle(); // Calculate the region offset if(x >= m_xStart) dx = (x - m_xStart) * (long) m_RasterView.GetSrcWidth() / (long) m_RasterView.GetDstWidth(); else dx = ((x - m_xStart) * (long) m_RasterView.GetSrcWidth() - (long) m_RasterView.GetDstWidth() + 1) / (long) m_RasterView.GetDstWidth(); if(y >= m_yStart) dy = (y - m_yStart) * (long) m_RasterView.GetSrcHeight() / (long) m_RasterView.GetDstHeight(); else dy = ((y - m_yStart) * (long) m_RasterView.GetSrcHeight() - (long) m_RasterView.GetDstHeight() + 1) / (long) m_RasterView.GetDstHeight(); m_RasterView.GetRaster().OffsetRgn(dx, dy); // save the background in case we want to move the floater again pRasterFloaterBackground->CreateBitmap( m_RasterView.GetFloaterWidth(), m_RasterView.GetFloaterHeight(), m_RasterView.GetRaster().GetBitmapBits()); if((m_RasterView.GetRaster().GetIsGrayscale() != GRAY_NO) && (m_RasterView.GetRaster().GetBitmapBits()>8)) { theApp.m_pRasterProcess->Grayscale(pRasterFloaterBackground, m_RasterView.GetRaster().GetBitmapBits()); } theApp.m_pRasterProcess->Combine( pRasterFloaterBackground, 0.0f, 0.0f, m_RasterView.GetFloaterWidth(), m_RasterView.GetFloaterHeight(), m_RasterView.GetRaster(), m_RasterView.GetRaster().GetRgnLeft(), m_RasterView.GetRaster().GetRgnTop(), 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 ILEADRaster *pRasterTemp=NULL; HRESULT hr = theApp.CreateRasterObjectLic(&pRasterTemp); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER); return;} pRasterTemp->Bitmap = m_RasterView.GetFloater(); theApp.m_pRasterProcess->Combine( m_RasterView.GetRaster(), m_RasterView.GetRaster().GetRgnLeft(), m_RasterView.GetRaster().GetRgnTop(), m_RasterView.GetFloaterWidth(), m_RasterView.GetFloaterHeight(), pRasterTemp, 0.0f, 0.0f, SRC_COPY ); pRasterTemp->Release(); // free the floater m_RasterView.SetFloater(NULL); // draw the frame m_RasterView.SetRgnFrameType(RGNFRAME_STATIC); m_RasterView.GetRaster().DeleteRgnHandle ((long)hRegion); // delete the region object m_RasterView.SetAutoRepaint(TRUE); /* update the changes back into the master document and all other views */ //UpdateMasterDocument(); } SetCursor(hOldCursor); } void CDemoView::UpdateMasterDocument() { /* ILEADRasterPtr pRaster = GetDocRaster(); // merge the changes back into the master document long hRegion = m_RasterView.GetRgnHandle(); GetDocRaster()->Bitmap = m_Lead.GetBitmap() ); GetDocRaster()->SetRgnHandle(hRegion,0.0f,0.0f,L_RGN_SET); m_Lead.DeleteRgnHandle(hRegion); GetDocument()->UpdateAllViews(this, (LPARAM)0); */ } void CDemoView::OnToolrect() { StopMagGlass(); SetRegionTool( IDM_TOOLRECT ); m_RasterView.SetAutoPan(FALSE); } void CDemoView::OnUpdateToolrect(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); pCmdUI->SetCheck(m_nRegionTool == IDM_TOOLRECT); } void CDemoView::OnToolrndrect() { StopMagGlass(); SetRegionTool( IDM_TOOLRNDRECT ); m_RasterView.SetAutoPan(FALSE); } void CDemoView::OnUpdateToolrndrect(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); pCmdUI->SetCheck(m_nRegionTool == IDM_TOOLRNDRECT); } void CDemoView::OnToolfreehand() { StopMagGlass(); SetRegionTool( IDM_TOOLFREEHAND ); m_RasterView.SetAutoPan(FALSE); } void CDemoView::OnUpdateToolfreehand(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); pCmdUI->SetCheck(m_nRegionTool == IDM_TOOLFREEHAND); } void CDemoView::OnToolellipse() { StopMagGlass(); SetRegionTool( IDM_TOOLELLIPSE ); m_RasterView.SetAutoPan(FALSE); } void CDemoView::OnUpdateToolellipse(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); pCmdUI->SetCheck(m_nRegionTool == IDM_TOOLELLIPSE); } void CDemoView::OnToolnone() { SetRegionTool( IDM_TOOLNONE ); m_RasterView.SetAutoPan(TRUE); } void CDemoView::OnUpdateToolnone(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); pCmdUI->SetCheck(m_nRegionTool == IDM_TOOLNONE); } void CDemoView::OnEditCancelregion() { HCURSOR hOldCursor = SetCursor(LoadCursor(NULL,IDC_WAIT)); RestoreBackground(); m_RasterView.GetRaster().FreeRgn(); /* delete the regions from the master document and all other views */ m_RasterView.SetRgnFrameType(RGNFRAME_NONE); m_RasterView.SetFloater(0); SetCursor(hOldCursor); } void CDemoView::OnUpdateEditCancelregion(CCmdUI* pCmdUI) { pCmdUI->Enable(m_RasterView.GetRaster().GetHasRgn() && !theApp.m_bStartEffect); } void CDemoView::OnEditUndo() { BeginWaitCursor(); m_RasterView.GetRaster().SetBitmap( GetUndoRaster()->Bitmap); GetDocument()->m_pRasterUndo->Bitmap = 0; OnChanged(); EndWaitCursor(); } void CDemoView::OnUpdateEditUndo(CCmdUI* pCmdUI) { pCmdUI->Enable(GetUndoRaster()->Bitmap != 0 && !theApp.m_bStartEffect); } void CDemoView::OnEditCopy() { BeginWaitCursor(); m_RasterView.GetRaster().Copy(COPY_DIB | COPY_DDB | COPY_PALETTE); EndWaitCursor(); } void CDemoView::OnImageRegiontransformations(unsigned int uOperation) { long hRegion; float xCenter; float yCenter; int nWidth, nHeight, nResizeMethod; int nRet; if (uOperation == ID_IMAGE_RESIZE) { theApp.m_pRasterImgDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgDlg->PutUIFlags(RESIZE_SHOW_IDENTICALVALUE | RESIZE_SHOW_MAINTAINASPECT| RESIZE_SHOW_IDENTICALVALUE| RESIZE_SHOW_RESOLUTION | RESIZE_SHOW_PERCENTAGE); theApp.m_pRasterImgDlg->CurrentWidth = (long) m_RasterView.GetRaster().GetRgnWidth(); theApp.m_pRasterImgDlg->CurrentHeight= (long) m_RasterView.GetRaster().GetRgnHeight(); theApp.m_pRasterImgDlg->CurrentResolutionX = m_RasterView.GetRaster().GetBitmapXRes(); theApp.m_pRasterImgDlg->CurrentResolutionY = m_RasterView.GetRaster().GetBitmapYRes(); theApp.m_pRasterImgDlg->PutBitsPerPixel(m_RasterView.GetRaster().GetBitmapBits ()); ; nRet = theApp.m_pRasterImgDlg->ShowResizeDlg((long)this->m_hWnd); //the method if (nRet == 0 && theApp.m_pRasterImgDlg->DialogStatus == DLG_OK) { nWidth = theApp.m_pRasterImgDlg->GetNewWidth(); nHeight = theApp.m_pRasterImgDlg->GetNewHeight(); nResizeMethod = theApp.m_pRasterImgDlg->GetResizeFlags(); } if (nRet != 0) return; } HCURSOR hOldCursor = SetCursor(LoadCursor(NULL,IDC_WAIT)); m_RasterView.SetAutoRepaint(FALSE); m_RasterView.SetFloaterVisible(FALSE); m_RasterView.SetFloater(m_RasterView.GetRaster().GetBitmap()); RestoreBackground(); theApp.m_pRasterRgn->Bitmap = m_RasterView.GetFloater(); m_RasterView.SetFloater(0); // do the transformation on the copy switch (uOperation) { case ID_IMAGE_FLIP: theApp.m_pRasterProcess->Flip(theApp.m_pRasterRgn); break; case ID_IMAGE_REVERSE: theApp.m_pRasterProcess->Reverse(theApp.m_pRasterRgn); break; case ID_IMAGE_ROTATE_90CLOCKWISE: theApp.m_pRasterProcess->Rotate(theApp.m_pRasterRgn, 9000, (RotateConstants)ROTATE_RESIZE, RGB(255, 255, 255)); break; case ID_IMAGE_ROTATE_180CLOCKWISE: theApp.m_pRasterProcess->Rotate(theApp.m_pRasterRgn, 18000, (RotateConstants)ROTATE_RESIZE, RGB(255, 255, 255)); break; case ID_IMAGE_ROTATE_270CLOCKWISE: theApp.m_pRasterProcess->Rotate(theApp.m_pRasterRgn, 27000, (RotateConstants)ROTATE_RESIZE, RGB(255, 255, 255)); break; case ID_IMAGE_SHEAR: theApp.m_pRasterProcess->Shear(theApp.m_pRasterRgn, m_nAngle, (RotateConstants)ROTATE_RESIZE, RGB(255, 255, 255)); break; case ID_IMAGE_RESIZE: theApp.m_pRasterProcess->Size(theApp.m_pRasterRgn, (float) nWidth, (float) nHeight, (ResizeConstants)nResizeMethod); case ID_IMAGE_ROTATE_ANYANGLE: theApp.m_pRasterProcess->Rotate(theApp.m_pRasterRgn, m_nAngle,(RotateConstants)ROTATE_RESIZE, RGB(255, 255, 255)); break; case ID_HISTOEQUALIZE: theApp.m_pRasterProcess->HistoEqualize(theApp.m_pRasterRgn, (ColorSpaceConstants)YUV_SPACE); break; default: AfxMessageBox(TEXT("Error: OnImageRegiontransformations\n")); break; } m_RasterView.SetRgnFrameType(RGNFRAME_NONE); hRegion = theApp.m_pRasterRgn->GetRgnHandle(); xCenter = m_RasterView.GetRaster().GetRgnLeft() + m_RasterView.GetRaster().GetRgnWidth() / 2; yCenter = m_RasterView.GetRaster().GetRgnTop() + m_RasterView.GetRaster().GetRgnHeight() / 2; m_RasterView.GetRaster().SetRgnHandle(hRegion, xCenter - theApp.m_pRasterRgn->BitmapWidth / 2, yCenter - theApp.m_pRasterRgn->BitmapHeight / 2, L_RGN_SET); m_RasterView.GetRaster().DeleteRgnHandle (hRegion); SaveBackground(); theApp.m_pRasterProcess->Combine( m_RasterView.GetRaster(), xCenter - theApp.m_pRasterRgn->BitmapWidth / 2, yCenter - theApp.m_pRasterRgn->BitmapHeight / 2, theApp.m_pRasterRgn->BitmapWidth, theApp.m_pRasterRgn->BitmapHeight, theApp.m_pRasterRgn, 0.0f, 0.0f, SRC_COPY ); m_RasterView.RepaintRect( m_RasterView.GetRaster().GetRgnLeft() * m_RasterView.GetDstWidth() / m_RasterView.GetSrcWidth() + m_RasterView.GetDstLeft(), m_RasterView.GetRaster().GetRgnTop() * m_RasterView.GetDstWidth() / m_RasterView.GetSrcWidth() + m_RasterView.GetDstTop(), m_RasterView.GetRaster().GetRgnWidth() * m_RasterView.GetDstWidth() / m_RasterView.GetSrcWidth(), m_RasterView.GetRaster().GetRgnHeight() * m_RasterView.GetDstWidth() / m_RasterView.GetSrcWidth(), FALSE); m_RasterView.SetRgnFrameType(RGNFRAME_STATIC); theApp.m_pRasterRgn->Bitmap = 0; m_RasterView.SetAutoRepaint(TRUE); // update the changes back into the master document and all other views UpdateMasterDocument(); SetCursor(hOldCursor); } void CDemoView::SaveBackground() { if (m_RasterView.GetRaster().GetRgnWidth() <= 0 || m_RasterView.GetRaster().GetRgnHeight() <= 0) return; GetDocument()->m_pRasterFloaterBackground->CreateBitmap( m_RasterView.GetRaster().GetRgnWidth(), m_RasterView.GetRaster().GetRgnHeight(), m_RasterView.GetRaster().GetBitmapBits() ); if( (m_RasterView.GetRaster().GetIsGrayscale() != GRAY_NO) && (m_RasterView.GetRaster().GetBitmapBits()>8) ) { theApp.m_pRasterProcess->Grayscale( GetDocument()->m_pRasterFloaterBackground, m_RasterView.GetRaster().GetBitmapBits() ); } theApp.m_pRasterProcess->Combine( GetDocument()->m_pRasterFloaterBackground, 0.0f, 0.0f, m_RasterView.GetRaster().GetRgnWidth(), m_RasterView.GetRaster().GetRgnHeight(), m_RasterView.GetRaster(), m_RasterView.GetRaster().GetRgnLeft(), m_RasterView.GetRaster().GetRgnTop(), SRC_COPY); } void CDemoView::OnImageFlip() { if(m_RasterView.GetRaster().GetHasRgn()) { OnImageRegiontransformations(ID_IMAGE_FLIP); } else { BeginProcessing(); int nRet = theApp.m_pRasterProcess->Flip(m_RasterView.GetRaster()); OnChanged(); EndProcessing(nRet); } } void CDemoView::OnImageReverse() { if(m_RasterView.GetRaster().GetHasRgn()) { OnImageRegiontransformations(ID_IMAGE_REVERSE); } else { BeginProcessing(); int nRet = theApp.m_pRasterProcess->Reverse(m_RasterView.GetRaster()); OnChanged(); EndProcessing(nRet); } } void CDemoView::OnImageRotate180clockwise() { if(m_RasterView.GetRaster().GetHasRgn()) { OnImageRegiontransformations(ID_IMAGE_ROTATE_180CLOCKWISE); } else { BeginProcessing(); int nRet = theApp.m_pRasterProcess->Rotate( m_RasterView.GetRaster(), 18000, (RotateConstants)ROTATE_RESIZE, RGB(0, 0, 0) ); OnChanged(); EndProcessing(nRet); } } void CDemoView::OnImageRotate270clockwise() { if(m_RasterView.GetRaster().GetHasRgn()) { OnImageRegiontransformations(ID_IMAGE_ROTATE_270CLOCKWISE); } else { BeginProcessing(); int nRet = theApp.m_pRasterProcess->Rotate( m_RasterView.GetRaster(), 27000, (RotateConstants)ROTATE_RESIZE, RGB(0, 0, 0) ); OnChanged(); EndProcessing(nRet); } } void CDemoView::OnImageRotate90clockwise() { if(m_RasterView.GetRaster().GetHasRgn()) { OnImageRegiontransformations(ID_IMAGE_ROTATE_90CLOCKWISE); } else { BeginProcessing(); int nRet = theApp.m_pRasterProcess->Rotate( m_RasterView.GetRaster(), 9000, (RotateConstants)ROTATE_RESIZE, RGB(0, 0, 0) ); OnChanged(); EndProcessing(nRet); } } void CDemoView::OnImageRotateAnyangle() { if(m_RasterView.GetRaster().GetHasRgn()) { OnImageRegiontransformationsRotate(); } else { int nRet; //assign the bitmap for preview theApp.m_pRasterImgDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgDlg->Angle = 0; theApp.m_pRasterImgDlg->PutRotateFlags((RotateConstants)0); theApp.m_pRasterImgDlg->PutBackColor(RGB(0,0,0)); theApp.m_pRasterImgDlg->EnableResize = TRUE; 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 = theApp.m_pRasterProcess->Rotate( m_RasterView.GetRaster(), (long) theApp.m_pRasterImgDlg->GetAngle(), /* the property */ theApp.m_pRasterImgDlg->GetRotateFlags(), theApp.m_pRasterImgDlg->GetBackColor() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } } void CDemoView::OnRgnChangeLeadrasterview1() { static int iCount = 0; iCount++; CString strMsg; strMsg.Format(TEXT("[%d]OnRgnChangeLeadrasterview1\n"),iCount); //AfxMessageBox(strMsg); OutputDebugString(strMsg); if(GetDocument()->m_pRasterFloaterBackground->Bitmap == NULL) { SaveBackground(); } } void CDemoView::OnImageShear() { if(m_RasterView.GetRaster().GetHasRgn()) { OnImageRegiontransformationsShear(); } else { int nRet; //assign the bitmap for preview theApp.m_pRasterImgDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgDlg->Angle = 0; theApp.m_pRasterImgDlg->PutEnableHorizontal(FALSE); theApp.m_pRasterImgDlg->PutBackColor(RGB(0,0,0)); 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 = theApp.m_pRasterProcess->Shear( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgDlg->GetAngle(), /* the property */ theApp.m_pRasterImgDlg->GetEnableHorizontal(), theApp.m_pRasterImgDlg->GetBackColor() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } } void CDemoView::OnImageRegiontransformationsShear() { int nRet; theApp.m_pRasterImgDlg->PutBitmap(m_RasterView.GetRaster().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) { m_nAngle = (short)theApp.m_pRasterImgDlg->GetAngle(); m_bResize = theApp.m_pRasterImgDlg->GetEnableResize(); OnImageRegiontransformations(ID_IMAGE_SHEAR); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnImageDeskew() { long nAngle; int nRet; BeginProcessing(); nRet = theApp.m_pRasterProcess->Deskew(m_RasterView.GetRaster(),RGB(255,255,255),0); nAngle = theApp.m_pRasterProcess->GetDeskewAngle(); OnChanged(); EndProcessing(nRet); } void CDemoView::OnUpdateImageDeskew(CCmdUI* pCmdUI) { int bSupportLocked = m_RasterView.GetRaster().IsSupportLocked(L_SUPPORT_DOCUMENT); pCmdUI->Enable(!bSupportLocked && !m_RasterView.GetRaster().GetHasRgn() && !theApp.m_bStartEffect); } void CDemoView::OnImageResize() { if(m_RasterView.GetRaster().GetHasRgn()) { OnImageRegiontransformations(ID_IMAGE_RESIZE); return; } int nRet; theApp.m_pRasterImgDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgDlg->PutUIFlags(RESIZE_SHOW_IDENTICALVALUE | RESIZE_SHOW_MAINTAINASPECT| RESIZE_SHOW_IDENTICALVALUE| RESIZE_SHOW_RESOLUTION | RESIZE_SHOW_PERCENTAGE); theApp.m_pRasterImgDlg->CurrentWidth = (long) m_RasterView.GetRaster().GetBitmapWidth(); theApp.m_pRasterImgDlg->CurrentHeight= (long) m_RasterView.GetRaster().GetBitmapHeight(); theApp.m_pRasterImgDlg->CurrentResolutionX = m_RasterView.GetRaster().GetBitmapXRes(); theApp.m_pRasterImgDlg->CurrentResolutionY = m_RasterView.GetRaster().GetBitmapYRes(); theApp.m_pRasterImgDlg->PutBitsPerPixel(m_RasterView.GetRaster().GetBitmapBits ()); ; nRet = theApp.m_pRasterImgDlg->ShowResizeDlg((long)this->m_hWnd); //the method if (nRet == 0 && theApp.m_pRasterImgDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Size(m_RasterView.GetRaster(), theApp.m_pRasterImgDlg->GetNewWidth(), theApp.m_pRasterImgDlg->GetNewHeight(), (ResizeConstants)theApp.m_pRasterImgDlg->GetResizeFlags()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnImageRegiontransformationsRotate() { int nRet; theApp.m_pRasterImgDlg->PutBitmap(m_RasterView.GetRaster().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) { m_nAngle = (short) theApp.m_pRasterImgDlg->GetAngle(); m_bResize = theApp.m_pRasterImgDlg->GetEnableResize (); OnImageRegiontransformations(ID_IMAGE_ROTATE_ANYANGLE); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnColorGrayscale8() { BeginProcessing(); int nRet = theApp.m_pRasterProcess->Grayscale(m_RasterView.GetRaster(), 8); OnChanged(); EndProcessing(nRet); } void CDemoView::OnColorGrayscale12() { BeginProcessing(); int nRet = theApp.m_pRasterProcess->Grayscale(m_RasterView.GetRaster(), 12); OnChanged(); EndProcessing(nRet); } void CDemoView::OnColorGrayscale16() { BeginProcessing(); int nRet = theApp.m_pRasterProcess->Grayscale(m_RasterView.GetRaster(), 16); OnChanged(); EndProcessing(nRet); } void CDemoView::OnColorColorresolution() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().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 ); 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; iPutUserPalette(i,theApp.m_pRasterClrDlg->GetUserPalette(i)); } nRet = theApp.m_pRasterProcess->ColorRes(m_RasterView.GetRaster(), nBPP, (ColorResPaletteConstants)nPalFlags, (ColorResDitherConstants) theApp.m_pRasterClrDlg->GetDitherFlags(), nColors); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnColorWindowlevel() { int nRet; long MaxVal; long MinVal; m_RasterView.GetRaster().GetMinMaxBits(); theApp.m_pRasterClrDlg->PutLowBit(m_RasterView.GetRaster().GetMinBit()); theApp.m_pRasterClrDlg->PutHighBit(m_RasterView.GetRaster().GetMaxBit()); m_RasterView.GetRaster().GetMinMaxVal(); MinVal = m_RasterView.GetRaster().GetMinVal(); MaxVal = m_RasterView.GetRaster().GetMaxVal(); theApp.m_pRasterClrDlg->PutWindowLevelLow(MinVal); theApp.m_pRasterClrDlg->PutWindowLevelHigh(MaxVal); switch ( m_RasterView.GetRaster().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(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->PutWindowLevelFlags(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(); /// m_RasterView.ForceRepaint(); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnUpdateColorWindowlevel(CCmdUI* pCmdUI) { BOOL bVal; bVal = FALSE; if((m_RasterView.GetRaster().GetBitmapBits() == 12) || (m_RasterView.GetRaster().GetBitmapBits() == 16)) bVal = TRUE; if(m_RasterView.GetRaster().GetIsGrayscale() == GRAY_NO) bVal = FALSE; pCmdUI->Enable(bVal && !theApp.m_bStartEffect && !theApp.m_bStartEffect); } void CDemoView::OnColorBrightness() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().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 = theApp.m_pRasterProcess->Intensity(m_RasterView.GetRaster(),theApp.m_pRasterClrDlg->GetChange()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnColorContourfilter() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutThreshold(15); theApp.m_pRasterImgEfxDlg->PutDeltaDirection(35); theApp.m_pRasterImgEfxDlg->PutMaxError(5); theApp.m_pRasterImgEfxDlg->PutContourOption(CONTOUR_THIN); theApp.m_pRasterImgEfxDlg->PutUIFlags ( CONTOURFILTER_SHOW_PREVIEW | 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) { BeginProcessing(); nRet = theApp.m_pRasterProcess->ContourFilter( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->GetThreshold(), theApp.m_pRasterImgEfxDlg->GetDeltaDirection(), theApp.m_pRasterImgEfxDlg->GetMaxError(), theApp.m_pRasterImgEfxDlg->GetContourOption() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnColorContrast() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->PutChange(0); theApp.m_pRasterClrDlg->PutUIFlags(CONTRAST_SHOW_PREVIEW|CONTRAST_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowContrastDlg((long)this->m_hWnd); /* the method */ if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Contrast(m_RasterView.GetRaster(),theApp.m_pRasterClrDlg->GetChange()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnGamma() { int nRet; int nGamma; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->PutGammaRedValue(150); theApp.m_pRasterClrDlg->PutGammaGreenValue(150); theApp.m_pRasterClrDlg->PutGammaBlueValue(150); theApp.m_pRasterClrDlg->PutUIFlags(GAMMAADJUSTMENT_SHOW_PREVIEW | GAMMAADJUSTMENT_SHOW_TOOL_ZOOMLEVEL | GAMMAADJUSTMENT_FORCELINKCHANNELS ); nRet = theApp.m_pRasterClrDlg->ShowGammaAdjustmentDlg((long)this->m_hWnd); /* the method */ if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nGamma = (int)((theApp.m_pRasterClrDlg->GetGammaRedValue() + theApp.m_pRasterClrDlg->GetGammaGreenValue() + theApp.m_pRasterClrDlg->GetGammaBlueValue()) / 3); nRet = theApp.m_pRasterProcess->GammaCorrect(m_RasterView.GetRaster(),nGamma); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnColorHistocontrast() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags(HISTOCONTRAST_SHOW_PREVIEW | HISTOCONTRAST_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowHistoContrastDlg((long)this->m_hWnd); /* the method */ if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->HistoContrast(m_RasterView.GetRaster(),theApp.m_pRasterClrDlg->GetChange()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnColorHistogramequalize() { BeginProcessing(); int nRet = theApp.m_pRasterProcess->HistoEqualize(m_RasterView.GetRaster(), YUV_SPACE); OnChanged(); EndProcessing(nRet); } void CDemoView::OnColorHue() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->PutAngle(0); 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 = theApp.m_pRasterProcess->Hue(m_RasterView.GetRaster(),(short)theApp.m_pRasterClrDlg->GetAngle()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnColorIntensitydetect() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->Low = 128; theApp.m_pRasterClrDlg->High = 255; theApp.m_pRasterClrDlg->InColor = RGB(0,0,0); theApp.m_pRasterClrDlg->OutColor = RGB(255,255,255); theApp.m_pRasterClrDlg->PutUIFlags(INTENSITYDETECT_SHOW_PREVIEW | INTENSITYDETECT_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowIntensityDetectDlg((long)this->m_hWnd); /* the method */ if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->IntensityDetect(m_RasterView.GetRaster(), theApp.m_pRasterClrDlg->GetLow(), theApp.m_pRasterClrDlg->GetHigh(), theApp.m_pRasterClrDlg->GetInColor(), theApp.m_pRasterClrDlg->GetOutColor(), CHANNEL_MASTER); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnColorInvert() { BeginProcessing(); int nRet = theApp.m_pRasterProcess->Invert(m_RasterView.GetRaster()); OnChanged(); EndProcessing(nRet); } void CDemoView::OnColorPicturize() { int nRet; int nWidth = (int) m_RasterView.GetRaster().GetBitmapWidth(); int nHeight = (int) m_RasterView.GetRaster().GetBitmapHeight(); theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutBitmapWidth(nWidth); theApp.m_pRasterImgEfxDlg->PutBitmapHeight(nHeight); theApp.m_pRasterImgEfxDlg->PutCellWidth(10); theApp.m_pRasterImgEfxDlg->PutCellHeight(10); theApp.m_pRasterImgEfxDlg->PutPicturizeResizeFlags (PICTURIZE_RESIZE); theApp.m_pRasterImgEfxDlg->PutUIFlags(PICTURIZE_LOADALL); nRet = theApp.m_pRasterImgEfxDlg->ShowPicturizeDlg((long)this->m_hWnd); CString csDir = theApp.m_pRasterImgEfxDlg->GetDirectoryPath().copy(); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Picturize( m_RasterView.GetRaster().m_lpDispatch, (LPCTSTR)csDir, (PicturizeConstants)theApp.m_uPicturizeFlags, (float)theApp.m_pRasterImgEfxDlg->GetCellWidth() , (float)theApp.m_pRasterImgEfxDlg->GetCellHeight()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnColorSaturation() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->PutChange(0); 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 = theApp.m_pRasterProcess->Saturation(m_RasterView.GetRaster(),theApp.m_pRasterClrDlg->GetChange()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnColorStretchintensity() { BeginProcessing(); int nRet = theApp.m_pRasterProcess->StretchIntensity(m_RasterView.GetRaster()); OnChanged(); EndProcessing(nRet); } void CDemoView::OnImageDocumentimagingBorderremove() { int nRet; theApp.m_pRasterImgDocDlg->PutBitmap(m_RasterView.GetRaster().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 CDemoView::OnUpdateImageDocumentimagingBorderremove(CCmdUI* pCmdUI) { if(m_RasterView.GetRaster().GetBitmapBits() != 1) pCmdUI->Enable(FALSE); else pCmdUI->Enable(!m_RasterView.GetRaster().IsSupportLocked(L_SUPPORT_DOCUMENT) && !theApp.m_bStartEffect); } void CDemoView::OnImageDocumentimagingDotremove() { int nRet; 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(m_RasterView.GetRaster().GetBitmap()); nRet = theApp.m_pRasterImgDocDlg->ShowDotRemoveDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgDocDlg->GetDialogStatus() == DLG_OK) { OnChanged(); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnUpdateImageDocumentimagingDotremove(CCmdUI* pCmdUI) { if(m_RasterView.GetRaster().GetBitmapBits() != 1) pCmdUI->Enable(FALSE); else pCmdUI->Enable(!m_RasterView.GetRaster().IsSupportLocked(L_SUPPORT_DOCUMENT)&& !theApp.m_bStartEffect); } void CDemoView::OnImageDocumentimagingHolepunchremove() { int nRet; theApp.m_pRasterImgDocDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgDocDlg->PutUIFlags(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) { BeginProcessing(); int uFlags = theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->GetFlags(); uFlags &= ~HOLEPUNCH_LEAD_REGION; theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->PutFlags(uFlags); uFlags &= ~HOLEPUNCH_SINGLE_REGION; theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->PutFlags(uFlags); nRet = theApp.m_pRasterProcess->HolePunchRemove( m_RasterView.GetRaster().m_lpDispatch, (HolePunchRemoveFlags)theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->GetFlags(), theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->GetMinHoleCount(), theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->GetMaxHoleCount(), theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->GetMinHoleWidth(), theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->GetMinHoleHeight(), theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->GetMaxHoleWidth(), theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->GetMaxHoleHeight(), (HolePunchRemoveConstants)theApp.m_pRasterImgDocDlg->GetHolePunchRemove()->GetLocation()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnUpdateImageDocumentimagingHolepunchremove(CCmdUI* pCmdUI) { if(m_RasterView.GetRaster().GetBitmapBits() != 1) pCmdUI->Enable(FALSE); else pCmdUI->Enable(!m_RasterView.GetRaster().IsSupportLocked(L_SUPPORT_DOCUMENT) && !theApp.m_bStartEffect); } void CDemoView::OnImageDocumentimagingInvertedtext() { int nRet; theApp.m_pRasterImgDocDlg->PutBitmap(m_RasterView.GetRaster().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 CDemoView::OnUpdateImageDocumentimagingInvertedtext(CCmdUI* pCmdUI) { if(m_RasterView.GetRaster().GetBitmapBits() != 1) pCmdUI->Enable(FALSE); else pCmdUI->Enable(!m_RasterView.GetRaster().IsSupportLocked(L_SUPPORT_DOCUMENT) && !theApp.m_bStartEffect); } void CDemoView::OnImageDocumentimagingLineremove() { int nRet; theApp.m_pRasterImgDocDlg->PutBitmap(m_RasterView.GetRaster().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) { int uFlags = theApp.m_pRasterImgDocDlg->GetLineRemove()->GetFlags(); uFlags &= ~LINE_LEAD_REGION; theApp.m_pRasterImgDocDlg->GetLineRemove()->PutFlags(uFlags); uFlags &= ~LINE_SINGLE_REGION; theApp.m_pRasterImgDocDlg->GetLineRemove()->PutFlags(uFlags); theApp.m_pRasterProcess->LineRemove(m_RasterView.GetRaster(),0, theApp.m_pRasterImgDocDlg->GetLineRemove()->MinLineLength, theApp.m_pRasterImgDocDlg->GetLineRemove()->MaxLineWidth, theApp.m_pRasterImgDocDlg->GetLineRemove()->Wall, theApp.m_pRasterImgDocDlg->GetLineRemove()->MaxWallPercent, theApp.m_pRasterImgDocDlg->GetLineRemove()->GapLength, theApp.m_pRasterImgDocDlg->GetLineRemove()->Variance, theApp.m_pRasterImgDocDlg->GetLineRemove()->GetRemoveFlags() ); OnChanged(); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnUpdateImageDocumentimagingLineremove(CCmdUI* pCmdUI) { if(m_RasterView.GetRaster().GetBitmapBits() != 1) pCmdUI->Enable(FALSE); else pCmdUI->Enable(!m_RasterView.GetRaster().IsSupportLocked(L_SUPPORT_DOCUMENT) && !theApp.m_bStartEffect); } void CDemoView::OnImageDocumentimagingSmooth() { int nRet; theApp.m_pRasterImgDocDlg->PutBitmap(m_RasterView.GetRaster().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(); int uFlags = theApp.m_pRasterImgDocDlg->GetSmooth()->GetFlags(); uFlags &= ~SMOOTH_LEAD_REGION; theApp.m_pRasterImgDocDlg->GetSmooth()->PutFlags(uFlags); uFlags &= ~SMOOTH_SINGLE_REGION; theApp.m_pRasterImgDocDlg->GetSmooth()->PutFlags(uFlags); nRet = theApp.m_pRasterProcess->Smooth( m_RasterView.GetRaster(), theApp.m_pRasterImgDocDlg->GetSmooth()->GetLength(), (SmoothFlags)theApp.m_pRasterImgDocDlg->GetSmooth()->GetFlags()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnUpdateImageDocumentimagingSmooth(CCmdUI* pCmdUI) { if(m_RasterView.GetRaster().GetBitmapBits() != 1) pCmdUI->Enable(FALSE); else pCmdUI->Enable(!m_RasterView.GetRaster().IsSupportLocked(L_SUPPORT_DOCUMENT) && !theApp.m_bStartEffect); } void CDemoView::OnDraw(CDC* pDC) { CRect rcClip; CSize winext; CSize viewext; CSize paintext; CDemoDoc* 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_RasterView.GetRaster().GetBitmapWidth(), viewext.cx, winext.cx); paintext.cy = MulDiv((int) m_RasterView.GetRaster().GetBitmapHeight(), viewext.cy, winext.cy); ::SetMapMode(pDC->m_hDC, MM_TEXT); m_RasterView.Render((OLE_HANDLE) pDC->m_hDC, (float) 0, (float) 0, (float) paintext.cx, (float) paintext.cy); pDC->RestoreDC(-1); } } void CDemoView::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; if(m_RasterView.m_hWnd) { if(m_RasterView.GetRaster().GetHasRgn()) { m_RasterView.GetRaster().FreeRgn(); } m_RasterView.SetEnableMethodErrors(FALSE); m_RasterView.StopMagGlass(); } CFormView::OnDestroy(); } void CDemoView::OnKeyUpLeadrasterview1(short KeyCode, short Shift) { //cancel any paint effect if(m_RasterView.GetEnableProgressStatus()) { m_bQuit=TRUE; //m_RasterView.SetEnableProgressStatus(FALSE); } } void CDemoView::OnProgressStatusLeadrasterview1(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. */ } } BOOL CDemoView::OnEraseBkgnd(CDC* pDC) { //return CFormView::OnEraseBkgnd(pDC); return TRUE; } void CDemoView::OnUpdateColorBrightness(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorColorresolution(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorContourfilter(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorContrast(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorFill(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorGrayscale12(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorGrayscale16(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorGrayscale8(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorHalftone(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorHistocontrast(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorHistogramequalize(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorHue(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorIntensitydetect(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorInvert(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorPicturize(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorSaturation(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorSeparation(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorStretchintensity(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateEditCopy(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateFileBrowse(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateFileClose(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateFileColormerge(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateFileIsisacquire(CCmdUI* pCmdUI) { if(theApp.IsISISIsAvailable()) pCmdUI->Enable(!theApp.m_bStartEffect); else pCmdUI->Enable(FALSE); } void CDemoView::OnUpdateEditPaste(CCmdUI* pCmdUI) { BOOL EnablePaste = GetDocument()->m_pRaster->Paste(PASTE_ISREADY); pCmdUI->Enable( EnablePaste && !theApp.m_bStartEffect); } void CDemoView::OnUpdateFileIsisacquiremulti(CCmdUI* pCmdUI) { if(theApp.IsISISIsAvailable()) pCmdUI->Enable(!theApp.m_bStartEffect); else pCmdUI->Enable(FALSE); } void CDemoView::OnUpdateFileIsisselectsource(CCmdUI* pCmdUI) { if(theApp.IsISISIsAvailable()) pCmdUI->Enable(!theApp.m_bStartEffect); else pCmdUI->Enable(FALSE); } void CDemoView::OnUpdateFileTwainacquire(CCmdUI* pCmdUI) { if(theApp.m_pRasterTwain->IsAvailable((long)this->m_hWnd)) pCmdUI->Enable(!theApp.m_bStartEffect); else pCmdUI->Enable(FALSE); } void CDemoView::OnUpdateFileTwainselect(CCmdUI* pCmdUI) { if(theApp.m_pRasterTwain->IsAvailable((long)this->m_hWnd)) pCmdUI->Enable(!theApp.m_bStartEffect); else pCmdUI->Enable(FALSE); } void CDemoView::OnUpdateImageFlip(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateImageResize(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateImageReverse(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateImageRotate180clockwise(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateImageRotate270clockwise(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateImageRotate90clockwise(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateImageRotateAnyangle(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateImageShear(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateViewPainteffects(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateViewSnapwindowtoimage(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } LRESULT CDemoView::OnDoRealize(WPARAM wParam, LPARAM lParam) { if( !IsWindow(m_RasterView.m_hWnd)) return FALSE; if(lParam) { return m_RasterView.SendMessage(WM_PALETTECHANGED, wParam); } else { return m_RasterView.SendMessage(WM_QUERYNEWPALETTE,0); } } void CDemoView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) { CFormView::OnActivateView(bActivate, pActivateView, pDeactiveView); if (bActivate) { ASSERT(pActivateView == this); OnDoRealize((WPARAM)AfxGetApp()->m_pMainWnd->m_hWnd, (LPARAM) FALSE); // same as SendMessage(WM_DOREALIZE); } } void CDemoView::OnAddborder() { int nRet; theApp.m_pRasterFileDlg->PutDialogTitle("Select a Directory To Browse"); nRet = theApp.m_pRasterFileDlg->ShowDirectoryDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { theApp.m_DlgType = DLG_IMAGE; if ( SUCCESS != GenerateBitampList ( theApp.m_pRasterFileDlg->GetDirectory(), FALSE ) ) { return ; } theApp.m_pRasterImgDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgDlg->LeftThickness = (long)m_RasterView.GetRaster().GetBitmapWidth()/20; theApp.m_pRasterImgDlg->TopThickness = (long)m_RasterView.GetRaster().GetBitmapHeight()/20; theApp.m_pRasterImgDlg->RightThickness = (long)m_RasterView.GetRaster().GetBitmapWidth()/20; theApp.m_pRasterImgDlg->BottomThickness = (long)m_RasterView.GetRaster().GetBitmapHeight()/20; theApp.m_pRasterImgDlg->PutLocation (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); BeginProcessing(); nRet = theApp.m_pRasterImgDlg->ShowAddBorderDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgDlg->GetDialogStatus() == DLG_OK) { m_RasterView.ForceRepaint(); } OnChanged(); EndProcessing(nRet); theApp.m_pRasterImgDlg->ItemsCount = 0; } else theApp.DisplayLEADError(nRet); } void CDemoView::OnMotionblur() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->Dimension = 1; theApp.m_pRasterImgEfxDlg->Angle = 0; theApp.m_pRasterImgEfxDlg->EnableUniDirectional = FALSE; 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 = theApp.m_pRasterProcess->MotionBlur( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->GetDimension(), /* the property */ (long)theApp.m_pRasterImgEfxDlg->GetAngle(), theApp.m_pRasterImgEfxDlg->GetEnableUniDirectional()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnRadialblur() { int nRet; theApp.m_pRasterImgEfxDlg->PutDimension(1); theApp.m_pRasterImgEfxDlg->PutStress(1); theApp.m_pRasterImgEfxDlg->PutCenterX((long)m_RasterView.GetRaster().GetBitmapWidth()/2); theApp.m_pRasterImgEfxDlg->PutCenterY((long)m_RasterView.GetRaster().GetBitmapHeight()/2); //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( RADIALBLUR_SHOW_PREVIEW | RADIALBLUR_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowRadialBlurDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->RadialBlur( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->GetDimension(), /* the property */ (short)theApp.m_pRasterImgEfxDlg->GetStress(), (short)theApp.m_pRasterImgEfxDlg->GetCenterX(), (short)theApp.m_pRasterImgEfxDlg->GetCenterY()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnZoomblur() { int nRet; theApp.m_pRasterImgEfxDlg->PutDimension(1); theApp.m_pRasterImgEfxDlg->PutStress(1); theApp.m_pRasterImgEfxDlg->PutCenterX((long)m_RasterView.GetRaster().GetBitmapWidth()/2); theApp.m_pRasterImgEfxDlg->PutCenterY((long)m_RasterView.GetRaster().GetBitmapHeight()/2); //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( ZOOMBLUR_SHOW_PREVIEW | ZOOMBLUR_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowZoomBlurDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->ZoomBlur( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->GetDimension(), /* the property */ (short)theApp.m_pRasterImgEfxDlg->GetStress(), (short)theApp.m_pRasterImgEfxDlg->GetCenterX(), (short)theApp.m_pRasterImgEfxDlg->GetCenterY()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnGaussianblur() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->Radius = 1; theApp.m_pRasterImgEfxDlg->PutUIFlags( GAUSSIANBLUR_SHOW_PREVIEW | GAUSSIANBLUR_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowGaussianBlurDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->GaussianFilter( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->GetRadius() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnAntialias() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->Threshold = 50; theApp.m_pRasterImgEfxDlg->Dimension = 5; theApp.m_pRasterImgEfxDlg->PutAntiAliasFilter(ANTIALIAS_DIAG); theApp.m_pRasterImgEfxDlg->PutUIFlags( ANTIALIAS_SHOW_PREVIEW | ANTIALIAS_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowAntiAliasDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->AntiAlias( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->GetThreshold(), (short)theApp.m_pRasterImgEfxDlg->GetDimension(), (AntiAliasConstants)theApp.m_pRasterImgEfxDlg->GetAntiAliasFilter()); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnAverage() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutDimension(3); 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 = theApp.m_pRasterProcess->Average( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->GetDimension() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnMedian() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->Dimension = 3; 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 = theApp.m_pRasterProcess->Median( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->GetDimension() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnAddnoise() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->Range = 100; theApp.m_pRasterImgEfxDlg->PutChannel(CHANNEL_MASTER); 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 = theApp.m_pRasterProcess->AddNoise( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->GetRange(), (ChannelConstants)theApp.m_pRasterImgEfxDlg->GetChannel() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnMaxfilter() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->Dimension = 3; theApp.m_pRasterImgEfxDlg->PutUIFlags( MAXFILTER_SHOW_PREVIEW | MAXFILTER_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowMaxFilterDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->MaxFilter( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->GetDimension() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnMinfilter() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->Dimension = 3; theApp.m_pRasterImgEfxDlg->PutUIFlags( MINFILTER_SHOW_PREVIEW | MINFILTER_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowMinFilterDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->MinFilter( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->GetDimension() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnUnsharpmask() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->Amount = 0; theApp.m_pRasterImgEfxDlg->Radius = 1; theApp.m_pRasterImgEfxDlg->Threshold = 0; theApp.m_pRasterImgEfxDlg->PutImageEffectFlags(RGB_SPACE); theApp.m_pRasterImgEfxDlg->PutUIFlags( UNSHARPMASKFILTER_SHOW_PREVIEW| UNSHARPMASKFILTER_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowUnsharpMaskDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->UnsharpMask( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->GetAmount(), (short)theApp.m_pRasterImgEfxDlg->GetRadius(), (short)theApp.m_pRasterImgEfxDlg->GetThreshold(), (ColorSpaceConstants)theApp.m_pRasterImgEfxDlg->GetImageEffectFlags() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnSharpen() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->Sharpness = 0; 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 = theApp.m_pRasterProcess->Sharpen( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->Sharpness ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnMultiply() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->Factor = 100; theApp.m_pRasterImgEfxDlg->PutUIFlags( MULTIPLY_SHOW_PREVIEW| MULTIPLY_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowMultiplyDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Multiply( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->Factor ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnAddbitmaps() { int nRet; ILEADRaster * pResultRaster; theApp.m_pRasterFileDlg->PutDialogTitle("Select a Directory To Browse"); nRet = theApp.m_pRasterFileDlg->ShowDirectoryDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { theApp.m_DlgType = DLG_EFFECT; if ( SUCCESS != GenerateBitampList ( theApp.m_pRasterFileDlg->GetDirectory(), FALSE ) ) { return ; } theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutImageEffectFlags(BC_AVG); theApp.m_pRasterImgEfxDlg->PutUIFlags( ADDBITMAPS_SHOW_PREVIEW| ADDBITMAPS_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowAddBitmapsDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); CoCreateInstance(CLSID_LEADRaster, NULL, CLSCTX_ALL, IID_ILEADRaster, (void**)&pResultRaster); pResultRaster->PutRefBitmapList(FALSE); pResultRaster->PutBitmapList(theApp.m_pRasterImgEfxDlg->GetSelectedBitmapList()); nRet = theApp.m_pRasterProcess->AddBitmaps(pResultRaster, (AddBitmapsConstants)theApp.m_pRasterImgEfxDlg->GetImageEffectFlags() ); if(nRet == 0) { m_RasterView.GetRaster().SetBitmap(pResultRaster->GetBitmap()); OnChanged(); } pResultRaster->Release (); EndProcessing(nRet); } theApp.m_pRasterImgEfxDlg->ItemsCount = 0; } else theApp.DisplayLEADError(nRet); } void CDemoView::OnStitch() { int nRet; theApp.m_DlgType = DLG_EFFECT; theApp.m_pRasterFileDlg->PutDialogTitle("Select a Directory To Browse"); nRet = theApp.m_pRasterFileDlg->ShowDirectoryDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { if ( SUCCESS != GenerateBitampList ( theApp.m_pRasterFileDlg->GetDirectory(), FALSE ) ) { return ; } theApp.m_pRasterImgEfxDlg->StitchBackGroundColor = RGB(255, 255, 255); theApp.m_pRasterImgEfxDlg->StitchBitmapWidth = 320; theApp.m_pRasterImgEfxDlg->StitchBitmapHeight = 200; nRet = theApp.m_pRasterImgEfxDlg->ShowStitchDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_EXPORTANDEXIT) { m_RasterView.GetRaster().SetBitmap(theApp.m_pRasterImgEfxDlg->GetStitchBitmap()); } theApp.m_pRasterImgEfxDlg->ItemsCount = 0; } else theApp.DisplayLEADError(nRet); } void CDemoView::OnFreehandwave() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->ScaleValue = 100; theApp.m_pRasterImgEfxDlg->WaveLength = 100; theApp.m_pRasterImgEfxDlg->Angle = 0; theApp.m_pRasterImgEfxDlg->FillColor = RGB(0,0,0); theApp.m_pRasterImgEfxDlg->PutImageEffectFlags(DIS_PER | FILL_RPT); theApp.m_pRasterImgEfxDlg->PutUIFlags( FREEHANDWAVE_SHOW_PREVIEW| FREEHANDWAVE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowFreeHandWaveDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); theApp.m_pRasterProcess->AmplitudesCount = theApp.m_pRasterImgEfxDlg->AmplitudesCount; for(int i=0; i < theApp.m_pRasterProcess->AmplitudesCount; i++) { theApp.m_pRasterProcess->PutAmplitudes(i,theApp.m_pRasterImgEfxDlg->GetAmplitudes(i)); } nRet = theApp.m_pRasterProcess->FreeHandWave( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->ScaleValue, (short)theApp.m_pRasterImgEfxDlg->WaveLength, (short)theApp.m_pRasterImgEfxDlg->Angle/10, (OLE_COLOR)theApp.m_pRasterImgEfxDlg->FillColor, (long)theApp.m_pRasterImgEfxDlg->GetImageEffectFlags() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnWind() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->Dimension = 1; theApp.m_pRasterImgEfxDlg->Angle = 0; theApp.m_pRasterImgEfxDlg->Opacity = 0; theApp.m_pRasterImgEfxDlg->PutUIFlags( WIND_SHOW_PREVIEW| WIND_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowWindDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Wind( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->Dimension, (long)theApp.m_pRasterImgEfxDlg->Angle, (short)theApp.m_pRasterImgEfxDlg->Opacity ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnPolar() { int nRet; theApp.m_pRasterImgEfxDlg->FillColor = RGB(0,0,0); theApp.m_pRasterImgEfxDlg->PutImageEffectFlags(FILL_CLR | CART_TO_POL); //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( POLAR_SHOW_PREVIEW| POLAR_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowPolarDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Polar( m_RasterView.GetRaster(), (OLE_COLOR)theApp.m_pRasterImgEfxDlg->FillColor, (long)theApp.m_pRasterImgEfxDlg->GetImageEffectFlags() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnZoomwave() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->Amplitude = 1; theApp.m_pRasterImgEfxDlg->Frequency = 1; theApp.m_pRasterImgEfxDlg->Phase = 0; theApp.m_pRasterImgEfxDlg->ZoomFactor = 0; theApp.m_pRasterImgEfxDlg->CenterX = (long) m_RasterView.GetRaster().GetBitmapWidth() /2 ; theApp.m_pRasterImgEfxDlg->CenterY =(long) m_RasterView.GetRaster().GetBitmapHeight() /2 ; theApp.m_pRasterImgEfxDlg->FillColor = RGB(0,0,0); theApp.m_pRasterImgEfxDlg->PutImageEffectFlags(FILL_CLR); theApp.m_pRasterImgEfxDlg->PutUIFlags( ZOOMWAVE_SHOW_PREVIEW| ZOOMWAVE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowZoomWaveDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->ZoomWave( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->Amplitude, (short)theApp.m_pRasterImgEfxDlg->Frequency, (long)theApp.m_pRasterImgEfxDlg->Phase, (short)theApp.m_pRasterImgEfxDlg->ZoomFactor, (short)theApp.m_pRasterImgEfxDlg->CenterX, (short)theApp.m_pRasterImgEfxDlg->CenterY, (OLE_COLOR)theApp.m_pRasterImgEfxDlg->FillColor, (long)theApp.m_pRasterImgEfxDlg->GetImageEffectFlags() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnRadialwave() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->Amplitude = 1; theApp.m_pRasterImgEfxDlg->WaveLength = 100; theApp.m_pRasterImgEfxDlg->Phase = 0; theApp.m_pRasterImgEfxDlg->CenterX = (long)m_RasterView.GetRaster().GetBitmapWidth()/2; theApp.m_pRasterImgEfxDlg->CenterY = (long) m_RasterView.GetRaster().GetBitmapHeight()/2; theApp.m_pRasterImgEfxDlg->FillColor = RGB(0,0,0); theApp.m_pRasterImgEfxDlg->PutImageEffectFlags(FILL_RPT | DIS_PER); theApp.m_pRasterImgEfxDlg->PutUIFlags( RADIALWAVE_SHOW_PREVIEW| RADIALWAVE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowRadialWaveDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->RadWave( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->Amplitude, (short)theApp.m_pRasterImgEfxDlg->WaveLength, (long)theApp.m_pRasterImgEfxDlg->Phase, (short)theApp.m_pRasterImgEfxDlg->CenterX, (short)theApp.m_pRasterImgEfxDlg->CenterY, (OLE_COLOR)theApp.m_pRasterImgEfxDlg->FillColor, (long)theApp.m_pRasterImgEfxDlg->GetImageEffectFlags() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnSwirl() { int nRet; theApp.m_pRasterImgEfxDlg->Angle = 0; theApp.m_pRasterImgEfxDlg->CenterX = (long)m_RasterView.GetRaster().GetBitmapWidth()/2; theApp.m_pRasterImgEfxDlg->CenterY = (long)m_RasterView.GetRaster().GetBitmapHeight()/2; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( SWIRL_SHOW_PREVIEW| SWIRL_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowSwirlDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Swirl( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->Angle, (short)theApp.m_pRasterImgEfxDlg->CenterX, (short)theApp.m_pRasterImgEfxDlg->CenterY ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnWave() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->Amplitude = 1; theApp.m_pRasterImgEfxDlg->WaveLength = 100; theApp.m_pRasterImgEfxDlg->Angle = 0; theApp.m_pRasterImgEfxDlg->HorizontalScale = 100; theApp.m_pRasterImgEfxDlg->VerticalScale = 100; theApp.m_pRasterImgEfxDlg->FillColor = RGB(0,0,0); theApp.m_pRasterImgEfxDlg->PutImageEffectFlags(FILL_CLR | DIS_PER | WV_SIN); theApp.m_pRasterImgEfxDlg->PutUIFlags( WAVE_SHOW_PREVIEW| WAVE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowWaveDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Wave( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->Amplitude, (short)theApp.m_pRasterImgEfxDlg->WaveLength, (short)theApp.m_pRasterImgEfxDlg->Angle, (short)theApp.m_pRasterImgEfxDlg->HorizontalScale, (short)theApp.m_pRasterImgEfxDlg->VerticalScale, (OLE_COLOR)theApp.m_pRasterImgEfxDlg->FillColor, (long)theApp.m_pRasterImgEfxDlg->GetImageEffectFlags() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnWaveshear() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->ScaleValue = 50; theApp.m_pRasterImgEfxDlg->FillColor = RGB(0,0,0); theApp.m_pRasterImgEfxDlg->PutImageEffectFlags(FILL_CLR | SHR_VERT); theApp.m_pRasterImgEfxDlg->PutUIFlags( WAVESHEAR_SHOW_PREVIEW| WAVESHEAR_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowWaveShearDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); theApp.m_pRasterProcess->AmplitudesCount = theApp.m_pRasterImgEfxDlg->AmplitudesCount; for(int i=0; i < theApp.m_pRasterProcess->AmplitudesCount; i++) { theApp.m_pRasterProcess->PutAmplitudes(i,theApp.m_pRasterImgEfxDlg->GetAmplitudes(i)); } nRet = theApp.m_pRasterProcess->FreeHandShear( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->ScaleValue, (OLE_COLOR)theApp.m_pRasterImgEfxDlg->FillColor, (long)theApp.m_pRasterImgEfxDlg->GetImageEffectFlags() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnEmboss() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutDirection(EMBOSS_N); theApp.m_pRasterImgEfxDlg->Depth = 0; 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 = theApp.m_pRasterProcess->Emboss( m_RasterView.GetRaster(), theApp.m_pRasterImgEfxDlg->GetDirection(), (short)theApp.m_pRasterImgEfxDlg->Depth ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnPunch() { int nRet; theApp.m_pRasterImgEfxDlg->Value = 0; theApp.m_pRasterImgEfxDlg->Stress = 1; theApp.m_pRasterImgEfxDlg->CenterX =(long) m_RasterView.GetRaster().GetBitmapWidth()/2; theApp.m_pRasterImgEfxDlg->CenterY =(long) m_RasterView.GetRaster().GetBitmapHeight()/2; theApp.m_pRasterImgEfxDlg->FillColor = RGB(0,0,0); theApp.m_pRasterImgEfxDlg->PutImageEffectFlags(FILL_CLR | FILL_WOUTROT); //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( PUNCH_SHOW_PREVIEW| PUNCH_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowPunchDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Punch( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->Value, (short)theApp.m_pRasterImgEfxDlg->Stress, (short)theApp.m_pRasterImgEfxDlg->CenterX, (short)theApp.m_pRasterImgEfxDlg->CenterY, (OLE_COLOR)theApp.m_pRasterImgEfxDlg->FillColor, (long)theApp.m_pRasterImgEfxDlg->GetImageEffectFlags() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnRipple() { int nRet; theApp.m_pRasterImgEfxDlg->Amplitude = 0; theApp.m_pRasterImgEfxDlg->Frequency = 1; theApp.m_pRasterImgEfxDlg->Phase = 0; theApp.m_pRasterImgEfxDlg->Attenuation = 0; theApp.m_pRasterImgEfxDlg->CenterX =(long) m_RasterView.GetRaster().GetBitmapWidth()/2; theApp.m_pRasterImgEfxDlg->CenterY = (long) m_RasterView.GetRaster().GetBitmapHeight()/2; theApp.m_pRasterImgEfxDlg->FillColor = RGB(0,0,0); theApp.m_pRasterImgEfxDlg->PutImageEffectFlags(FILL_CLR); //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( RIPPLE_SHOW_PREVIEW| RIPPLE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowRippleDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Ripple( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->Amplitude, (short)theApp.m_pRasterImgEfxDlg->Frequency, (long)theApp.m_pRasterImgEfxDlg->Phase, (short)theApp.m_pRasterImgEfxDlg->Attenuation, (short)theApp.m_pRasterImgEfxDlg->CenterX, (short)theApp.m_pRasterImgEfxDlg->CenterY, (OLE_COLOR)theApp.m_pRasterImgEfxDlg->FillColor, (long)theApp.m_pRasterImgEfxDlg->GetImageEffectFlags() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnBending() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->Value = 0; theApp.m_pRasterImgEfxDlg->CenterX =(long) m_RasterView.GetRaster().GetBitmapWidth()/2; theApp.m_pRasterImgEfxDlg->CenterY =(long) m_RasterView.GetRaster().GetBitmapHeight()/2; theApp.m_pRasterImgEfxDlg->FillColor = RGB(0,0,0); theApp.m_pRasterImgEfxDlg->PutImageEffectFlags(BND_NORM | FILL_CLR | FILL_WOUTROT); theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( BENDING_SHOW_PREVIEW| BENDING_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowBendingDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Bending( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->Value, (short)theApp.m_pRasterImgEfxDlg->CenterX, (short)theApp.m_pRasterImgEfxDlg->CenterY, (OLE_COLOR)theApp.m_pRasterImgEfxDlg->FillColor, (long)theApp.m_pRasterImgEfxDlg->GetImageEffectFlags() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnCylindrical() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->Value = 0; theApp.m_pRasterImgEfxDlg->PutImageEffectFlags(CYL_HORZ); theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( CYLINDRICAL_SHOW_PREVIEW| CYLINDRICAL_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowCylindricalDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Cylindrical( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->Value, (CylindricalBitmapConstants)theApp.m_pRasterImgEfxDlg->GetImageEffectFlags() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnSpherize() { int nRet; theApp.m_pRasterImgEfxDlg->Value = 0; theApp.m_pRasterImgEfxDlg->CenterX = (long) m_RasterView.GetRaster().GetBitmapWidth()/2; theApp.m_pRasterImgEfxDlg->CenterY = (long) m_RasterView.GetRaster().GetBitmapHeight()/2; theApp.m_pRasterImgEfxDlg->FillColor = RGB(0,0,0); theApp.m_pRasterImgEfxDlg->PutImageEffectFlags(FILL_CLR | FILL_WOUTROT); //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( SPHERIZE_SHOW_PREVIEW| SPHERIZE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowSpherizeDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Spherize( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->Value, (short)theApp.m_pRasterImgEfxDlg->CenterX, (short)theApp.m_pRasterImgEfxDlg->CenterY, (OLE_COLOR)theApp.m_pRasterImgEfxDlg->FillColor, (long)theApp.m_pRasterImgEfxDlg->GetImageEffectFlags() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnImpression() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->HorizontalDimension = 1; theApp.m_pRasterImgEfxDlg->VerticalDimension = 1; theApp.m_pRasterImgEfxDlg->PutUIFlags( IMPRESSIONIST_SHOW_PREVIEW| IMPRESSIONIST_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowImpressionistDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Impressionist( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->HorizontalDimension, (short)theApp.m_pRasterImgEfxDlg->VerticalDimension ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnOilify() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->Dimension = 3; theApp.m_pRasterImgEfxDlg->PutUIFlags( OILIFY_SHOW_PREVIEW| OILIFY_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowOilifyDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Oilify( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->Dimension ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnUnderlay() { int nRet; ILEADRaster * pRasterSrc = NULL; theApp.m_pRasterFileDlg->PutDialogTitle("Select a Directory To Browse"); nRet = theApp.m_pRasterFileDlg->ShowDirectoryDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { theApp.m_DlgType = DLG_EFFECT; if ( SUCCESS != GenerateBitampList ( theApp.m_pRasterFileDlg->GetDirectory(), FALSE ) ) { return ; } theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( UNDERLAY_SHOW_PREVIEW| UNDERLAY_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowUnderlayDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { CoCreateInstance(CLSID_LEADRaster, NULL, CLSCTX_ALL, IID_ILEADRaster, (void**)&pRasterSrc); pRasterSrc->PutBitmap(theApp.m_pRasterImgEfxDlg->GetSelectedBitmap()); nRet = theApp.m_pRasterProcess->Underlay( m_RasterView.GetRaster(), pRasterSrc, (UnderlayConstants)theApp.m_pRasterImgEfxDlg->GetImageEffectFlags() ); OnChanged(); pRasterSrc->Release (); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); theApp.m_pRasterImgEfxDlg->ItemsCount = 0; } else theApp.DisplayLEADError(nRet); } void CDemoView::OnPixelate() { int nRet; theApp.m_pRasterImgEfxDlg->CellWidth = 1; theApp.m_pRasterImgEfxDlg->CellHeight = 1; theApp.m_pRasterImgEfxDlg->Opacity = 100; theApp.m_pRasterImgEfxDlg->CenterX =(long) m_RasterView.GetRaster().GetBitmapWidth()/2; theApp.m_pRasterImgEfxDlg->CenterY =(long) m_RasterView.GetRaster().GetBitmapHeight()/2; theApp.m_pRasterImgEfxDlg->PutImageEffectFlags(PIX_AVR | PIX_RECT | PIX_WPER | PIX_HPER); //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( PIXELATE_SHOW_PREVIEW| PIXELATE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowPixelateDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Pixelate( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->CellWidth, (short)theApp.m_pRasterImgEfxDlg->CellHeight, (short)theApp.m_pRasterImgEfxDlg->Opacity, (short)theApp.m_pRasterImgEfxDlg->CenterX, (short)theApp.m_pRasterImgEfxDlg->CenterY, (long)theApp.m_pRasterImgEfxDlg->GetImageEffectFlags() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnMosaic() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->Dimension = 3; 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 = theApp.m_pRasterProcess->Mosaic( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->Dimension ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnEdgedetect() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->Threshold = 0; theApp.m_pRasterImgEfxDlg->PutEdgeDetectionFilterType(EDG_SOBEL_VERT); theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutUIFlags( EDGEDETECTOR_SHOW_PREVIEW| EDGEDETECTOR_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgEfxDlg->ShowEdgeDetectorDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgEfxDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->EdgeDetector( m_RasterView.GetRaster(), (short)theApp.m_pRasterImgEfxDlg->Threshold, theApp.m_pRasterImgEfxDlg->GetEdgeDetectionFilterType() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnErosion() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutBinaryFilterType(BFLT_EROSION_OMNI); 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 = theApp.m_pRasterProcess->BinaryFilter( m_RasterView.GetRaster(), (BinaryFilterConstants)theApp.m_pRasterImgEfxDlg->GetBinaryFilterType() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnDilation() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutBinaryFilterType(BFLT_DILATION_OMNI); 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 = theApp.m_pRasterProcess->BinaryFilter( m_RasterView.GetRaster(), (BinaryFilterConstants)theApp.m_pRasterImgEfxDlg->GetBinaryFilterType() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnGradient() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutSpatialFilterType(FLT_GRADIENT_N); 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 = theApp.m_pRasterProcess->SpatialFilter( m_RasterView.GetRaster(), (SpatialFilterConstants)theApp.m_pRasterImgEfxDlg->GetSpatialFilterType() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnLaplace() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutSpatialFilterType(FLT_LAPLACE_1); 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 = theApp.m_pRasterProcess->SpatialFilter( m_RasterView.GetRaster(), (SpatialFilterConstants)theApp.m_pRasterImgEfxDlg->GetSpatialFilterType() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnSobel() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutSpatialFilterType(FLT_SOBEL_HORZ); 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 = theApp.m_pRasterProcess->SpatialFilter( m_RasterView.GetRaster(), (SpatialFilterConstants)theApp.m_pRasterImgEfxDlg->GetSpatialFilterType() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnPrewitt() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutSpatialFilterType(FLT_PREWITT_HORZ); 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 = theApp.m_pRasterProcess->SpatialFilter( m_RasterView.GetRaster(), (SpatialFilterConstants)theApp.m_pRasterImgEfxDlg->GetSpatialFilterType() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnShiftdiff() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutSpatialFilterType(FLT_SHIFTDIFF_DIAG); 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 = theApp.m_pRasterProcess->SpatialFilter( m_RasterView.GetRaster(), (SpatialFilterConstants)theApp.m_pRasterImgEfxDlg->GetSpatialFilterType() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnLineseg() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgEfxDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgEfxDlg->PutSpatialFilterType(FLT_LINESEG_HORZ); 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 = theApp.m_pRasterProcess->SpatialFilter( m_RasterView.GetRaster(), (SpatialFilterConstants)theApp.m_pRasterImgEfxDlg->GetSpatialFilterType() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnCanvassize() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); 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); theApp.m_pRasterImgDlg->CurrentHeight = (long) ((ILEADRaster *)m_RasterView.GetRaster().m_lpDispatch)->GetBitmapHeight(); theApp.m_pRasterImgDlg->CurrentWidth = (long) ((ILEADRaster *)m_RasterView.GetRaster().m_lpDispatch)->GetBitmapWidth(); theApp.m_pRasterImgDlg->NewHeight = (short) ((ILEADRaster *)m_RasterView.GetRaster().m_lpDispatch)->GetBitmapHeight(); theApp.m_pRasterImgDlg->NewWidth = (short) ((ILEADRaster *)m_RasterView.GetRaster().m_lpDispatch)->GetBitmapWidth(); nRet = theApp.m_pRasterImgDlg->ShowCanvasResizeDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgDlg->GetDialogStatus() == DLG_OK) { m_RasterView.ForceRepaint(); m_RasterView.Invalidate(true); OnChanged(); } } void CDemoView::OnHistogram() { int nRet; int HighBits; int LowBits; BOOL oldValue; oldValue = m_RasterView.GetRaster().GetEnableMethodErrors(); m_RasterView.GetRaster().SetEnableMethodErrors(FALSE); nRet = m_RasterView.GetRaster().GetMinMaxBits(); HighBits = m_RasterView.GetRaster().GetMaxBit(); LowBits = m_RasterView.GetRaster().GetMinBit(); m_RasterView.GetRaster().SetMinMaxBits(LowBits, HighBits); m_RasterView.GetRaster().SetEnableMethodErrors(oldValue); theApp.m_pRasterImgDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgDlg->PutUIFlags( HISTOGRAM_SHOW_VIEWSTYLE| HISTOGRAM_USERPENCOLORS ); theApp.m_pRasterImgDlg->BlueChannelPenColor = RGB(0, 0, 255); theApp.m_pRasterImgDlg->RedChannelPenColor = RGB(255, 0, 0); theApp.m_pRasterImgDlg->GreenChannelPenColor = RGB(0,255,0); nRet = theApp.m_pRasterImgDlg->ShowHistogramDlg((long)this->m_hWnd); if(nRet != 0) theApp.DisplayLEADError(nRet); } void CDemoView::OnBalancecolors() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->RedToRed = 1; theApp.m_pRasterClrDlg->RedToGreen = 0; theApp.m_pRasterClrDlg->RedToBlue = 0; theApp.m_pRasterClrDlg->GreenToRed = 0; theApp.m_pRasterClrDlg->GreenToGreen = 1; theApp.m_pRasterClrDlg->GreenToBlue = 0; theApp.m_pRasterClrDlg->BlueToRed = 0; theApp.m_pRasterClrDlg->BlueToGreen = 0; theApp.m_pRasterClrDlg->BlueToBlue = 1; theApp.m_pRasterClrDlg->PutUIFlags( BALANCECOLORS_SHOW_PREVIEW| BALANCECOLORS_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowBalanceColorsDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->BalanceColors( m_RasterView.GetRaster(), (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 CDemoView::OnSaturation() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( SATURATION_SHOW_PREVIEW| SATURATION_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowSaturationDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Saturation( m_RasterView.GetRaster(), (short)theApp.m_pRasterClrDlg->Change ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnHue() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( HUE_SHOW_PREVIEW| HUE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowHueDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Hue( m_RasterView.GetRaster(), (short)theApp.m_pRasterClrDlg->Angle ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnHalftone() { int nRet; theApp.m_pRasterFileDlg->PutDialogTitle("Select a Directory To Browse"); nRet = theApp.m_pRasterFileDlg->ShowDirectoryDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { theApp.m_DlgType = DLG_COLOR; if ( SUCCESS != GenerateBitampList ( theApp.m_pRasterFileDlg->GetDirectory(), FALSE ) ) { return ; } theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->HalftoneType = HT_PRINT; theApp.m_pRasterClrDlg->Angle = 0; theApp.m_pRasterClrDlg->Dimension = 2; theApp.m_pRasterClrDlg->PutUIFlags( HALFTONE_SHOW_PREVIEW| HALFTONE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowHalftoneDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); if(theApp.m_pRasterClrDlg->SelectedBitmapsCount!=0) { m_RasterView.GetRaster().SetRefBitmapList(FALSE); m_RasterView.GetRaster().SetBitmapList(theApp.m_pRasterClrDlg->GetSelectedBitmapList()); } nRet = theApp.m_pRasterProcess->HalfTone(m_RasterView.GetRaster(), (short)theApp.m_pRasterClrDlg->HalftoneType, (long)theApp.m_pRasterClrDlg->Angle, (short)theApp.m_pRasterClrDlg->Dimension); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); theApp.m_pRasterClrDlg->ItemsCount = 0; } else theApp.DisplayLEADError(nRet); } void CDemoView::OnGrayscale() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( GRAYSCALE_AUTOPROCESS| GRAYSCALE_SHOW_PREVIEW| GRAYSCALE_SHOW_TOOL_ZOOMLEVEL); theApp.m_pRasterClrDlg->RedFactor = 250; theApp.m_pRasterClrDlg->GreenFactor = 625; theApp.m_pRasterClrDlg->BlueFactor = 125; nRet = theApp.m_pRasterClrDlg->ShowGrayScaleDlg((long)this->m_hWnd); if(nRet != SUCCESS) theApp.DisplayLEADError(nRet); else OnChanged(); } void CDemoView::OnColoredgray() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->RedFactor = 250 ; theApp.m_pRasterClrDlg->GreenFactor = 625 ; theApp.m_pRasterClrDlg->BlueFactor = 125 ; theApp.m_pRasterClrDlg->RedGrayFactor = 300 ; theApp.m_pRasterClrDlg->GreenGrayFactor = 200 ; theApp.m_pRasterClrDlg->BlueGrayFactor = 100 ; theApp.m_pRasterClrDlg->PutUIFlags( COLOREDGRAY_SHOW_PREVIEW| COLOREDGRAY_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowColoredGrayDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->ConvertToColoredGray( m_RasterView.GetRaster(), (short)theApp.m_pRasterClrDlg->RedFactor, (short)theApp.m_pRasterClrDlg->GreenFactor, (short)theApp.m_pRasterClrDlg->BlueFactor, (short)theApp.m_pRasterClrDlg->RedGrayFactor, (short)theApp.m_pRasterClrDlg->GreenGrayFactor, (short)theApp.m_pRasterClrDlg->BlueGrayFactor ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnRemapintensity() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->PutChannel(CHANNEL_MASTER); theApp.m_pRasterClrDlg->PutUIFlags( REMAPINTENSITY_SHOW_PREVIEW | REMAPINTENSITY_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowRemapIntensityDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); short nRemapTableSize = (short)theApp.m_pRasterClrDlg->GetRemapTableSize(); theApp.m_pRasterProcess->PutRemapTableSize(nRemapTableSize); for(int i =0 ;iPutRemapTable(i,theApp.m_pRasterClrDlg->GetRemapTable(i)); } nRet = theApp.m_pRasterProcess->RemapIntensity( m_RasterView.GetRaster(), (ChannelConstants)theApp.m_pRasterClrDlg->GetChannel() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnRemaphue() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( REMAPHUE_SHOW_PREVIEW | REMAPHUE_SHOW_TOOL_ZOOMLEVEL ); nRet = theApp.m_pRasterClrDlg->ShowRemapHueDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); long nRemapHueTableSize = theApp.m_pRasterClrDlg->RemapHueTablesSize; theApp.m_pRasterProcess->PutRemapHueTablesSize(nRemapHueTableSize); for(long i =0 ;iPutMaskTable(i,theApp.m_pRasterClrDlg->GetMaskTable(i)); theApp.m_pRasterProcess->PutHTable(i,theApp.m_pRasterClrDlg->GetHueTable(i)); theApp.m_pRasterProcess->PutSTable(i,theApp.m_pRasterClrDlg->GetSaturationTable(i)); theApp.m_pRasterProcess->PutVTable(i,theApp.m_pRasterClrDlg->GetValueTable(i)); } nRet = theApp.m_pRasterProcess->RemapHue(m_RasterView.GetRaster(), true, true, true, true ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnHistoequalize() { if(m_RasterView.GetRaster().GetHasRgn()) { OnImageRegiontransformations(ID_HISTOEQUALIZE); } else { BeginProcessing(); int nRet = theApp.m_pRasterProcess->HistoEqualize(m_RasterView.GetRaster(), (ColorSpaceConstants)YUV_SPACE); OnChanged(); EndProcessing(nRet); } } void CDemoView::OnStretchintensity() { } void CDemoView::OnLocalequalize() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->RectangleWidth =(short) m_RasterView.GetRaster().GetBitmapWidth(); theApp.m_pRasterClrDlg->RectangleHeight =(short) m_RasterView.GetRaster().GetBitmapHeight(); theApp.m_pRasterClrDlg->XExtension = 0; theApp.m_pRasterClrDlg->YExtension = 0; theApp.m_pRasterClrDlg->ColorSpace = RGB_SPACE; theApp.m_pRasterClrDlg->SmoothSize = 0; theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( LOCALHISTOEQUALIZE_SHOW_PREVIEW | LOCALHISTOEQUALIZE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowLocalHistoEqualizeDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->LocalHistoEqualize( m_RasterView.GetRaster(), (short)theApp.m_pRasterClrDlg->RectangleWidth, (short)theApp.m_pRasterClrDlg->RectangleHeight, (short)theApp.m_pRasterClrDlg->XExtension, (short)theApp.m_pRasterClrDlg->YExtension, (short)theApp.m_pRasterClrDlg->ColorSpace, (short)theApp.m_pRasterClrDlg->SmoothSize ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnHistocontrast() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->Change = 0; 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 = theApp.m_pRasterProcess->HistoContrast( m_RasterView.GetRaster(), (short)theApp.m_pRasterClrDlg->Change ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnPaletteeditor() { int nRet; int nColors = 0; int nBits = 0; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); nBits = m_RasterView.GetRaster().GetBitmapBits(); if(nBits <= 8) { nColors = 1<< nBits; theApp.m_pRasterClrDlg->PutUserPaletteCount(nColors); for(int i = 0;i < nColors; ++i) { theApp.m_pRasterClrDlg->PutUserPalette(i,m_RasterView.GetRaster().GetBitmapPalette(i)); } } theApp.m_pRasterClrDlg->PutUIFlags( CUSTOMIZEPALETTE_SHOW_NEW | CUSTOMIZEPALETTE_SHOW_OPEN| CUSTOMIZEPALETTE_SHOW_SORT| CUSTOMIZEPALETTE_SHOW_FINDCLOSEST| CUSTOMIZEPALETTE_SHOW_ADDOPTION| CUSTOMIZEPALETTE_SHOW_REMOVEOPTION| CUSTOMIZEPALETTE_SHOW_COLORMODEL| CUSTOMIZEPALETTE_SHOW_RGBLEFTPAN| CUSTOMIZEPALETTE_SHOW_SAVE| CUSTOMIZEPALETTE_SHOW_SAVEAS| CUSTOMIZEPALETTE_GENERATE_PALETTE ); nRet = theApp.m_pRasterClrDlg->ShowCustomizePaletteDlg((long)this->m_hWnd); if(nRet != 0) { theApp.DisplayLEADError(nRet); } } void CDemoView::OnCountcolors() { unsigned long ulColors; BeginProcessing(); ulColors = theApp.m_pRasterProcess->GetColorCount(m_RasterView.GetRaster()); TCHAR szText[40]; _stprintf(szText,TEXT("Bitmap contains %lu unique colors"), ulColors); MessageBox(szText,TEXT("color count")); OnChanged(); EndProcessing(SUCCESS); } void CDemoView::OnInvert() { BeginProcessing(); int nRet = theApp.m_pRasterProcess->Invert(m_RasterView.GetRaster()); OnChanged(); EndProcessing(nRet); } void CDemoView::OnDetect() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->Low = 128; theApp.m_pRasterClrDlg->High = 255; theApp.m_pRasterClrDlg->InColor = RGB(0,0,0); theApp.m_pRasterClrDlg->OutColor = RGB(255,255,255); theApp.m_pRasterClrDlg->PutIntensityChannel(CHANNEL_MASTER); theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->PutUIFlags( INTENSITYDETECT_SHOW_PREVIEW| INTENSITYDETECT_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowIntensityDetectDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->IntensityDetect( m_RasterView.GetRaster(), (short)theApp.m_pRasterClrDlg->Low, (short)theApp.m_pRasterClrDlg->High, theApp.m_pRasterClrDlg->InColor, theApp.m_pRasterClrDlg->OutColor, (short)theApp.m_pRasterClrDlg->GetIntensityChannel() ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnSolarize() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->Threshold = 0; theApp.m_pRasterClrDlg->PutUIFlags( SOLARIZE_SHOW_PREVIEW| SOLARIZE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterClrDlg->ShowSolarizeDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterClrDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->Solarize( m_RasterView.GetRaster(), (short)theApp.m_pRasterClrDlg->Threshold ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnPosterize() { int nRet; //assign the bitmap for preview theApp.m_pRasterClrDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterClrDlg->Levels = 2; 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 = theApp.m_pRasterProcess->Posterize( m_RasterView.GetRaster(), (short)theApp.m_pRasterClrDlg->Levels ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } int CDemoView::GenerateBitampList ( TCHAR * pszFolder, BOOL fThumbnail ) { theApp.m_nBitmapsCount = -1 ; //Create the RasterThumbnail object theApp.m_pRasterBrowseDlg->PutEnableMethodErrors(FALSE); theApp.m_pRasterBrowseDlg->PutStopOnError(FALSE); theApp.m_pRasterBrowseDlg->PutFilter("*.*"); //search for all files theApp.m_pRasterBrowseDlg->PutThumbnailWidth((fThumbnail)? 150 : 0); theApp.m_pRasterBrowseDlg->PutThumbnailHeight((fThumbnail)? 150 : 0); theApp.m_pRasterBrowseDlg->PutThumbnailBitsPerPixel(24); theApp.m_pRasterBrowseDlg->PutMaintainAspect(fThumbnail); theApp.m_pRasterBrowseDlg->PutForceSize(FALSE); theApp.m_pRasterBrowseDlg->PutPaletteFlags((ThumbnailColorResPaletteConstants) CRP_BYTEORDERBGR); theApp.m_pRasterBrowseDlg->PutThumbnailBackgroundColor(GetSysColor ( COLOR_BTNFACE ) ); theApp.m_pRasterBrowseDlg->PutLoadStamp(FALSE); theApp.m_pRasterBrowseDlg->PutResample(FALSE); theApp.m_pRasterBrowseDlg->PutIncludeSubDirectories(FALSE); theApp.m_pRasterBrowseDlg->PutExpandMultipage(FALSE); if(theApp.m_DlgType == DLG_EFFECT) theApp.m_pRasterImgEfxDlg->ItemsCount = DLG_IMAGE_LIST_COUNT; else if(theApp.m_DlgType == DLG_IMAGE) theApp.m_pRasterImgDlg->ItemsCount = DLG_IMAGE_LIST_COUNT; else if(theApp.m_DlgType == DLG_COLOR) theApp.m_pRasterClrDlg->ItemsCount = DLG_IMAGE_LIST_COUNT; else if(theApp.m_DlgType == DLG_FILE) theApp.m_pRasterFileDlg->ItemsCount = DLG_IMAGE_LIST_COUNT; ((CMainFrame*)theApp.m_pMainWnd)->m_bBrowseQuit = FALSE; int nRet = theApp.m_pRasterBrowseDlg->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 SUCCESS ; } void CDemoView::OnPreview() { int nRet; theApp.m_pRasterFileDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); nRet = theApp.m_pRasterFileDlg->ShowPrintPreviewDlg ((long)this->m_hWnd); if(nRet != 0 ) theApp.DisplayLEADError(nRet); } void CDemoView::OnJPEGWebTuner() { int nRet; theApp.m_pRasterWebDlg->PutBitmap(m_RasterView.GetRaster().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 CDemoView::OnHtmlMapper() { theApp.m_pRasterWebDlg->PutBitmap(m_RasterView.GetRaster().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 CDemoView::OnGIFWebTuner() { int nRet; theApp.m_pRasterWebDlg->PutBitmap(m_RasterView.GetRaster().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 CDemoView::OnPngWebTuner() { int nRet; theApp.m_pRasterWebDlg->PutBitmap(m_RasterView.GetRaster().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 ); nRet = theApp.m_pRasterWebDlg->ShowPNGWebTunerDlg ((long)this->m_hWnd); if(nRet != 0 ) theApp.DisplayLEADError(nRet); } void CDemoView::OnFillblack() { theApp.m_pRasterProcess->Fill(m_RasterView.GetRaster(), RGB(0,0,0)); } void CDemoView::OnFillwhite() { theApp.m_pRasterProcess->Fill(m_RasterView.GetRaster(), RGB(255,255,255)); } void CDemoView::OnFillred() { theApp.m_pRasterProcess->Fill(m_RasterView.GetRaster(), RGB(255,0,0)); } void CDemoView::OnFillgreen() { theApp.m_pRasterProcess->Fill(m_RasterView.GetRaster(), RGB(0,255,0)); } void CDemoView::OnFillblue() { theApp.m_pRasterProcess->Fill(m_RasterView.GetRaster(), RGB(0,0,255)); } void CDemoView::OnFillcyan() { theApp.m_pRasterProcess->Fill(m_RasterView.GetRaster(), RGB(0,255,255)); } void CDemoView::OnFillmagenta() { theApp.m_pRasterProcess->Fill(m_RasterView.GetRaster(), RGB(255,0,255)); } void CDemoView::OnFillyellow() { theApp.m_pRasterProcess->Fill(m_RasterView.GetRaster(), RGB(255,255,0)); } void CDemoView::OnFileFormatAssociations() { theApp.m_pRasterFileDlg->PutServerApplicationName(REGISTRYKEY_SERVER_NAME ); theApp.m_pRasterFileDlg->ShowFilesAssociationDlg((long)this->m_hWnd); } void CDemoView::OnPrintStitchedImages() { int nRet; theApp.m_DlgType = DLG_FILE; theApp.m_pRasterFileDlg->PutDialogTitle("Select a Directory To Browse"); nRet = theApp.m_pRasterFileDlg->ShowDirectoryDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { if ( SUCCESS != GenerateBitampList ( theApp.m_pRasterFileDlg->GetDirectory(), FALSE ) ) { return ; } theApp.m_pRasterFileDlg->Visible = TRUE; nRet = theApp.m_pRasterFileDlg->ShowPrintStitchedImagesDlg((long)this->m_hWnd); } else theApp.DisplayLEADError(nRet); } void CDemoView::OnAddframe() { int nRet; theApp.m_pRasterFileDlg->PutDialogTitle("Select a Directory To Browse"); nRet = theApp.m_pRasterFileDlg->ShowDirectoryDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { theApp.m_DlgType = DLG_IMAGE; if ( SUCCESS != GenerateBitampList ( theApp.m_pRasterFileDlg->GetDirectory(), FALSE ) ) { return ; } theApp.m_pRasterImgDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgDlg->EnableKeepFrameState = FALSE; theApp.m_pRasterImgDlg->EnableUseMask = FALSE; theApp.m_pRasterImgDlg->SmoothEdge = 0; theApp.m_pRasterImgDlg->PutLocation (INSIDE_BITMAP); theApp.m_pRasterImgDlg->PutQuality(FRAME_QUALITY_LOW); theApp.m_pRasterImgDlg->PutUIFlags(ADDFRAME_SHOW_PREVIEW | ADDFRAME_SHOW_TOOL_ZOOMLEVEL | ADDFRAME_AUTOPROCESS); BeginProcessing(); nRet = theApp.m_pRasterImgDlg->ShowAddFrameDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgDlg->GetDialogStatus() == DLG_OK) { m_RasterView.ForceRepaint(); } OnChanged(); EndProcessing(nRet); theApp.m_pRasterImgDlg->ItemsCount = 0; } else theApp.DisplayLEADError(nRet); } void CDemoView::OnUpdateAddborder(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateAddframe(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateCanvassize(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateHistogram(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateMotionblur(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateRadialblur(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateZoomblur(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateGaussianblur(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateAntialias(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateAverage(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateMedian(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateAddnoise(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateMaxfilter(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateMinfilter(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateUnsharpmask(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateSharpen(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateMultiply(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateAddbitmaps(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateStitch(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateFreehandwave(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateWind(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdatePolar(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateZoomwave(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateRadialwave(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateSwirl(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateWave(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateWaveshear(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateEmboss(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdatePunch(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateRipple(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateBending(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateCylindrical(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateSpherize(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateImpression(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateOilify(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateUnderlay(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdatePixelate(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateMosaic(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateEdgedetect(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateErosion(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateDilation(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateGradient(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateLaplace(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateSobel(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdatePrewitt(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateShiftdiff(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateLineseg(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateDetect(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateSolarize(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdatePosterize(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateBrightness(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateContrast(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateHue(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateSaturation(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateGamma(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateBalancecolors(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateHalftone(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateGrayscale(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColoredgray(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateRemapintensity(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateRemaphue(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateHistoequalize(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateStretchintensity(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateLocalequalize(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateHistocontrast(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateFillblack(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateFillwhite(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateFillred(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateFillgreen(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateFillblue(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateFillcyan(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateFillmagenta(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateFillyellow(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorsepRgb(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorsepCmyk(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorsepHsv(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorsepHls(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorsepCmy(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateColorsepAlpha(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateCountcolors(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdatePaletteeditor(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateInvert(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateJpegwebtuner(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdatePngwebtuner(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateGifwebtuner(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateHtmlmapper(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdateFileformatassociations(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdatePrintstitchedimages(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnUpdatePreview(CCmdUI* pCmdUI) { pCmdUI->Enable(!theApp.m_bStartEffect); } void CDemoView::OnRemoveRedEye() { int nRet; //assign the bitmap for preview theApp.m_pRasterImgDocDlg->PutBitmap(m_RasterView.GetRaster().GetBitmap()); theApp.m_pRasterImgDocDlg->NewColor = RGB(128,128,128); theApp.m_pRasterImgDocDlg->Threshold = 0; theApp.m_pRasterImgDocDlg->Lightness = 100; theApp.m_pRasterImgDocDlg->PutUIFlags( AVERAGE_SHOW_PREVIEW | AVERAGE_SHOW_TOOL_ZOOMLEVEL); nRet = theApp.m_pRasterImgDocDlg->ShowRemoveRedEyeDlg((long)this->m_hWnd); if(nRet == 0 && theApp.m_pRasterImgDocDlg->GetDialogStatus() == DLG_OK) { BeginProcessing(); nRet = theApp.m_pRasterProcess->RemoveRedeye( m_RasterView.GetRaster(), theApp.m_pRasterImgDocDlg->NewColor, (short)theApp.m_pRasterImgDocDlg->Threshold, theApp.m_pRasterImgDocDlg->Lightness ); OnChanged(); EndProcessing(nRet); } else theApp.DisplayLEADError(nRet); } void CDemoView::EnableSysMenu(BOOL bEnable) { CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame(); CMenu * menu = pChild->GetSystemMenu(FALSE); CMenu * pFrameMenu = pFrame->GetSystemMenu(FALSE); if(!bEnable) { menu->EnableMenuItem(SC_CLOSE, MF_BYCOMMAND | MF_GRAYED); menu->EnableMenuItem(SC_MINIMIZE,MF_BYCOMMAND | MF_GRAYED); pFrameMenu->EnableMenuItem(SC_CLOSE, MF_BYCOMMAND | MF_GRAYED); pFrameMenu->EnableMenuItem(SC_MINIMIZE,MF_BYCOMMAND | MF_GRAYED); } else { menu->EnableMenuItem(SC_CLOSE, MF_BYCOMMAND | MF_ENABLED); menu->EnableMenuItem(SC_MINIMIZE,MF_BYCOMMAND | MF_ENABLED); pFrameMenu->EnableMenuItem(SC_CLOSE, MF_BYCOMMAND | MF_ENABLED); pFrameMenu->EnableMenuItem(SC_MINIMIZE,MF_BYCOMMAND | MF_ENABLED); } int ulWndStyle = GetWindowLong(pChild->m_hWnd,GWL_STYLE); SetWindowLong(pChild->m_hWnd,GWL_STYLE, bEnable ? (ulWndStyle | (WS_MINIMIZEBOX) ): ulWndStyle & ~(WS_MINIMIZEBOX)); ulWndStyle = GetWindowLong(pFrame->m_hWnd,GWL_STYLE); SetWindowLong(pFrame->m_hWnd,GWL_STYLE, bEnable ? (ulWndStyle | (WS_MINIMIZEBOX) ): ulWndStyle & ~(WS_MINIMIZEBOX)); } void CDemoView::OnImageSlice() { int nRet; CSliceDlg SliceDlg; if(SliceDlg.DoModal() == IDOK) { if(m_RasterView.GetRaster().GetHasRgn()) { m_RasterView.GetRaster().FreeRgn(); } nRet = theApp.m_pRasterProcess->Slice(m_RasterView.GetRaster(), 500, RGB(0,0,0), SLICE_DESKEW | SLICE_DESKEW_LINEAR, TRUE); m_RasterView.SetRgnFrameType(RGNFRAME_ANIMATED); } }