// IMGPFView.cpp : implementation of the CIMGPFView class // #include "stdafx.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern CIMGPFApp theApp; #define WM_USER_CHANGECURSOR WM_USER + 1 #define INCREMENT(x, uLUTLen) ((x+1)% uLUTLen) #define DECREMENT(x, uLUTLen) ((x+ (uLUTLen - 1))% uLUTLen) #define ADD(x,y, uLUTLen) ((x+y)% uLUTLen) ///////////////////////////////////////////////////////////////////////////// // CIMGPFView IMPLEMENT_DYNCREATE(CIMGPFView, CFormView) BEGIN_MESSAGE_MAP(CIMGPFView, CFormView) //{{AFX_MSG_MAP(CIMGPFView) ON_WM_ERASEBKGND() ON_WM_SIZE() ON_COMMAND(IDM_COLOR_GRAY8, OnImageGray8) ON_COMMAND(IDM_COLOR_GRAY12, OnImageGray12) ON_COMMAND(IDM_COLOR_GRAY16, OnImageGray16) ON_COMMAND(IDM_IMAGE_HISTOGRAM, OnImageHistogram) ON_COMMAND(IDM_IMAGE_GETRGNPERIMETER, OnImageGetrgnperimeter) ON_COMMAND(IDM_IMAGE_GETFERETS, OnImageGetferets) ON_COMMAND(IDM_IMAGE_GETOBJECTINFOW, OnImageGetobjectinfow) ON_COMMAND(IDM_IMAGE_GETOBJECTINFONW, OnImageGetobjectinfonw) ON_COMMAND(IDM_IMAGE_REDEYEREMOVE, OnImageRedeyeremove) ON_COMMAND(IDM_VIEW_ADDBORDER, OnViewAddborder) ON_COMMAND(IDM_VIEW_ADDFRAME, OnViewAddframe) ON_COMMAND(IDM_IMAGE_STAR, OnImageStar) ON_COMMAND(IDM_IMAGE_RESIZE, OnImageResize) ON_COMMAND(IDM_IMAGE_ADDMESSAGE, OnImageAddmessage) ON_COMMAND(IDM_IMAGE_EXTRACTMESSAGE, OnImageExtractmessage) ON_COMMAND(IDM_IMAGE_GRAYCOLORATION, OnImageGraycoloration) ON_UPDATE_COMMAND_UI(IDM_IMAGE_GRAYCOLORATION, OnUpdateImageGraycoloration) ON_COMMAND(IDM_IMAGE_DSA, OnImageDsa) ON_COMMAND(IDM_IMAGE_CR, OnImageCr) ON_COMMAND(IDM_IMAGE_BITMAPSELECTOR, OnImageBitmapselector) ON_UPDATE_COMMAND_UI(IDM_IMAGE_BITMAPSELECTOR, OnUpdateImageBitmapselector) ON_COMMAND(IDM_IMAGE_SHIFTBITMAP, OnImageShiftbitmap) ON_UPDATE_COMMAND_UI(IDM_IMAGE_SHIFTBITMAP, OnUpdateImageShiftbitmap) ON_COMMAND(IDM_IMAGE_SUBTRACTBACKGROUND, OnImageSubtractbackground) ON_COMMAND(IDM_IMAGE_AUTOLEVEL, OnImageAutolevel) ON_COMMAND(IDM_IMAGE_AUTOCONTRAST, OnImageAutocontrast) ON_COMMAND(IDM_IMAGE_AUTOLUMINOSITY, OnImageAutoluminosity) ON_COMMAND(IDM_IMAGE_BCI, OnImageBci) ON_COMMAND(IDM_IMAGE_LEVELING, OnImageLeveling) ON_COMMAND(IDM_COLOR_BALANCECOLOR, OnColorBalancecolor) ON_COMMAND(IDM_IMAGE_CHANNELMIXER, OnImageChannelmixer) ON_COMMAND(IDM_IMAGE_BALANCECOLORS, OnImageBalancecolors) ON_COMMAND(IDM_IMAGE_DESAT, OnImageDesat) ON_COMMAND(IDM_IMAGE_FILLBITMAP, OnImageFillbitmap) ON_COMMAND(IDM_IMAGE_HSB, OnImageHsb) ON_COMMAND(IDM_IMAGE_LIGHT_CONTROL, OnImageLightControl) ON_COMMAND(IDM_IMAGE_MATH, OnImageMath) ON_COMMAND(IDM_IMAGE_REPCLR, OnImageRepclr) ON_COMMAND(IDM_IMAGE_SAMPLE_TARGET, OnImageSampleTarget) ON_COMMAND(IDM_IMAGE_SELECTIVECOLOR, OnImageSelectivecolor) ON_COMMAND(IDM_COLOR_SWAPCOLOR, OnColorSwapcolor) ON_COMMAND(IDM_IMAGE_ACE, OnImageAce) ON_COMMAND(IDM_IMAGE_HISTOGRAMEQUALIZE, OnImageHistogramequalize) ON_COMMAND(IDM_IMAGE_LOCALHISTO, OnImageLocalhisto) ON_COMMAND(IDM_IMAGE_REMAPHUE, OnImageRemaphue) ON_COMMAND(IDM_IMAGE_REMAPINTENSITY, OnImageRemapintensity) ON_COMMAND(IDM_IMAGE_AUTOBINARYSEGMENT, OnImageAutobinarysegment) ON_COMMAND(IDM_IMAGE_COLORTHRESHOLD, OnImageColorthreshold) ON_COMMAND(IDM_IMAGE_DYNAMICTHRESHOLD, OnImageDynamicthreshold) ON_COMMAND(IDM_IMAGE_BINARYSEGMENT, OnImageBinarysegment) ON_COMMAND(IDM_IMAGE_CLRRES, OnImageClrres) ON_COMMAND(IDM_COLOR_COLOREDGRAY, OnColorColoredgray) ON_COMMAND(IDM_IMAGE_DUOTONE, OnImageDuotone) ON_COMMAND(IDM_COLOR_CONVERTTOGRAY, OnColorConverttogray) ON_COMMAND(IDM_COLOR_HALFTONE, OnColorHalftone) ON_COMMAND(IDM_IMAGE_SHADOW, OnImageShadow) ON_COMMAND(IDM_IMAGE_MOSAICTILES, OnImageMosaicTiles) ON_COMMAND(IDM_IMAGE_PRSPCTV, OnImagePerspective) ON_COMMAND(IDM_IMAGE_RMNMSC, OnImageRomanMosaic) ON_COMMAND(IDM_IMAGE_ZIGZAG, OnImageZigZag) ON_COMMAND(IDM_IMAGE_CLRDBLS, OnImageColoredBalls) ON_COMMAND(IDM_IMAGE_PONTLST, OnImagePointillist) ON_COMMAND(IDM_IMAGE_SMPLCLRDPNCL, OnImageColoredPencil) ON_COMMAND(IDM_IMAGE_DSPMNT, OnImageDisplacment) ON_COMMAND(IDM_IMAGE_PRLNOS, OnImagePerlinNoise) ON_COMMAND(IDM_IMAGE_FRGMNT, OnImageFragment) ON_COMMAND(IDM_IMAGE_PLSM, OnImagePlasma) ON_COMMAND(IDM_IMAGE_VGNT, OnImageVignnet) ON_COMMAND(IDM_IMAGE_BRCKSTXTR, OnImageBricksTexture) ON_COMMAND(IDM_IMAGE_CNVS, OnImageCanvas) ON_COMMAND(IDM_IMAGE_CLDS, OnImageClouds) ON_COMMAND(IDM_IMAGE_DSKWEXT, OnImageDeskewExt) ON_COMMAND(IDM_IMAGE_CORLST, OnImageCorrelationList) ON_COMMAND(IDM_IMAGE_EMBOSSEXT, OnImageEmbossExt) ON_COMMAND(IDM_COLOR_ADJUSTTINT, OnColorAdjustTint) ON_COMMAND(IDM_COLOR_YUVGMA, OnColorGammaCorrect) ON_COMMAND(IDM_COLOR_CLRDHFTON, OnColorColoredHalfTone) ON_COMMAND(IDM_COLOR_HLFTONPTRN, OnColorHalfTonePattern) ON_COMMAND(IDM_COLOR_HIPSFLTR, OnColorHighPassFilter) ON_COMMAND(IDM_IMAGE_OFFSET, OnImageOffset) ON_COMMAND(IDM_IMAGE_BND, OnImageBnd) ON_COMMAND(IDM_IMAGE_BUMP, OnImageBump) ON_COMMAND(IDM_IMAGE_CYLENDER, OnImageCylender) ON_COMMAND(IDM_IMAGE_FREE_PLANE_BEND, OnImageFreePlaneBend) ON_COMMAND(IDM_IMAGE_FREE_RAD_BEND, OnImageFreeRadBend) ON_COMMAND(IDM_IMAGE_PINCH, OnImagePinch) ON_COMMAND(IDM_IMAGE_PLANE, OnImagePlane) ON_COMMAND(IDM_IMAGE_PLANE_BEND, OnImagePlaneBend) ON_COMMAND(IDM_IMAGE_REVEFFECT, OnImageReveffect) ON_COMMAND(IDM_IMAGE_RIPPEL, OnImageRippel) ON_COMMAND(IDM_IMAGE_SPHERE, OnImageSphere) ON_COMMAND(IDM_IMAGE_TUNNEL, OnImageTunnel) ON_COMMAND(IDM_IMAGE_CUBISM_EFFECT, OnImageCubismEffect) ON_COMMAND(IDM_IMAGE_DRY, OnImageDry) ON_COMMAND(IDM_IMAGE_IMPRESS, OnImageImpress) ON_COMMAND(IDM_IMAGE_ANTIALIAS, OnImageAntialias) ON_COMMAND(IDM_IMAGE_GAUSSIANBLUR, OnImageGaussianblur) ON_COMMAND(IDM_IMAGE_MOTIONBLUR, OnImageMotionblur) ON_COMMAND(IDM_IMAGE_MRAD, OnImageMrad) ON_COMMAND(IDM_IMAGE_SMOOTH, OnImageSmooth) ON_COMMAND(IDM_IMAGE_MZOOM, OnImageMzoom) ON_COMMAND(IDM_IMAGE_NUM, OnImageNum) ON_COMMAND(IDM_IMAGE_MULTIPLY, OnImageMultiply) ON_COMMAND(IDM_IMAGE_HANDWAVE, OnImageHandwave) ON_COMMAND(IDM_IMAGE_OCEAN, OnImageOcean) ON_COMMAND(IDM_IMAGE_POLAR, OnImagePolar) ON_COMMAND(IDM_IMAGE_WVRAD, OnImageWvrad) ON_COMMAND(IDM_IMAGE_SPIRAL, OnImageSpiral) ON_COMMAND(IDM_IMAGE_SHEAR, OnImageShear) ON_COMMAND(IDM_IMAGE_SWIRL, OnImageSwirl) ON_COMMAND(IDM_IMAGE_WAVE, OnImageWave) ON_COMMAND(IDM_IMAGE_WIND, OnImageWind) ON_COMMAND(IDM_IMAGE_WAVEZOOM, OnImageWavezoom) ON_COMMAND(IDM_IMAGE_FINDEDGES, OnImageFindedges) ON_COMMAND(IDM_IMAGE_EDGEDETECTION, OnImageEdgedetection) ON_COMMAND(IDM_IMAGE_GLOW, OnImageGlow) ON_COMMAND(IDM_IMAGE_COMSTS, OnImageComsts) ON_COMMAND(IDM_IMAGE_STATIS, OnImageStatis) ON_COMMAND(IDM_IMAGE_FADEMASK, OnImageFademask) ON_COMMAND(IDM_IMAGE_OPACITY, OnImageOpacity) ON_COMMAND(IDM_IMAGE_AGING, OnImageAging) ON_COMMAND(IDM_IMAGE_DEINTERLACE, OnImageDeinterlace) ON_COMMAND(IDM_IMAGE_MAX, OnImageMax) ON_COMMAND(IDM_IMAGE_MEDIAN, OnImageMedian) ON_COMMAND(IDM_IMAGE_MIN, OnImageMin) ON_COMMAND(IDM_IMAGE_DICE, OnImageDice) ON_COMMAND(IDM_IMAGE_GLASS_EFFECT, OnImageGlassEffect) ON_COMMAND(IDM_IMAGE_PUZZLE, OnImagePuzzle) ON_COMMAND(IDM_IMAGE_PIXELATE, OnImagePixelate) ON_COMMAND(ID_FILTERS_PIXELATE_PICTURIZE_USESAMEIMAGE, OnFiltersPixelatePicturizeUsesameimage) ON_COMMAND(ID_FILTERS_PIXELATE_PICTURIZE_USEMULTIPLEBITMAPS, OnFiltersPixelatePicturizeUsemultiplebitmaps) ON_COMMAND(IDM_IMAGE_LENS, OnImageLens) ON_COMMAND(IDM_IMAGE_LIGHT, OnImageLight) ON_COMMAND(IDM_IMAGE_UNSHARP, OnImageUnsharp) ON_COMMAND(IDM_IMAGE_CONVMATRIX, OnImageConvmatrix) ON_COMMAND(IDM_IMAGE_FFT, OnImageFft) ON_UPDATE_COMMAND_UI(IDM_IMAGE_FFT, OnUpdateImageFft) ON_COMMAND(IDM_IMAGE_DFT, OnImageDft) ON_COMMAND(IDM_IMAGE_ONOFFMASK, OnImageOnoffmask) ON_COMMAND(IDM_IMAGE_DISPLAYFOURIER, OnImageDisplayfourier) ON_COMMAND(IDM_IMAGE_SEG, OnImageSeg) ON_COMMAND(IDM_IMAGE_SKELTON, OnImageSkelton) ON_COMMAND(IDM_IMAGE_ADDBITMAP, OnImageAddbitmap) ON_COMMAND(IDM_IMAGE_COMBINE, OnImageCombine) ON_COMMAND(IDM_IMAGE_FREEHANDNOISE, OnImageFreehandnoise) ON_COMMAND(IDM_IMAGE_ADDNOISE, OnImageAddnoise) ON_COMMAND(IDM_IMAGE_ADDFUNCNOISE, OnImageAddfuncnoise) ON_COMMAND(IDM_IMAGE_CONV, OnImageConv) ON_COMMAND(ID_FILTERS_PIXELATE_PICTURIZE_SPECIFYDIRECTORYASASOURCE, OnFiltersPixelatePicturizeSpecifydirectoryasasource) ON_UPDATE_COMMAND_UI(ID_FILTERS_PIXELATE_PICTURIZE_SPECIFYDIRECTORYASASOURCE, OnUpdateFiltersPixelatePicturizeSpecifydirectoryasasource) ON_UPDATE_COMMAND_UI(ID_FILTERS_PIXELATE_PICTURIZE_USEMULTIPLEBITMAPS, OnUpdateFiltersPixelatePicturizeUsemultiplebitmaps) ON_UPDATE_COMMAND_UI(ID_FILTERS_PIXELATE_PICTURIZE_USESAMEIMAGE, OnUpdateFiltersPixelatePicturizeUsesameimage) ON_UPDATE_COMMAND_UI(IDM_COLOR_BALANCECOLOR, OnUpdateColorBalancecolor) ON_UPDATE_COMMAND_UI(IDM_COLOR_COLOREDGRAY, OnUpdateColorColoredgray) ON_UPDATE_COMMAND_UI(IDM_COLOR_CONVERTTOGRAY, OnUpdateColorConverttogray) ON_UPDATE_COMMAND_UI(IDM_COLOR_GRAY12, OnUpdateColorGray12) ON_UPDATE_COMMAND_UI(IDM_COLOR_GRAY16, OnUpdateColorGray16) ON_UPDATE_COMMAND_UI(IDM_COLOR_GRAY8, OnUpdateColorGray8) ON_UPDATE_COMMAND_UI(IDM_COLOR_HALFTONE, OnUpdateColorHalftone) ON_UPDATE_COMMAND_UI(IDM_COLOR_SWAPCOLOR, OnUpdateColorSwapcolor) ON_UPDATE_COMMAND_UI(IDM_IMAGE_ACE, OnUpdateImageAce) ON_UPDATE_COMMAND_UI(IDM_IMAGE_ADDBITMAP, OnUpdateImageAddbitmap) ON_UPDATE_COMMAND_UI(IDM_IMAGE_ADDFUNCNOISE, OnUpdateImageAddfuncnoise) ON_UPDATE_COMMAND_UI(IDM_IMAGE_ADDMESSAGE, OnUpdateImageAddmessage) ON_UPDATE_COMMAND_UI(IDM_IMAGE_ADDNOISE, OnUpdateImageAddnoise) ON_UPDATE_COMMAND_UI(IDM_IMAGE_AGING, OnUpdateImageAging) ON_UPDATE_COMMAND_UI(IDM_IMAGE_ANTIALIAS, OnUpdateImageAntialias) ON_UPDATE_COMMAND_UI(IDM_IMAGE_AUTOBINARYSEGMENT, OnUpdateImageAutobinarysegment) ON_UPDATE_COMMAND_UI(IDM_IMAGE_AUTOCONTRAST, OnUpdateImageAutocontrast) ON_UPDATE_COMMAND_UI(IDM_IMAGE_AUTOLEVEL, OnUpdateImageAutolevel) ON_UPDATE_COMMAND_UI(IDM_IMAGE_AUTOLUMINOSITY, OnUpdateImageAutoluminosity) ON_UPDATE_COMMAND_UI(IDM_IMAGE_BALANCECOLORS, OnUpdateImageBalancecolors) ON_UPDATE_COMMAND_UI(IDM_IMAGE_BCI, OnUpdateImageBci) ON_UPDATE_COMMAND_UI(IDM_IMAGE_BINARYSEGMENT, OnUpdateImageBinarysegment) ON_UPDATE_COMMAND_UI(IDM_IMAGE_BND, OnUpdateImageBnd) ON_UPDATE_COMMAND_UI(IDM_IMAGE_BUMP, OnUpdateImageBump) ON_UPDATE_COMMAND_UI(IDM_IMAGE_CHANNELMIXER, OnUpdateImageChannelmixer) ON_UPDATE_COMMAND_UI(IDM_IMAGE_CLRRES, OnUpdateImageClrres) ON_UPDATE_COMMAND_UI(IDM_IMAGE_COLORTHRESHOLD, OnUpdateImageColorthreshold) ON_UPDATE_COMMAND_UI(IDM_IMAGE_COMBINE, OnUpdateImageCombine) ON_UPDATE_COMMAND_UI(IDM_IMAGE_COMSTS, OnUpdateImageComsts) ON_UPDATE_COMMAND_UI(IDM_IMAGE_CONV, OnUpdateImageConv) ON_UPDATE_COMMAND_UI(IDM_IMAGE_CONVMATRIX, OnUpdateImageConvmatrix) ON_UPDATE_COMMAND_UI(IDM_IMAGE_CR, OnUpdateImageCr) ON_UPDATE_COMMAND_UI(IDM_IMAGE_CUBISM_EFFECT, OnUpdateImageCubismEffect) ON_UPDATE_COMMAND_UI(IDM_IMAGE_CYLENDER, OnUpdateImageCylender) ON_UPDATE_COMMAND_UI(IDM_IMAGE_DEINTERLACE, OnUpdateImageDeinterlace) ON_UPDATE_COMMAND_UI(IDM_IMAGE_DESAT, OnUpdateImageDesat) ON_UPDATE_COMMAND_UI(IDM_IMAGE_DFT, OnUpdateImageDft) ON_UPDATE_COMMAND_UI(IDM_IMAGE_DICE, OnUpdateImageDice) ON_UPDATE_COMMAND_UI(IDM_IMAGE_DISPLAYFOURIER, OnUpdateImageDisplayfourier) ON_UPDATE_COMMAND_UI(IDM_IMAGE_DRY, OnUpdateImageDry) ON_UPDATE_COMMAND_UI(IDM_IMAGE_DSA, OnUpdateImageDsa) ON_UPDATE_COMMAND_UI(IDM_IMAGE_DUOTONE, OnUpdateImageDuotone) ON_UPDATE_COMMAND_UI(IDM_IMAGE_DYNAMICTHRESHOLD, OnUpdateImageDynamicthreshold) ON_UPDATE_COMMAND_UI(IDM_IMAGE_EDGEDETECTION, OnUpdateImageEdgedetection) ON_UPDATE_COMMAND_UI(IDM_IMAGE_EXTRACTMESSAGE, OnUpdateImageExtractmessage) ON_UPDATE_COMMAND_UI(IDM_IMAGE_FADEMASK, OnUpdateImageFademask) ON_UPDATE_COMMAND_UI(IDM_IMAGE_FILLBITMAP, OnUpdateImageFillbitmap) ON_UPDATE_COMMAND_UI(IDM_IMAGE_FINDEDGES, OnUpdateImageFindedges) ON_UPDATE_COMMAND_UI(IDM_IMAGE_FREE_PLANE_BEND, OnUpdateImageFreePlaneBend) ON_UPDATE_COMMAND_UI(IDM_IMAGE_FREE_RAD_BEND, OnUpdateImageFreeRadBend) ON_UPDATE_COMMAND_UI(IDM_IMAGE_FREEHANDNOISE, OnUpdateImageFreehandnoise) ON_UPDATE_COMMAND_UI(IDM_IMAGE_GAUSSIANBLUR, OnUpdateImageGaussianblur) ON_UPDATE_COMMAND_UI(IDM_IMAGE_GETFERETS, OnUpdateImageGetferets) ON_UPDATE_COMMAND_UI(IDM_IMAGE_GETOBJECTINFONW, OnUpdateImageGetobjectinfonw) ON_UPDATE_COMMAND_UI(IDM_IMAGE_GETOBJECTINFOW, OnUpdateImageGetobjectinfow) ON_UPDATE_COMMAND_UI(IDM_IMAGE_GETRGNPERIMETER, OnUpdateImageGetrgnperimeter) ON_UPDATE_COMMAND_UI(IDM_IMAGE_GLASS_EFFECT, OnUpdateImageGlassEffect) ON_UPDATE_COMMAND_UI(IDM_IMAGE_GLOW, OnUpdateImageGlow) ON_UPDATE_COMMAND_UI(IDM_IMAGE_HANDWAVE, OnUpdateImageHandwave) ON_UPDATE_COMMAND_UI(IDM_IMAGE_HISTOGRAM, OnUpdateImageHistogram) ON_UPDATE_COMMAND_UI(IDM_IMAGE_HISTOGRAMEQUALIZE, OnUpdateImageHistogramequalize) ON_UPDATE_COMMAND_UI(IDM_IMAGE_HSB, OnUpdateImageHsb) ON_UPDATE_COMMAND_UI(IDM_IMAGE_IMPRESS, OnUpdateImageImpress) ON_UPDATE_COMMAND_UI(IDM_IMAGE_LENS, OnUpdateImageLens) ON_UPDATE_COMMAND_UI(IDM_IMAGE_LEVELING, OnUpdateImageLeveling) ON_UPDATE_COMMAND_UI(IDM_IMAGE_LIGHT, OnUpdateImageLight) ON_UPDATE_COMMAND_UI(IDM_IMAGE_LIGHT_CONTROL, OnUpdateImageLightControl) ON_UPDATE_COMMAND_UI(IDM_IMAGE_LOCALHISTO, OnUpdateImageLocalhisto) ON_UPDATE_COMMAND_UI(IDM_IMAGE_MATH, OnUpdateImageMath) ON_UPDATE_COMMAND_UI(IDM_IMAGE_MAX, OnUpdateImageMax) ON_UPDATE_COMMAND_UI(IDM_IMAGE_MEDIAN, OnUpdateImageMedian) ON_UPDATE_COMMAND_UI(IDM_IMAGE_MIN, OnUpdateImageMin) ON_UPDATE_COMMAND_UI(IDM_IMAGE_MOTIONBLUR, OnUpdateImageMotionblur) ON_UPDATE_COMMAND_UI(IDM_IMAGE_MRAD, OnUpdateImageMrad) ON_UPDATE_COMMAND_UI(IDM_IMAGE_MULTIPLY, OnUpdateImageMultiply) ON_UPDATE_COMMAND_UI(IDM_IMAGE_MZOOM, OnUpdateImageMzoom) ON_UPDATE_COMMAND_UI(IDM_IMAGE_NUM, OnUpdateImageNum) ON_UPDATE_COMMAND_UI(IDM_IMAGE_OCEAN, OnUpdateImageOcean) ON_UPDATE_COMMAND_UI(IDM_IMAGE_ONOFFMASK, OnUpdateImageOnoffmask) ON_UPDATE_COMMAND_UI(IDM_IMAGE_OPACITY, OnUpdateImageOpacity) ON_UPDATE_COMMAND_UI(IDM_IMAGE_PINCH, OnUpdateImagePinch) ON_UPDATE_COMMAND_UI(IDM_IMAGE_PIXELATE, OnUpdateImagePixelate) ON_UPDATE_COMMAND_UI(IDM_IMAGE_PLANE, OnUpdateImagePlane) ON_UPDATE_COMMAND_UI(IDM_IMAGE_PLANE_BEND, OnUpdateImagePlaneBend) ON_UPDATE_COMMAND_UI(IDM_IMAGE_POLAR, OnUpdateImagePolar) ON_UPDATE_COMMAND_UI(IDM_IMAGE_PUZZLE, OnUpdateImagePuzzle) ON_UPDATE_COMMAND_UI(IDM_IMAGE_REDEYEREMOVE, OnUpdateImageRedeyeremove) ON_UPDATE_COMMAND_UI(IDM_IMAGE_REMAPHUE, OnUpdateImageRemaphue) ON_UPDATE_COMMAND_UI(IDM_IMAGE_REMAPINTENSITY, OnUpdateImageRemapintensity) ON_UPDATE_COMMAND_UI(IDM_IMAGE_REPCLR, OnUpdateImageRepclr) ON_UPDATE_COMMAND_UI(IDM_IMAGE_RESIZE, OnUpdateImageResize) ON_UPDATE_COMMAND_UI(IDM_IMAGE_REVEFFECT, OnUpdateImageReveffect) ON_UPDATE_COMMAND_UI(IDM_IMAGE_RIPPEL, OnUpdateImageRippel) ON_UPDATE_COMMAND_UI(IDM_IMAGE_SAMPLE_TARGET, OnUpdateImageSampleTarget) ON_UPDATE_COMMAND_UI(IDM_IMAGE_SEG, OnUpdateImageSeg) ON_UPDATE_COMMAND_UI(IDM_IMAGE_SELECTIVECOLOR, OnUpdateImageSelectivecolor) ON_UPDATE_COMMAND_UI(IDM_IMAGE_SHADOW, OnUpdateImageShadow) ON_UPDATE_COMMAND_UI(IDM_IMAGE_SHEAR, OnUpdateImageShear) ON_UPDATE_COMMAND_UI(IDM_IMAGE_SKELTON, OnUpdateImageSkelton) ON_UPDATE_COMMAND_UI(IDM_IMAGE_SMOOTH, OnUpdateImageSmooth) ON_UPDATE_COMMAND_UI(IDM_IMAGE_SPHERE, OnUpdateImageSphere) ON_UPDATE_COMMAND_UI(IDM_IMAGE_SPIRAL, OnUpdateImageSpiral) ON_UPDATE_COMMAND_UI(IDM_IMAGE_STAR, OnUpdateImageStar) ON_UPDATE_COMMAND_UI(IDM_IMAGE_STATIS, OnUpdateImageStatis) ON_UPDATE_COMMAND_UI(IDM_IMAGE_SUBTRACTBACKGROUND, OnUpdateImageSubtractbackground) ON_UPDATE_COMMAND_UI(IDM_IMAGE_SWIRL, OnUpdateImageSwirl) ON_UPDATE_COMMAND_UI(IDM_IMAGE_TUNNEL, OnUpdateImageTunnel) ON_UPDATE_COMMAND_UI(IDM_IMAGE_UNSHARP, OnUpdateImageUnsharp) ON_UPDATE_COMMAND_UI(IDM_IMAGE_WAVE, OnUpdateImageWave) ON_UPDATE_COMMAND_UI(IDM_IMAGE_WAVEZOOM, OnUpdateImageWavezoom) ON_UPDATE_COMMAND_UI(IDM_IMAGE_WIND, OnUpdateImageWind) ON_UPDATE_COMMAND_UI(IDM_IMAGE_WVRAD, OnUpdateImageWvrad) ON_UPDATE_COMMAND_UI(IDM_VIEW_ADDBORDER, OnUpdateViewAddborder) ON_UPDATE_COMMAND_UI(IDM_VIEW_ADDFRAME, OnUpdateViewAddframe) ON_COMMAND(ID_IMAGE_MEDICALIMAGING_BRAINANALYSIS, OnImageBrainAnalysis) ON_UPDATE_COMMAND_UI(ID_IMAGE_MEDICALIMAGING_BRAINANALYSIS, OnUpdateImageBrainAnalysis) ON_MESSAGE(WM_USER_CHANGECURSOR, OnChangeCursor) ON_WM_CREATE() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CIMGPFView construction/destruction CIMGPFView::CIMGPFView() : CFormView(CIMGPFView::IDD) { m_pKfmnDlg = NULL; //{{AFX_DATA_INIT(CIMGPFView) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT // TODO: add construction code here } CIMGPFView::~CIMGPFView() { } void CIMGPFView::DoDataExchange(CDataExchange* pDX) { CFormView::DoDataExchange(pDX); //{{AFX_DATA_MAP(CIMGPFView) DDX_Control(pDX, IDC_LEADRASTERVIEW1, m_ltRasView); //}}AFX_DATA_MAP } BOOL CIMGPFView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CFormView::PreCreateWindow(cs); } void CIMGPFView::OnInitialUpdate() { CFormView::OnInitialUpdate(); CIMGPFDoc *pDoc = (CIMGPFDoc *)GetDocument(); ILEADRaster *pRaster =pDoc->m_pRaster; pRaster->RefBitmap = TRUE; m_ltRasView.GetRaster().SetBitmap(pRaster->Bitmap); m_ltRasView.SetEnableKeyboard ( FALSE); SetScrollSizes(MM_TEXT, CSize(0, 0)); m_ltRasView.SetBackErase(FALSE); m_ltRasView.SetCenterImage(TRUE); } ///////////////////////////////////////////////////////////////////////////// // CIMGPFView diagnostics #ifdef _DEBUG void CIMGPFView::AssertValid() const { CFormView::AssertValid(); } void CIMGPFView::Dump(CDumpContext& dc) const { CFormView::Dump(dc); } CIMGPFDoc* CIMGPFView::GetDocument() // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CIMGPFDoc))); return (CIMGPFDoc*)m_pDocument; } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CIMGPFView message handlers void CIMGPFView::OnSize(UINT nType, int cx, int cy) { CFormView::OnSize(nType, cx, cy); if (IsWindow(m_ltRasView.m_hWnd)) { m_ltRasView.MoveWindow(0, 0, cx, cy); } } int CIMGPFView::LoadOriginalBitmap() { int nRet; BeginWaitCursor(); nRet = theApp.m_pRasterIO->Load(m_ltRasView.GetRaster(), theApp.m_szFileName.AllocSysString(), 0, theApp.m_iPage, 1); EndWaitCursor(); return nRet; } void CIMGPFView::OnImageGray8() { INT nRet, nBitsPerPixel; nBitsPerPixel = 8; // Load the original bitmap if(LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); nRet = theApp.m_pRasterProcess->Grayscale(m_ltRasView.GetRaster(), nBitsPerPixel); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageGray12() { INT nRet, nBitsPerPixel; nBitsPerPixel = 12; // Load the original bitmap if(LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; nRet = theApp.m_pRasterProcess->Grayscale(m_ltRasView.GetRaster(), nBitsPerPixel); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageGray16() { INT nRet, nBitsPerPixel; nBitsPerPixel = 16; // Load the original bitmap if(LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; nRet = theApp.m_pRasterProcess->Grayscale(m_ltRasView.GetRaster(), nBitsPerPixel); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageHistogram() { theApp.m_pRasterImgDlg->PutBitmap(m_ltRasView.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); int nRet = theApp.m_pRasterImgDlg->ShowHistogramDlg((long)this->m_hWnd); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageGetrgnperimeter() { TCHAR szBuffer[200] = TEXT("\0"); unsigned int puLength; m_ltRasView.SetRgnFrameType(RGNFRAME_ANIMATED); m_ltRasView.GetRaster().SetRgnRect ( 0, 0, 200, 100, L_RGN_SET ); int nRet =theApp.m_pRasterProcess->GetRgnPerimeterLength(m_ltRasView.GetRaster()); if(nRet != 0) { theApp.DisplayLEADError(nRet); return; } puLength = theApp.m_pRasterProcess->GetRgnPerimeterLength(); wsprintf(szBuffer, TEXT(" Region Perimeter Length = %d\n"), puLength); MessageBox(szBuffer, TEXT("Get Region Perimeter Length"), MB_OK); m_ltRasView.GetRaster().SetRgnRect ( 0, 0, 0, 0, L_RGN_SET ); } void CIMGPFView::OnImageGetferets() { TCHAR szBuffer[200] = TEXT("\0"); m_ltRasView.SetRgnFrameType(RGNFRAME_ANIMATED); m_ltRasView.GetRaster().SetRgnRect ( 0, 0, 200, 100, L_RGN_SET ); int nRet = theApp.m_pRasterProcess->GetRgnContourPoints(m_ltRasView.GetRaster()); if(nRet != 0) { theApp.DisplayLEADError(nRet); return; } theApp.m_pRasterProcess->GetFeretsDiameter(); wsprintf(szBuffer, TEXT("The Ferets = %d\n"), theApp.m_pRasterProcess->GetFeretsDiameterLength()); MessageBox(szBuffer, TEXT("Get Ferets Diameter"), MB_OK); m_ltRasView.GetRaster().SetRgnRect ( 0, 0, 0, 0, L_RGN_SET ); } void CIMGPFView::OnImageGetobjectinfow() { unsigned int puX, puY, puAngle, puRoundness; TCHAR szBuffer[200] = TEXT("\0"); int nRet = theApp.m_pRasterProcess->GetObjectInfo( m_ltRasView.GetRaster(), TRUE ); if(nRet != 0) { theApp.DisplayLEADError(nRet); return; } puX = theApp.m_pRasterProcess->GetObjectXPos(); puY = theApp.m_pRasterProcess->GetObjectYPos(); puAngle = theApp.m_pRasterProcess->GetObjectOrientationAngle(); puRoundness = theApp.m_pRasterProcess->GetObjectRoundness(); wsprintf(szBuffer, TEXT(" X\t\t = %d\n Y\t\t = %d\n Angle\t\t = %d\n Roundness\t = %d"), puX, puY, puAngle, puRoundness); MessageBox(szBuffer, TEXT("Get Weighted Object Info"), MB_OK); } void CIMGPFView::OnImageGetobjectinfonw() { unsigned int puX, puY, puAngle, puRoundness; TCHAR szBuffer[200] = TEXT("\0"); int nRet = theApp.m_pRasterProcess->GetObjectInfo( m_ltRasView.GetRaster(), FALSE ); if(nRet != 0) { theApp.DisplayLEADError(nRet); return; } puX = theApp.m_pRasterProcess->GetObjectXPos(); puY = theApp.m_pRasterProcess->GetObjectYPos(); puAngle = theApp.m_pRasterProcess->GetObjectOrientationAngle(); puRoundness = theApp.m_pRasterProcess->GetObjectRoundness(); wsprintf(szBuffer, TEXT(" X\t\t = %d\n Y\t\t = %d\n Angle\t\t = %d\n Roundness\t = %d"), puX, puY, puAngle, puRoundness); MessageBox(szBuffer, TEXT("Get Weighted Object Info"), MB_OK); } void CIMGPFView::OnImageRedeyeremove() { int nLightness; unsigned int uThreshold; COLORREF crNewColor; int nRet; nLightness = RGB(5, 20, 10); uThreshold = 128; crNewColor = 100; // Load the original bitmap if(LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); nRet = theApp.m_pRasterProcess->RemoveRedeye( m_ltRasView.GetRaster(), crNewColor, uThreshold, nLightness ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnViewAddborder() { // Load the original bitmap if(LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->AddBorder(m_ltRasView.GetRaster(), 40, 40, 40, 40, BORDER_OUTSIDE, BORDER_STYLE_GRADIENT, BORDER_EFFECT_CURVEDIN, NULL, BORDER_GRAD_INSIDEOUT, RGB(255, 0, 0), RGB(0, 0, 255), 0, FALSE, FALSE, 0, BORDER_SHADOW_LEFT, FALSE ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnViewAddframe() { int nRet; ILEADRaster * m_pRaster; HRESULT hr; theApp.m_pRasterFileDlg->PutFilter(""); theApp.m_pRasterFileDlg->PutFileDlgFlags(0); theApp.m_pRasterFileDlg->PutFileName(""); theApp.m_pRasterFileDlg->PutDialogTitle("Open File"); theApp.m_pRasterFileDlg->PutUIFlags( OPEN_SHOW_PREVIEW | OPEN_SHOW_FILEINFO | OPEN_SHOW_LOADCOMPRESSED | OPEN_SHOW_LOADROTATED | OPEN_VIEWTOTALPAGES ); nRet = theApp.m_pRasterFileDlg->ShowOpenDlg((long)theApp.m_pMainWnd->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { m_pRaster = NULL; hr = theApp.CreateRasterObjectLic(&m_pRaster); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER); return;} theApp.m_pRasterIO->Load(m_pRaster, theApp.m_pRasterFileDlg->GetFileName(), 0, 1, 1); // Load the original bitmap if(LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); nRet = theApp.m_pRasterProcess->AddFrame(m_ltRasView.GetRaster(), m_pRaster, FALSE, FALSE, RGB(0,0,0), 50, FRAME_INSIDE, FRAME_QUALITY_HIGH); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); m_pRaster->Release(); } theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageStar() { // Load the original bitmap if(LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->DrawStar(m_ltRasView.GetRaster(), (short)(m_ltRasView.GetRaster().GetBitmapWidth() * 0.5), (short)(m_ltRasView.GetRaster().GetBitmapHeight() * 0.5), 5, (short)(m_ltRasView.GetRaster().GetBitmapWidth() * 0.5), (short)(m_ltRasView.GetRaster().GetBitmapHeight() * 0.5), 50, 0, 0, 0, 0, 100, 100, RGB(255, 0, 0), RGB(0, 0, 255), 100, STR_INSIDE ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageResize() { // Load the original bitmap if(LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Size( m_ltRasView.GetRaster(), m_ltRasView.GetRaster().GetBitmapWidth()/2, m_ltRasView.GetRaster().GetBitmapHeight()/2, RESIZE_NORMAL ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageAddmessage() { CAddMsgDlg AddMsgDlg = new CAddMsgDlg(); int nret = AddMsgDlg.DoModal(); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutMessage((LPCTSTR)AddMsgDlg.m_strMsgText) ; int nRet = theApp.m_pRasterProcess->AddMessage(m_ltRasView.GetRaster()); theApp.m_pRasterProcess->Message = ""; EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageExtractmessage() { int nRet; BeginWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); theApp.m_pRasterProcess->StartX = 0; theApp.m_pRasterProcess->StartY = 0; nRet = theApp.m_pRasterProcess->ExtractMessage(m_ltRasView.GetRaster()); if( nRet != 0 ) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); return; } theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); MessageBox ( (TCHAR *)theApp.m_pRasterProcess->Message, TEXT("Notice"), MB_OK | MB_ICONINFORMATION ); } void CIMGPFView::OnImageGraycoloration() { int nBPP; unsigned int uMaxColor; ILEADRaster * pTmpRaster; HRESULT hr; pTmpRaster = NULL; hr = theApp.CreateRasterObjectLic(&pTmpRaster); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER); return;} pTmpRaster->PutBitmap(m_ltRasView.GetRaster().GetBitmap() ); uMaxColor = GetBitmapMaxColors(); nBPP = m_ltRasView.GetRaster().GetBitmapBits(); theApp.m_pRasterProcess->GrayColorCount = 16; theApp.m_pRasterProcess->PutGrayColorThreshold(0,(1 * uMaxColor / nBPP)); theApp.m_pRasterProcess->PutGrayColorRed(0,0); theApp.m_pRasterProcess->PutGrayColorGreen(0,0); theApp.m_pRasterProcess->PutGrayColorBlue(0,0); theApp.m_pRasterProcess->PutGrayColorThreshold(1,(2 * uMaxColor / nBPP)); theApp.m_pRasterProcess->PutGrayColorRed(1,0); theApp.m_pRasterProcess->PutGrayColorGreen(1,0); theApp.m_pRasterProcess->PutGrayColorBlue(1,127); theApp.m_pRasterProcess->PutGrayColorThreshold(2,(3 * uMaxColor / nBPP)); theApp.m_pRasterProcess->PutGrayColorRed(2,0); theApp.m_pRasterProcess->PutGrayColorGreen(2,0); theApp.m_pRasterProcess->PutGrayColorBlue(2,255); theApp.m_pRasterProcess->PutGrayColorThreshold(3,(4 * uMaxColor / nBPP)); theApp.m_pRasterProcess->PutGrayColorRed(3,0); theApp.m_pRasterProcess->PutGrayColorGreen(3,127); theApp.m_pRasterProcess->PutGrayColorBlue(3,0); theApp.m_pRasterProcess->PutGrayColorThreshold(4,(5 * uMaxColor / nBPP)); theApp.m_pRasterProcess->PutGrayColorRed(4,0); theApp.m_pRasterProcess->PutGrayColorGreen(4,255); theApp.m_pRasterProcess->PutGrayColorBlue(4,0); theApp.m_pRasterProcess->PutGrayColorThreshold(5,(6 * uMaxColor / nBPP)); theApp.m_pRasterProcess->PutGrayColorRed(5,0); theApp.m_pRasterProcess->PutGrayColorGreen(5,255); theApp.m_pRasterProcess->PutGrayColorBlue(5,127); theApp.m_pRasterProcess->PutGrayColorThreshold(6,(7 * uMaxColor / nBPP)); theApp.m_pRasterProcess->PutGrayColorRed(6,0); theApp.m_pRasterProcess->PutGrayColorGreen(6,255); theApp.m_pRasterProcess->PutGrayColorBlue(6,255); theApp.m_pRasterProcess->PutGrayColorThreshold(7,(8 * uMaxColor / nBPP)); theApp.m_pRasterProcess->PutGrayColorRed(7,127); theApp.m_pRasterProcess->PutGrayColorGreen(7,0); theApp.m_pRasterProcess->PutGrayColorBlue(7,0); theApp.m_pRasterProcess->PutGrayColorThreshold(8,(9 * uMaxColor / nBPP)); theApp.m_pRasterProcess->PutGrayColorRed(8,255); theApp.m_pRasterProcess->PutGrayColorGreen(8,0); theApp.m_pRasterProcess->PutGrayColorBlue(8,0); theApp.m_pRasterProcess->PutGrayColorThreshold(9,(10 * uMaxColor / nBPP)); theApp.m_pRasterProcess->PutGrayColorRed(9,255); theApp.m_pRasterProcess->PutGrayColorGreen(9,0); theApp.m_pRasterProcess->PutGrayColorBlue(9,127); theApp.m_pRasterProcess->PutGrayColorThreshold(10,(11 * uMaxColor / nBPP)); theApp.m_pRasterProcess->PutGrayColorRed(10,255); theApp.m_pRasterProcess->PutGrayColorGreen(10,0); theApp.m_pRasterProcess->PutGrayColorBlue(10,255); theApp.m_pRasterProcess->PutGrayColorThreshold(11,(12 * uMaxColor / nBPP)); theApp.m_pRasterProcess->PutGrayColorRed(11,255); theApp.m_pRasterProcess->PutGrayColorGreen(11,127); theApp.m_pRasterProcess->PutGrayColorBlue(11,0); theApp.m_pRasterProcess->PutGrayColorThreshold(12,(13 * uMaxColor / nBPP)); theApp.m_pRasterProcess->PutGrayColorRed(12,255); theApp.m_pRasterProcess->PutGrayColorGreen(12,255); theApp.m_pRasterProcess->PutGrayColorBlue(12,0); theApp.m_pRasterProcess->PutGrayColorThreshold(13,(14 * uMaxColor / nBPP)); theApp.m_pRasterProcess->PutGrayColorRed(13,127); theApp.m_pRasterProcess->PutGrayColorGreen(13,255); theApp.m_pRasterProcess->PutGrayColorBlue(13,255); theApp.m_pRasterProcess->PutGrayColorThreshold(14,(15 * uMaxColor / nBPP)); theApp.m_pRasterProcess->PutGrayColorRed(14,255); theApp.m_pRasterProcess->PutGrayColorGreen(14,255); theApp.m_pRasterProcess->PutGrayColorBlue(14,255); theApp.m_pRasterProcess->PutGrayColorThreshold(15,(16 * uMaxColor / nBPP)); theApp.m_pRasterProcess->PutGrayColorRed(15,127); theApp.m_pRasterProcess->PutGrayColorGreen(15,127); theApp.m_pRasterProcess->PutGrayColorBlue(15,127); BeginWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->ColorizeGray( m_ltRasView.GetRaster(), pTmpRaster ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); pTmpRaster->Release(); } unsigned int CIMGPFView::GetBitmapMaxColors () { unsigned int uMaxColors = 0; switch ( m_ltRasView.GetRaster().GetBitmapBits() ) { case 12: case 48: case 64: uMaxColors = 65535; break; case 16: if ( m_ltRasView.GetRaster().GetIsGrayscale() ) { uMaxColors = 65535; } else { uMaxColors = 255; } break; default: uMaxColors = 255; break; } return uMaxColors; } void CIMGPFView::OnUpdateImageGraycoloration(CCmdUI* pCmdUI) { int nBPP; BOOL bGrayScale; if(m_ltRasView.GetRaster().GetBitmap()) { nBPP = m_ltRasView.GetRaster().GetBitmapBits(); bGrayScale = m_ltRasView.GetRaster().GetIsGrayscale(); if ( !bGrayScale || nBPP == 1 ) pCmdUI->Enable( FALSE ); else pCmdUI->Enable( TRUE ); } else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnImageDsa() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->DigitalSubtract( m_ltRasView.GetRaster(), m_ltRasView.GetRaster(), 0 ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageCr() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->MultiScaleEnhancement ( m_ltRasView.GetRaster(), 1500, // lContrast MSE_DEFAULT,// lEdgeLevels MSE_DEFAULT,// lEdgeCoeff MSE_DEFAULT,// lLatitudeLevels MSE_DEFAULT,// lLatitudeCoeff MSE_GAUSSIAN// lFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageBitmapselector() { ILEADRaster * pTmpRaster; HRESULT hr; pTmpRaster = NULL; hr = theApp.CreateRasterObjectLic(&pTmpRaster); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER); return;} if( LoadOriginalBitmap() != 0 ) return; pTmpRaster->PutBitmap(m_ltRasView.GetRaster().GetBitmap() ); BeginWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->SelectData(m_ltRasView.GetRaster(),//RasterDIS pTmpRaster ,// RasterSrc RGB(0, 0, 255),// crColor 0,// SrcLowBit m_ltRasView.GetRaster().GetBitmapBits() -1 ,//SrcHighBit 0,// Threshold TRUE// bCombine ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); pTmpRaster->Release(); } void CIMGPFView::OnUpdateImageBitmapselector(CCmdUI* pCmdUI) { int nBPP; BOOL bGrayScale; if(m_ltRasView.GetRaster().GetBitmap()) { nBPP = m_ltRasView.GetRaster().GetBitmapBits(); bGrayScale = m_ltRasView.GetRaster().GetIsGrayscale(); if ( !bGrayScale || nBPP == 1 ) pCmdUI->Enable( FALSE ); else pCmdUI->Enable( TRUE ); } else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnImageShiftbitmap() { ILEADRaster * pTmpRaster; HRESULT hr; pTmpRaster = NULL; hr = theApp.CreateRasterObjectLic(&pTmpRaster); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER); return;} if( LoadOriginalBitmap() != 0 ) return; pTmpRaster->PutBitmap(m_ltRasView.GetRaster().GetBitmap() ); BeginWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->ShiftData(m_ltRasView.GetRaster(),// RasterDst pTmpRaster,// RasterSrc 0,// SrcLowBit 7,// SrcHighBit 1,// DstLowBit 8// DstBitsPerPixel ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); pTmpRaster->Release(); } void CIMGPFView::OnUpdateImageShiftbitmap(CCmdUI* pCmdUI) { int nBPP; BOOL bGrayScale; if(m_ltRasView.GetRaster().GetBitmap()) { nBPP = m_ltRasView.GetRaster().GetBitmapBits(); bGrayScale = m_ltRasView.GetRaster().GetIsGrayscale(); if ( !bGrayScale || nBPP == 1 ) pCmdUI->Enable( FALSE ); else pCmdUI->Enable( TRUE ); } else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnImageSubtractbackground() { if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->SubtractBackground(m_ltRasView.GetRaster(), 50,// RollingBall SBK_DEPEND,// ShrinkSize 100,// BrightnessFactor 0// Flags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageAutolevel() { unsigned int uBlackClip, uWhiteClip, uFlags; uBlackClip = DEFAULT_BLACK_CLIP; uWhiteClip = DEFAULT_WHITE_CLIP; uFlags = AUTO_LEVEL; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->AutoColorLevel( m_ltRasView.GetRaster(), uBlackClip, uWhiteClip, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageAutocontrast() { unsigned int uBlackClip, uWhiteClip, uFlags; uBlackClip = DEFAULT_BLACK_CLIP; uWhiteClip = DEFAULT_WHITE_CLIP; uFlags = AUTO_CONTRAST; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->AutoColorLevel( m_ltRasView.GetRaster(), uBlackClip, uWhiteClip, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageAutoluminosity() { unsigned int uBlackClip, uWhiteClip, uFlags; uBlackClip = DEFAULT_BLACK_CLIP; uWhiteClip = DEFAULT_WHITE_CLIP; uFlags = AUTO_INTENSITY; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->AutoColorLevel( m_ltRasView.GetRaster(), uBlackClip, uWhiteClip, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageBci() { int nContrast, nBrightness, nIntensity; nContrast = -146; nBrightness = 385; nIntensity = 240; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->ContrastBrightIntensity( m_ltRasView.GetRaster(), nContrast, nBrightness, nIntensity ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageLeveling() { unsigned int uFlags; theApp.m_pRasterProcess->MasterMinInput = 0; theApp.m_pRasterProcess->MasterMaxInput = 100; theApp.m_pRasterProcess->MasterMinOutput = 0; theApp.m_pRasterProcess->MasterMaxOutput = 255; theApp.m_pRasterProcess->MasterGamma = DEFAULT_GAMMA; theApp.m_pRasterProcess->RedMinInput = 0; theApp.m_pRasterProcess->RedMaxInput = 100; theApp.m_pRasterProcess->RedMinOutput = 0; theApp.m_pRasterProcess->RedMaxOutput = 255; theApp.m_pRasterProcess->RedGamma = DEFAULT_GAMMA; theApp.m_pRasterProcess->GreenMinInput = 0; theApp.m_pRasterProcess->GreenMaxInput = 255; theApp.m_pRasterProcess->GreenMinOutput = 0; theApp.m_pRasterProcess->GreenMaxOutput = 100; theApp.m_pRasterProcess->GreenGamma = DEFAULT_GAMMA; theApp.m_pRasterProcess->BlueMinInput = 0; theApp.m_pRasterProcess->BlueMaxInput = 255; theApp.m_pRasterProcess->BlueMinOutput = 0; theApp.m_pRasterProcess->BlueMaxOutput = 100; theApp.m_pRasterProcess->BlueGamma = DEFAULT_GAMMA; uFlags = LEVEL_MASTER | LEVEL_RED | LEVEL_GREEN | LEVEL_BLUE; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->ColorLevel( m_ltRasView.GetRaster(), uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnColorBalancecolor() { float fRedToRed, fRedToGreen, fRedToBlue; float fGreenToRed, fGreenToGreen, fGreenToBlue; float fBlueToRed, fBlueToGreen, fBlueToBlue; fRedToRed = 0.25; fRedToGreen = 0.25; fRedToBlue = 0.5; fGreenToRed = (float)0.3; fGreenToGreen = (float)0.3; fGreenToBlue = (float)0.4; fBlueToRed = (float)0.1; fBlueToGreen = (float)0.3; fBlueToBlue = (float)0.6; if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->BalanceColors(m_ltRasView.GetRaster(), fRedToRed, fRedToGreen, fRedToBlue, fGreenToRed, fGreenToGreen, fGreenToBlue, fBlueToRed, fBlueToGreen, fBlueToBlue); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageChannelmixer() { int fRedToRed, fRedToGreen, fRedToBlue, fRedConstant; int fGreenToRed, fGreenToGreen, fGreenToBlue, fGreenConstant; int fBlueToRed, fBlueToGreen, fBlueToBlue, fBlueConstant; fRedToRed = 100; fRedToGreen = 50; fRedToBlue = 0; fRedConstant = 0; fGreenToRed = 0; fGreenToGreen = 100; fGreenToBlue = 0; fGreenConstant = 0; fBlueToRed = 0; fBlueToGreen = 0; fBlueToBlue = 100; fBlueConstant = 0; if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->ChannelMix(m_ltRasView.GetRaster(), fRedToRed, fRedToGreen, fRedToBlue, fRedConstant, fGreenToRed, fGreenToGreen, fGreenToBlue, fGreenConstant, fBlueToRed, fBlueToGreen, fBlueToBlue, fBlueConstant); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageBalancecolors() { BOOL bLuminance; theApp.m_pRasterProcess->GetShadows()->Red = 60; theApp.m_pRasterProcess->GetShadows()->Green = 0; theApp.m_pRasterProcess->GetShadows()->Blue = 0; theApp.m_pRasterProcess->GetMidTone()->Red = 40; theApp.m_pRasterProcess->GetMidTone()->Green = 0; theApp.m_pRasterProcess->GetMidTone()->Blue = 0; theApp.m_pRasterProcess->GetHighLight()->Red = 70; theApp.m_pRasterProcess->GetHighLight()->Green = 0; theApp.m_pRasterProcess->GetHighLight()->Blue = 0; if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); bLuminance = FALSE; int nRet = theApp.m_pRasterProcess->ColorIntensityBalance( m_ltRasView.GetRaster(), bLuminance ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageDesat() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Desaturate(m_ltRasView.GetRaster()); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageFillbitmap() { COLORREF crFill; crFill = RGB (0, 0, 255); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Fill( m_ltRasView.GetRaster(), crFill ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageHsb() { int nHue, nIntensity, nSaturation; nHue = 18000; nSaturation = 0; nIntensity = 0; theApp.m_pRasterProcess->HSICount = 6; //Color: Red theApp.m_pRasterProcess->PutHSIHue(0,0); theApp.m_pRasterProcess->PutHSISaturation(0,0); theApp.m_pRasterProcess->PutHSIIntensity(0,0); theApp.m_pRasterProcess->PutHSIOuterLow(0,0); theApp.m_pRasterProcess->PutHSIOuterHigh(0,359); theApp.m_pRasterProcess->PutHSIInnerLow(0,90); theApp.m_pRasterProcess->PutHSIInnerHigh(0,180); //Color: Yellow theApp.m_pRasterProcess->PutHSIHue(1,0); theApp.m_pRasterProcess->PutHSISaturation(1,0); theApp.m_pRasterProcess->PutHSIIntensity(1,0); theApp.m_pRasterProcess->PutHSIOuterLow(1,0); theApp.m_pRasterProcess->PutHSIOuterHigh(1,359); theApp.m_pRasterProcess->PutHSIInnerLow(1,90); theApp.m_pRasterProcess->PutHSIInnerHigh(1,180); //Color: Green theApp.m_pRasterProcess->PutHSIHue(2,0); theApp.m_pRasterProcess->PutHSISaturation(2,0); theApp.m_pRasterProcess->PutHSIIntensity(2,0); theApp.m_pRasterProcess->PutHSIOuterLow(2,0); theApp.m_pRasterProcess->PutHSIOuterHigh(2,359); theApp.m_pRasterProcess->PutHSIInnerLow(2,90); theApp.m_pRasterProcess->PutHSIInnerHigh(2,180); //Color: Cyan theApp.m_pRasterProcess->PutHSIHue(3,0); theApp.m_pRasterProcess->PutHSISaturation(3,0); theApp.m_pRasterProcess->PutHSIIntensity(3,0); theApp.m_pRasterProcess->PutHSIOuterLow(3,0); theApp.m_pRasterProcess->PutHSIOuterHigh(3,359); theApp.m_pRasterProcess->PutHSIInnerLow(3,90); theApp.m_pRasterProcess->PutHSIInnerHigh(3,180); //Color: Blue theApp.m_pRasterProcess->PutHSIHue(4,0); theApp.m_pRasterProcess->PutHSISaturation(4,0); theApp.m_pRasterProcess->PutHSIIntensity(4,0); theApp.m_pRasterProcess->PutHSIOuterLow(4,0); theApp.m_pRasterProcess->PutHSIOuterHigh(4,359); theApp.m_pRasterProcess->PutHSIInnerLow(4,90); theApp.m_pRasterProcess->PutHSIInnerHigh(4,180); //Color: Magentas theApp.m_pRasterProcess->PutHSIHue(5,0); theApp.m_pRasterProcess->PutHSISaturation(5,0); theApp.m_pRasterProcess->PutHSIIntensity(5,0); theApp.m_pRasterProcess->PutHSIOuterLow(5,0); theApp.m_pRasterProcess->PutHSIOuterHigh(5,359); theApp.m_pRasterProcess->PutHSIInnerLow(5,90); theApp.m_pRasterProcess->PutHSIInnerHigh(5,180); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->HueSaturationIntensity( m_ltRasView.GetRaster(), nHue, nSaturation, nIntensity ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageLightControl() { unsigned int uFlags, uLowerAvr, uAvrage, uUpperAvr; uLowerAvr = 80; uAvrage = 150; uUpperAvr = 210; uFlags = YUV_SPACE; theApp.m_pRasterProcess->PutLightLowerAvr(0,80); theApp.m_pRasterProcess->PutLightAvr(0, 150); theApp.m_pRasterProcess->PutLightUpperAvr(0,210); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->LightControl( m_ltRasView.GetRaster(), uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageMath() { unsigned int uFactor; uFactor = 100; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->MathFunction( m_ltRasView.GetRaster(), MF_SQR, uFactor ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageRepclr() { int nHue, nSaturation, nBrightness; nHue = 100; nSaturation = 0; nBrightness = 250; theApp.m_pRasterProcess->ReplaceColorsCount = 1; theApp.m_pRasterProcess->PutReplaceColorValue(0,RGB(0, 0, 0)); theApp.m_pRasterProcess->PutReplaceColorFuzziness(0,100); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->ColorReplace ( m_ltRasView.GetRaster(), nHue, nSaturation, nBrightness ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageSampleTarget() { unsigned int uFlags; COLORREF crSample, crTarget; crSample = RGB(50,50,50); crTarget = RGB(100,100,100); uFlags = SAMP_RGB| SAMP_MID; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->SampleTarget( m_ltRasView.GetRaster(), crSample, crTarget, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageSelectivecolor() { theApp.m_pRasterProcess->PutSelectiveColorCyan(0,-100); theApp.m_pRasterProcess->PutSelectiveColorMagenta(0,0); theApp.m_pRasterProcess->PutSelectiveColorYellow(0,0); theApp.m_pRasterProcess->PutSelectiveColorBlack(0,0); theApp.m_pRasterProcess->PutSelectiveColorCyan(1,34); theApp.m_pRasterProcess->PutSelectiveColorMagenta(1,0); theApp.m_pRasterProcess->PutSelectiveColorYellow(1,100); theApp.m_pRasterProcess->PutSelectiveColorBlack(1,40); theApp.m_pRasterProcess->PutSelectiveColorCyan(2,0); theApp.m_pRasterProcess->PutSelectiveColorMagenta(2,100); theApp.m_pRasterProcess->PutSelectiveColorYellow(2,0); theApp.m_pRasterProcess->PutSelectiveColorBlack(2,0); theApp.m_pRasterProcess->PutSelectiveColorCyan(3,0); theApp.m_pRasterProcess->PutSelectiveColorMagenta(3,0); theApp.m_pRasterProcess->PutSelectiveColorYellow(3,0); theApp.m_pRasterProcess->PutSelectiveColorBlack(3,0); theApp.m_pRasterProcess->PutSelectiveColorCyan(4,0); theApp.m_pRasterProcess->PutSelectiveColorMagenta(4,0); theApp.m_pRasterProcess->PutSelectiveColorYellow(4,0); theApp.m_pRasterProcess->PutSelectiveColorBlack(4,0); theApp.m_pRasterProcess->PutSelectiveColorCyan(5,0); theApp.m_pRasterProcess->PutSelectiveColorMagenta(5,0); theApp.m_pRasterProcess->PutSelectiveColorYellow(5,0); theApp.m_pRasterProcess->PutSelectiveColorBlack(5,0); theApp.m_pRasterProcess->PutSelectiveColorCyan(6,0); theApp.m_pRasterProcess->PutSelectiveColorMagenta(6,0); theApp.m_pRasterProcess->PutSelectiveColorYellow(6,0); theApp.m_pRasterProcess->PutSelectiveColorBlack(6,0); theApp.m_pRasterProcess->PutSelectiveColorCyan(6,0); theApp.m_pRasterProcess->PutSelectiveColorMagenta(6,0); theApp.m_pRasterProcess->PutSelectiveColorYellow(6,0); theApp.m_pRasterProcess->PutSelectiveColorBlack(6,0); theApp.m_pRasterProcess->PutSelectiveColorCyan(7,-65); theApp.m_pRasterProcess->PutSelectiveColorMagenta(7,-39); theApp.m_pRasterProcess->PutSelectiveColorYellow(7,63); theApp.m_pRasterProcess->PutSelectiveColorBlack(7,0); theApp.m_pRasterProcess->PutSelectiveColorCyan(8,0); theApp.m_pRasterProcess->PutSelectiveColorMagenta(8,0); theApp.m_pRasterProcess->PutSelectiveColorYellow(8,0); theApp.m_pRasterProcess->PutSelectiveColorBlack(8,0); if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->SelectiveColor(m_ltRasView.GetRaster()); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnColorSwapcolor() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->SwapColors( m_ltRasView.GetRaster(), SWAP_RB ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageAce() { unsigned int uFlag, uDim, uAmount; uDim = 9; uAmount = 255; uFlag = ADAPTIVE_EXP; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->AdaptiveContrast( m_ltRasView.GetRaster(), uDim, uAmount, uFlag ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageHistogramequalize() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->HistoEqualize( m_ltRasView.GetRaster(), YUV_SPACE ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageLocalhisto() { int nWidth, nHeight, nxExt, nyExt; unsigned int uType, uSmooth; nWidth = (int) m_ltRasView.GetRaster().GetBitmapWidth(); nHeight = (int) m_ltRasView.GetRaster().GetBitmapHeight(); nxExt = 0; nyExt = 0; uType = YUV_SPACE; uSmooth = 0; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->LocalHistoEqualize( m_ltRasView.GetRaster(), nWidth, nHeight, nxExt, nyExt, uType, uSmooth ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageRemaphue() { int i; int nHueGreen; int nHueNewColor; int nHueChange; OLE_COLOR crNewColor; int iCount; unsigned int uLutLen; if((m_ltRasView.GetRaster ().GetBitmapBits () == 16 && m_ltRasView.GetRaster().GetIsGrayscale()) || m_ltRasView.GetRaster().GetBitmapBits() == 64 || m_ltRasView.GetRaster().GetBitmapBits() == 48) uLutLen = 65536; else if(m_ltRasView.GetRaster().GetBitmapBits() == 12) uLutLen = 4096; else uLutLen = 256; theApp.m_pRasterProcess->RemapHueTablesSize = uLutLen; for (i=0; i< theApp.m_pRasterProcess->RemapHueTablesSize; i++) { theApp.m_pRasterProcess->PutMaskTable (i,1); theApp.m_pRasterProcess->PutHTable (i,(unsigned int)rand () % uLutLen); } //Get the hue for green nHueGreen = theApp.m_pRasterProcess->HSV_HfromRGB(RGB(0, 255, 0)); //Obtain new hue (crNewColor can be any color) crNewColor = RGB(255, 255, 0); nHueNewColor = theApp.m_pRasterProcess->HSV_HfromRGB (crNewColor); nHueChange = nHueNewColor - nHueGreen; if (nHueChange < 0) nHueChange = nHueChange + 256; //Set values in uHueTable, uMaskTable theApp.m_pRasterProcess->PutHTable(nHueGreen, ADD(theApp.m_pRasterProcess->GetHTable(nHueGreen), nHueChange,uLutLen) ); theApp.m_pRasterProcess->PutMaskTable(nHueGreen, 1); //set the hues near green (+/- 10) iCount = 0; i = INCREMENT(nHueGreen,uLutLen); while (iCount < 10) { theApp.m_pRasterProcess->PutHTable(i, ADD(theApp.m_pRasterProcess->GetHTable(i), nHueChange,uLutLen) ); theApp.m_pRasterProcess->PutMaskTable(i, 1); i = INCREMENT(i,uLutLen); iCount++; } iCount = 0; i = DECREMENT(nHueGreen,uLutLen); while (iCount < 10) { theApp.m_pRasterProcess->PutHTable(i, ADD(theApp.m_pRasterProcess->GetHTable(i), nHueChange,uLutLen)); theApp.m_pRasterProcess->PutMaskTable(i, 1); i = DECREMENT(i,uLutLen); iCount = iCount + 1; } // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->RemapHue (m_ltRasView.GetRaster(), TRUE, TRUE, FALSE, FALSE); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageRemapintensity() { theApp.m_pRasterProcess->RemapTableSize = 256; theApp.m_pRasterProcess->PutRemapTable(0,255); theApp.m_pRasterProcess->PutRemapTable(255,0); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); theApp.m_pRasterProcess->GetFunctionalLookupTable( 0, 255, 0, GL_LINEAR); int nRet = theApp.m_pRasterProcess->RemapIntensity(m_ltRasView.GetRaster(), CHANNEL_MASTER); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageAutobinarysegment() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->AutoBinary(m_ltRasView.GetRaster()); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageColorthreshold() { for(int i = 0; i < 3; ++i) { theApp.m_pRasterProcess->PutComponentMinRange(i,128); theApp.m_pRasterProcess->PutComponentMaxRange(i,255); theApp.m_pRasterProcess->PutComponentFlags(i,0); } // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); /*Apply color Threshold effect on the image*/ int nRet = theApp.m_pRasterProcess->ColorThreshold( m_ltRasView.GetRaster(), CLTH_RGB_SPACE ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageDynamicthreshold() { unsigned int uDim, uLocalContast; uDim = 9; uLocalContast = 16; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->DynamicBinary( m_ltRasView.GetRaster(), uDim, uLocalContast ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageBinarysegment() { unsigned int uLow, uHigh, uChannel; COLORREF crInColor, crOutColor; uLow = 128; uHigh = 255; uChannel = RGB(0, 0, 0); crInColor = RGB(255, 255, 255); crOutColor = IDB_CHANNEL_MASTER; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->IntensityDetect( m_ltRasView.GetRaster(), uLow, uHigh, crInColor, crOutColor, uChannel ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageClrres() { int nBitsPerPixel; nBitsPerPixel = 8; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->ColorRes ( m_ltRasView.GetRaster(), nBitsPerPixel, CRP_FIXEDPALETTE, CRD_FLOYDSTEINDITHERING, 0 ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnColorColoredgray() { int nRedFact, nGreenFact, nBlueFact; int nRedGrayFact, nGreenGrayFact, nBlueGrayFact; nRedFact = 100; nGreenFact = 300; nBlueFact = 600; nRedGrayFact = 200; nGreenGrayFact = 300; nBlueGrayFact = 500; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->ConvertToColoredGray( m_ltRasView.GetRaster(), nRedFact, nGreenFact, nBlueFact, nRedGrayFact, nGreenGrayFact, nBlueGrayFact ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageDuotone() { int Curve[256]; COLORREF crColor =RGB(0, 255, 0); COLORREF crCurve; theApp.m_pRasterProcess->PutMultitoneColors(0,crColor); for (int i= 0; i < 256; i ++ ) { Curve[i]= i; } for ( i = 0; i < 256; i++) { crCurve= RGB((Curve[i] * GetRValue(crColor)) / 255, (Curve[i] * GetGValue(crColor)) / 255, (Curve[i] * GetBValue(crColor)) / 255 ); theApp.m_pRasterProcess->PutMultitoneGradient(0,i, crCurve ); } // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; theApp.m_pRasterProcess->Grayscale(m_ltRasView.GetRaster(), 8); BeginWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->GrayScaleToMultitone( m_ltRasView.GetRaster(), MONOTONE, USER, DT_REPLACE); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnColorConverttogray() { int nRedFact, nGreenFact, nBlueFact; nRedFact = 100; nGreenFact = 300; nBlueFact = 600; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); /* Apply Multitone conversion */ int nRet = theApp.m_pRasterProcess->GrayscaleExt( m_ltRasView.GetRaster(), nRedFact, nGreenFact, nBlueFact ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnColorHalftone() { int nAngle; unsigned int uDim, uType; uType = HT_PRINT; uDim = 3; nAngle = 4500; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); /* Apply Multitone conversion */ int nRet = theApp.m_pRasterProcess->HalfTone( m_ltRasView.GetRaster(), uType, nAngle, uDim ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageShadow() { unsigned int uThreshold; uThreshold = 0; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->AddShadow( m_ltRasView.GetRaster(), SHADOW_E, uThreshold, SHADOW_CLR_RGB ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageMosaicTiles() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->MosaicTiles(m_ltRasView.GetRaster(), 50, 7, (long)(m_ltRasView.GetRaster().GetBitmapWidth()/5), (long)(m_ltRasView.GetRaster().GetBitmapHeight()/5), 0, 0, MSCT_CART | MSCT_SHADOWGRAY, SHADOW_E, 0, RGB(0,0,0), RGB(255, 255, 255)); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImagePerspective() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); theApp.m_pRasterProcess->PutPerspectivePointsX(0, (long)(m_ltRasView.GetRaster().GetBitmapWidth() * 3/9)); theApp.m_pRasterProcess->PutPerspectivePointsY(0, (long)(m_ltRasView.GetRaster().GetBitmapHeight()*1/12)); theApp.m_pRasterProcess->PutPerspectivePointsX(1, (long)(m_ltRasView.GetRaster().GetBitmapWidth()*3/4)); theApp.m_pRasterProcess->PutPerspectivePointsY(1, (long)(m_ltRasView.GetRaster().GetBitmapHeight()*2/12)); theApp.m_pRasterProcess->PutPerspectivePointsX(2, (long)(m_ltRasView.GetRaster().GetBitmapWidth()*2/10)); theApp.m_pRasterProcess->PutPerspectivePointsY(2, (long)(m_ltRasView.GetRaster().GetBitmapHeight()*8/10)); theApp.m_pRasterProcess->PutPerspectivePointsX(3, (long)(m_ltRasView.GetRaster().GetBitmapWidth()*10/11)); theApp.m_pRasterProcess->PutPerspectivePointsY(3, (long)(m_ltRasView.GetRaster().GetBitmapHeight()*7/10)); int nRet = theApp.m_pRasterProcess->Perspective(m_ltRasView.GetRaster(), RGB(255, 255, 255), PERSPECTIVE_IMAGE); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageRomanMosaic() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; int nRet = theApp.m_pRasterProcess->RomanMosaic(m_ltRasView.GetRaster(), 15, 15, 5, SHADOW_E, 0, RGB(0,0,0), RMN_RECT | RMN_SHADOWGRAY); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageZigZag() { int nXCenter, nYCenter; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; nXCenter = (int)(m_ltRasView.GetRaster().GetBitmapWidth() / 2); nYCenter = (int)(m_ltRasView.GetRaster().GetBitmapHeight() / 2); int nRet = theApp.m_pRasterProcess->ZigZag(m_ltRasView.GetRaster(), 50, 1000, 10, 0, nXCenter, nYCenter, 0, FILL_RPT | ZG_POND); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageColoredBalls() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); theApp.m_pRasterProcess->PutColoredBallsCount(7); theApp.m_pRasterProcess->PutColoredBall(0, RGB(230,50,50)); theApp.m_pRasterProcess->PutColoredBall(0, RGB(230,200,160)); theApp.m_pRasterProcess->PutColoredBall(0, RGB(255,255,128)); theApp.m_pRasterProcess->PutColoredBall(0, RGB(240,50,100)); theApp.m_pRasterProcess->PutColoredBall(0, RGB(255,255,180)); theApp.m_pRasterProcess->PutColoredBall(0, RGB(170,240,100)); theApp.m_pRasterProcess->PutColoredBall(0, RGB(255,255,255)); int nRet = theApp.m_pRasterProcess->ColoredBalls(m_ltRasView.GetRaster(), 1000, 25, 15, 4500, RGB(255,255,255), RGB(255,0,0), RGB(255,255,0), 64,10,100, CLRBALLS_SHADING_CIRCULAR | CLRBALLS_STICKER | CLRBALLS_IMAGE | CLRBALLS_BALLCLR_OPACITY); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImagePointillist() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); int nRet = theApp.m_pRasterProcess->Pointillist(m_ltRasView.GetRaster(), 25, RGB(255, 255, 255), 0x0022 /*POINTILLIST_COLOR | POINTILLIST_POINT*/); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageColoredPencil() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); int nRet = theApp.m_pRasterProcess->ColoredPencil(m_ltRasView.GetRaster(), 50, 3); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageDisplacment() { ILEADRaster * pRaster; theApp.m_pRasterFileDlg->PutFilter(""); theApp.m_pRasterFileDlg->PutFileDlgFlags(0); theApp.m_pRasterFileDlg->PutFileName(""); theApp.m_pRasterFileDlg->PutDialogTitle("Open File"); theApp.m_pRasterFileDlg->PutUIFlags( OPEN_SHOW_PREVIEW | OPEN_SHOW_FILEINFO | OPEN_SHOW_LOADCOMPRESSED | OPEN_SHOW_LOADROTATED | OPEN_VIEWTOTALPAGES ); int nRet = theApp.m_pRasterFileDlg->ShowOpenDlg((long)theApp.m_pMainWnd->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { pRaster = NULL; HRESULT hr = theApp.CreateRasterObjectLic(&pRaster); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER); return;} theApp.m_pRasterIO->Load(pRaster, theApp.m_pRasterFileDlg->GetFileName(), 0, 1, 1); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); nRet = theApp.m_pRasterProcess->DisplaceMap(m_ltRasView.GetRaster(), pRaster, 5, 5, RGB(0,0,0), FILL_CLR | DSPL_TILE); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } if(pRaster) pRaster->Release(); } void CIMGPFView::OnImagePerlinNoise() { int nXCircle, nYCircle; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); nXCircle = (int)(m_ltRasView.GetRaster().GetBitmapWidth() / 2); nYCircle = (int)(m_ltRasView.GetRaster().GetBitmapHeight() / 2); int nRet = theApp.m_pRasterProcess->Perlin(m_ltRasView.GetRaster(), 0, 10, 8, 50, RGB(0,0,0), RGB(255, 0, 0), nXCircle, nYCircle, 4, 20, PRL_PURE | PRL_CIRCLE); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageFragment() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); int nRet = theApp.m_pRasterProcess->Fragment(m_ltRasView.GetRaster(), 15, 100); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImagePlasma() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); int nRet = theApp.m_pRasterProcess->PlasmaFilter(m_ltRasView.GetRaster(), 0, 0, 0, 50, 0, 30, PLSTYP_DIAGONAL | PLSCLR_RGB2); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageVignnet() { int nXCenter, nYCenter; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); nXCenter = (int)(m_ltRasView.GetRaster().GetBitmapWidth() / 2); nYCenter = (int)(m_ltRasView.GetRaster().GetBitmapHeight() / 2); int nRet = theApp.m_pRasterProcess->Vignette(m_ltRasView.GetRaster(), nXCenter, nYCenter, 50, 100, nXCenter, nYCenter, RGB(0,0,255), VIG_ELLIPSE | VIG_FILLIN); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageBricksTexture() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); int nRet = theApp.m_pRasterProcess->BricksTexture(m_ltRasView.GetRaster(), 60, 20, 0, 0, 3, 4, 315, 33, 20, 0, 10, 0, 0, BRICKS_SMOOTHEDOUT); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageCanvas() { int nRet = 0; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; ILEADRaster* pTmpRaster= NULL; CoCreateInstance(CLSID_LEADRaster, NULL, CLSCTX_ALL, IID_ILEADRaster, (void**)&pTmpRaster); ILEADRasterIO* pRasterIO= NULL; CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL, IID_ILEADRasterIO, (void**)&pRasterIO); theApp.m_pRasterFileDlg->PutFilter(""); theApp.m_pRasterFileDlg->PutFileDlgFlags(0); theApp.m_pRasterFileDlg->PutFileName(""); theApp.m_pRasterFileDlg->PutDialogTitle("Open File"); theApp.m_pRasterFileDlg->PutUIFlags( OPEN_SHOW_PREVIEW | OPEN_SHOW_FILEINFO | OPEN_SHOW_LOADCOMPRESSED | OPEN_SHOW_LOADROTATED | OPEN_VIEWTOTALPAGES ); nRet = theApp.m_pRasterFileDlg->ShowOpenDlg((long)theApp.m_pMainWnd->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { pRasterIO->Load(pTmpRaster, theApp.m_pRasterFileDlg->GetFileName(), 0, 0, 1); BeginWaitCursor(); nRet = theApp.m_pRasterProcess->Canvas(m_ltRasView.GetRaster(), pTmpRaster, 100, 100, 0, 0, 10, CANVAS_SHIFT); EndWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); } pTmpRaster->Release(); pRasterIO->Release(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageClouds() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); int nRet = theApp.m_pRasterProcess->Clouds(m_ltRasView.GetRaster(), 1000, 4, 10, 10, RGB(255, 255, 255), RGB(0,0,0), CLD_DIFFERENCE); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageDeskewExt() { CString strMsg; long iAngle = 0; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); int nRet = theApp.m_pRasterProcess->DeskewExt(m_ltRasView.GetRaster(), 1000, 2, 0, DSKW_PROCESS | DSKW_NOFILL| DSKW_LINEAR | DSKW_DOCUMENTIMAGE); strMsg.Format(TEXT("Rotation: %d hundredths of degrees"), iAngle); MessageBox(strMsg); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageCorrelationList() { ILEADRaster * pRaster1, * pRaster2; ILEADRaster *pRasterList = NULL; int nRet; HRESULT hr = theApp.CreateRasterObjectLic(&pRaster1); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER); return;} hr = theApp.CreateRasterObjectLic(&pRaster2); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER); return;} hr = theApp.CreateRasterObjectLic(&pRasterList); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER); return;} CString csFileName; csFileName.Format(TEXT("%s\\LetterA.cmp"), theApp.m_csImagesPath); theApp.m_pRasterIO->Load(pRaster1, csFileName.AllocSysString(), 0, 1, 1); csFileName.Format(TEXT("%s\\LetterR.cmp"), theApp.m_csImagesPath); theApp.m_pRasterIO->Load(pRaster2, csFileName.AllocSysString(), 0, 1, 1); // Load the original bitmap if ( LoadOriginalBitmap() != 0 ) return; pRasterList->InsertBitmapListItem(-1, pRaster1->GetBitmap()); pRasterList->InsertBitmapListItem(-1, pRaster2->GetBitmap()); BeginWaitCursor(); m_ltRasView.SetRgnFrameType(RGNFRAME_ANIMATED); theApp.m_pRasterProcess->CorrelationListMaxPoints = 50; nRet = theApp.m_pRasterProcess->CorrelationListExt(m_ltRasView.GetRaster(),1, 1, 90, pRasterList); int nNumOfPoints = theApp.m_pRasterProcess->CorrelationListCount; if (nRet == 0 && nNumOfPoints) { for(int i = 0; i < nNumOfPoints; i++) { float x = (float)theApp.m_pRasterProcess->GetCorrelationListX(i); float y = (float)theApp.m_pRasterProcess->GetCorrelationListY(i); if(i) { m_ltRasView.GetRaster().SetRgnRect(x, y, pRaster1->GetBitmapWidth(), pRaster1->GetBitmapHeight(), L_RGN_OR); } else { m_ltRasView.GetRaster().SetRgnRect(x, y, pRaster1->GetBitmapWidth(), pRaster1->GetBitmapHeight(), L_RGN_SET); } } } EndWaitCursor(); pRasterList->Release(); pRaster1->Release(); pRaster2->Release(); } void CIMGPFView::OnImageEmbossExt() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); int nRet = theApp.m_pRasterProcess->MaskConvolution(m_ltRasView.GetRaster(), 500, 45, 3, MSKC_EMBOSS); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnColorAdjustTint() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); int nRet = theApp.m_pRasterProcess->AdjustTint(m_ltRasView.GetRaster(), -6500, 2000); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); } void CIMGPFView::OnColorGammaCorrect() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); int nRet = theApp.m_pRasterProcess->GammaCorrectExt(m_ltRasView.GetRaster(), 250, GMCR_YUV_SPACE); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnColorColoredHalfTone() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); int nRet = theApp.m_pRasterProcess->ColorHalfTone(m_ltRasView.GetRaster(), 15, 10800, 16200, 9000, 4500); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnColorHalfTonePattern() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); int nRet = theApp.m_pRasterProcess->HalfTonePattern(m_ltRasView.GetRaster(), 100, 200, 12, 2, 4500, RGB(255, 255, 255), RGB(255, 0, 0), HTPATTERN_LINE); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnColorHighPassFilter() { // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); int nRet = theApp.m_pRasterProcess->HighPassFilter(m_ltRasView.GetRaster(), 10, 100); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageOffset() { int nHShift, nVShift; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); nHShift = (int)(m_ltRasView.GetRaster().GetBitmapWidth() / 2); nVShift = (int)(m_ltRasView.GetRaster().GetBitmapHeight() / 2); int nRet = theApp.m_pRasterProcess->Offset(m_ltRasView.GetRaster(), nHShift, nVShift, 0, OFFSET_FILL_WRAP); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageBnd() { int nValue; COLORREF crFill; unsigned int uFlags,CenterX, CenterY; nValue = -100; CenterX = (int) m_ltRasView.GetRaster().GetBitmapWidth()/2; CenterY = (int) m_ltRasView.GetRaster().GetBitmapHeight()/2; crFill = RGB(0,0,0); uFlags = BND_NORM | FILL_CLR| FILL_WOUTROT; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Bending( m_ltRasView.GetRaster(), nValue, CenterX, CenterY, crFill, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageBump() { int nAzimuth, nElevation, nDepth, nXOffset, nYOffset, nXDst, nYDst, nBright, nIntensity; BOOL bTile; nAzimuth = 0; nElevation = 10; nDepth = 1; nXOffset = 0; nYOffset = 0; nXDst = 0; nYDst = 0; bTile = FALSE; nBright = 0; nIntensity = 0; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->BumpMap( m_ltRasView.GetRaster(), m_ltRasView.GetRaster(), nAzimuth, nElevation, nDepth, nXOffset, nYOffset, nXDst, nYDst, bTile, nBright, nIntensity ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageCylender() { int nValue; nValue = 50; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Cylindrical( m_ltRasView.GetRaster(), nValue, CYL_HORZ ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageFreePlaneBend() { unsigned int uScale, uFlags; COLORREF crFill; int nRet = 0; uScale = 50; crFill = RGB(255,0,0); uFlags = FPB_VERT | FILL_CLR; /* Applay the filter*/ theApp.m_pRasterProcess->PutUserLUTCurveSize(4); theApp.m_pRasterProcess->PutUserLUTCurveX(0,0); theApp.m_pRasterProcess->PutUserLUTCurveY(0,0); theApp.m_pRasterProcess->PutUserLUTCurveX(1,3); theApp.m_pRasterProcess->PutUserLUTCurveY(1,10); theApp.m_pRasterProcess->PutUserLUTCurveX(2,9); theApp.m_pRasterProcess->PutUserLUTCurveY(2,-10); theApp.m_pRasterProcess->PutUserLUTCurveX(3,12); theApp.m_pRasterProcess->PutUserLUTCurveY(3,0); nRet = theApp.m_pRasterProcess->GetCurvePoints(GUB_LINEAR); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); nRet = theApp.m_pRasterProcess->FreePlaneBend( m_ltRasView.GetRaster() , uScale, crFill, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageFreeRadBend() { unsigned int uScale, uFlags, CenterX, CenterY; COLORREF crFill; int nRet; uScale = 50; crFill = RGB(255,0,0); CenterX = (int) (m_ltRasView.GetRaster().GetBitmapWidth() / 2); CenterY = (int) (m_ltRasView.GetRaster().GetBitmapHeight() / 2); uFlags = FILL_CLR | FILL_ROT; /* Applay the filter*/ theApp.m_pRasterProcess->PutUserLUTCurveSize(4); theApp.m_pRasterProcess->PutUserLUTCurveX(0,0); theApp.m_pRasterProcess->PutUserLUTCurveY(0,0); theApp.m_pRasterProcess->PutUserLUTCurveX(1,3); theApp.m_pRasterProcess->PutUserLUTCurveY(1,10); theApp.m_pRasterProcess->PutUserLUTCurveX(2,9); theApp.m_pRasterProcess->PutUserLUTCurveY(2,-10); theApp.m_pRasterProcess->PutUserLUTCurveX(3,12); theApp.m_pRasterProcess->PutUserLUTCurveY(3,0); nRet = theApp.m_pRasterProcess->GetCurvePoints(GUB_LINEAR); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); nRet = theApp.m_pRasterProcess->FreeRadBend( m_ltRasView.GetRaster() , uScale, CenterX, CenterY, crFill, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImagePinch() { int nValue,CenterX,CenterY; unsigned int uStress, uFlags; COLORREF crFill; nValue = -50; uStress = 1; CenterX = (int) (m_ltRasView.GetRaster().GetBitmapWidth() / 2); CenterY = (int) (m_ltRasView.GetRaster().GetBitmapHeight() / 2); crFill = RGB(0,0,0); uFlags = FILL_NOCHG | FILL_WOUTROT; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Punch( m_ltRasView.GetRaster(), nValue, uStress, CenterX, CenterY, crFill, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImagePlane() { int nRepeat, nPydAngle, nDistance; unsigned int uFlags, uZValue, uPlaneOffset, uStretch, uStartBright, uEndBright, uBrightLength; int CenterX, CenterY; COLORREF crFill, crBright; uZValue = 0; nDistance = (int) (m_ltRasView.GetRaster().GetBitmapHeight()/2); uPlaneOffset = (int) (m_ltRasView.GetRaster().GetBitmapHeight()/2); nRepeat = -1; nPydAngle = 0; uStretch = 100; uStartBright = 0; uEndBright = 100; uBrightLength = 50; CenterX = (int) (m_ltRasView.GetRaster().GetBitmapWidth()/2); CenterY = (int) (m_ltRasView.GetRaster().GetBitmapHeight()/2); crFill = RGB(255,255,255); crBright = RGB(255,255,255); uFlags = PLANE_FILL_CLR| PLANE_LEFT| PLANE_RIGHT| PLANE_UP| PLANE_DOWN; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Plane ( m_ltRasView.GetRaster(), CenterX, CenterY, uZValue, nDistance, uPlaneOffset, nRepeat, nPydAngle, uStretch, uStartBright, uEndBright, uBrightLength, crBright, crFill, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImagePlaneBend() { int nRepeat, nPydAngle, nDistance; unsigned int uFlags, uZValue, uBendFactor, uPlaneOffset, uStretch, uStartBright, uEndBright, uBrightLength; int CenterX, CenterY; COLORREF crFill, crBright; uZValue = 0; nDistance = (int) (m_ltRasView.GetRaster().GetBitmapHeight()/2); uPlaneOffset = (int) (m_ltRasView.GetRaster().GetBitmapHeight()/2); nRepeat = -1; nPydAngle = 0; uStretch = 75; uBendFactor = 300; uStartBright = 0; uEndBright = 0; uBrightLength = 50; CenterX = (int) (m_ltRasView.GetRaster().GetBitmapWidth()/2); CenterY = (int) (m_ltRasView.GetRaster().GetBitmapHeight()/2); crFill = RGB(255,255,255); crBright = RGB(0,0,0); uFlags = PLANE_FILL_CLR| PLANE_DOWN; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->PlaneBend( m_ltRasView.GetRaster(), CenterX, CenterY, uZValue, nDistance, uPlaneOffset, nRepeat, nPydAngle, uStretch, uBendFactor, uStartBright, uEndBright, uBrightLength, crBright, crFill, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageReveffect() { unsigned int uLineSpace, uMaximumHeight; uLineSpace = 7; uMaximumHeight = 35; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->RevEffect(m_ltRasView.GetRaster(), uLineSpace, uMaximumHeight ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageRippel() { int nPhase; unsigned int uAmplitude, uFrequency, uAttenuation, uFlags; int CenterX,CenterY; COLORREF crFill; uAmplitude = 30; uFrequency = 6; nPhase = 0; uAttenuation = 0; CenterX = (int) (m_ltRasView.GetRaster().GetBitmapWidth()/2); CenterY = (int) (m_ltRasView.GetRaster().GetBitmapHeight()/2); crFill = RGB(0,0,0); uFlags = FILL_NOCHG; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Ripple( m_ltRasView.GetRaster(), uAmplitude, uFrequency, nPhase, uAttenuation, CenterX, CenterY, crFill, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageSphere() { int nValue; unsigned int uFlags; int CenterX,CenterY; COLORREF crFill; nValue = 50; CenterX = (int) (m_ltRasView.GetRaster().GetBitmapWidth()/2); CenterY = (int) (m_ltRasView.GetRaster().GetBitmapHeight()/2); crFill = RGB(0,0,0); uFlags = FILL_CLR | FILL_WOUTROT; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Spherize( m_ltRasView.GetRaster(), nValue, CenterX, CenterY, crFill, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageTunnel() { int nDistance, nRepeat, nRotationOffset; unsigned int uFlags, uZValue, uRad, uStretch, uStartBright, uEndBright, uBrightLength; int CenterX,CenterY; COLORREF crFill, crBright; CenterX = (int) (m_ltRasView.GetRaster().GetBitmapWidth()/2); CenterY = (int) (m_ltRasView.GetRaster().GetBitmapHeight()/2); uZValue = 0; nDistance = (int) (m_ltRasView.GetRaster().GetBitmapHeight()/2); uRad = (int) (m_ltRasView.GetRaster().GetBitmapHeight()/2); nRepeat = -1; nRotationOffset = 0; uStretch = 75; uStartBright = 0; uEndBright = 0; uBrightLength = 50; crBright = RGB(255,255,255); crFill = RGB(255,255,255); uFlags = TUN_FILL_CLR| TUN_AXIS_WIDTH; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Tunnel( m_ltRasView.GetRaster(), CenterX, CenterY, uZValue, nDistance, uRad, nRepeat, nRotationOffset, uStretch, uStartBright, uEndBright, uBrightLength, crBright, crFill, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageCubismEffect() { int nBrightness, nAngle; unsigned int uSpace, uLength, uFlags; COLORREF crColor; uSpace = 90; uLength = 200; nBrightness = 0; nAngle = 0; crColor = RGB(0,0,0); uFlags = CUB_BKG| CUB_SQR| CUB_RAND; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Cubism( m_ltRasView.GetRaster(), uSpace, uLength, nBrightness, nAngle, crColor, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageDry() { unsigned int uDim; uDim = 3; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Dry( m_ltRasView.GetRaster(), uDim ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageImpress() { unsigned int uhHorzDim, uVertDim; uhHorzDim = 3; uVertDim = 3; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Impressionist( m_ltRasView.GetRaster(), uhHorzDim, uVertDim ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageAntialias() { unsigned int uThreshold, uDim; uThreshold = 0; uDim = 8; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->AntiAlias ( m_ltRasView.GetRaster(), uThreshold, uDim, ANTIALIAS_1 ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageGaussianblur() { int nRadius; nRadius = 50; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->GaussianFilter( m_ltRasView.GetRaster(), nRadius ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageMotionblur() { int nAngle; unsigned int uDim; BOOL bUnidirectional; uDim = 20; nAngle = 4500; bUnidirectional = FALSE; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->MotionBlur( m_ltRasView.GetRaster(), uDim, nAngle, bUnidirectional ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageMrad() { unsigned int uDim, uStress; int CenterX, CenterY; uDim = 25; uStress = 1; CenterX = (int) (m_ltRasView.GetRaster().GetBitmapWidth()/2); CenterY = (int) (m_ltRasView.GetRaster().GetBitmapHeight()/2); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->RadialBlur( m_ltRasView.GetRaster(), uDim, uStress, CenterX, CenterY ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageSmooth() { unsigned int nAmount, nThreshold; nAmount = 50; nThreshold = 0; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->SmoothEdges( m_ltRasView.GetRaster(), nAmount, nThreshold ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageMzoom() { unsigned int uDim, uStress; int CenterX, CenterY; uDim = 30; uStress = 1; CenterX = (int) (m_ltRasView.GetRaster().GetBitmapWidth()/2); CenterY = (int) (m_ltRasView.GetRaster().GetBitmapHeight()/2); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->ZoomBlur( m_ltRasView.GetRaster(), uDim, uStress, CenterX, CenterY ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageNum() { int nFactor; unsigned int uFlags; nFactor = 50; uFlags = 0; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->ApplyMathLogic( m_ltRasView.GetRaster(), nFactor, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageMultiply() { unsigned int uFactor; uFactor = 1000; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Multiply( m_ltRasView.GetRaster(), uFactor ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageHandwave() { int nAngle; unsigned int uScale, uWaveLen, uFlags; COLORREF crFill; theApp.m_pRasterProcess->PutUserLUTCurveSize(4); theApp.m_pRasterProcess->PutUserLUTCurveX(0,0); theApp.m_pRasterProcess->PutUserLUTCurveY(0,0); theApp.m_pRasterProcess->PutUserLUTCurveX(1,3); theApp.m_pRasterProcess->PutUserLUTCurveY(1,10); theApp.m_pRasterProcess->PutUserLUTCurveX(2,9); theApp.m_pRasterProcess->PutUserLUTCurveY(2,-10); theApp.m_pRasterProcess->PutUserLUTCurveX(3,12); theApp.m_pRasterProcess->PutUserLUTCurveY(3,0); int nRet = theApp.m_pRasterProcess->GetCurvePoints(GUB_LINEAR); if(nRet != 0) { theApp.DisplayLEADError(nRet); return; } uScale = 100; uWaveLen = 100; nAngle = 0; crFill = RGB (0,0,0); uFlags = FILL_RPT| DIS_PER; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); nRet = theApp.m_pRasterProcess->FreeHandWave( m_ltRasView.GetRaster(), uScale, uWaveLen, nAngle, crFill, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageOcean() { unsigned int uAmplitude, uFrequency; BOOL bLowerTrnsp; uAmplitude = 25; uFrequency = 20; bLowerTrnsp = FALSE; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Ocean( m_ltRasView.GetRaster(), uAmplitude, uFrequency, bLowerTrnsp ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImagePolar() { unsigned int uFlags; COLORREF crFill; crFill = RGB (0,0,0); uFlags = FILL_CLR| CART_TO_POL; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Polar( m_ltRasView.GetRaster(), crFill, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageWvrad() { int nPhase; unsigned int uFlags, uAmplitude, uWaveLen; int CenterX, CenterY; COLORREF crFill; uAmplitude = 50; uWaveLen = 100; nPhase = 0; CenterX = (int) (m_ltRasView.GetRaster().GetBitmapWidth()/2); CenterY = (int) (m_ltRasView.GetRaster().GetBitmapHeight()/2); crFill = RGB (0,0,0); uFlags = FILL_RPT | DIS_PER; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->RadWave( m_ltRasView.GetRaster(), uAmplitude, uWaveLen, nPhase, CenterX, CenterY, crFill, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageSpiral() { int nXOrigin, nYOrigin, nAngle; unsigned int uFlags, uRadius, uRingCount, uRandomize; double lValue1, lValue2; COLORREF crColor; lValue1 = pow (m_ltRasView.GetRaster().GetBitmapWidth(), 2); lValue2 = pow (m_ltRasView.GetRaster().GetBitmapHeight(), 2); nXOrigin = (int) (m_ltRasView.GetRaster().GetBitmapWidth()/2); nYOrigin = (int) (m_ltRasView.GetRaster().GetBitmapHeight()/2); uRadius = (unsigned int) pow( (lValue1 + lValue2), 0.5 ); uRingCount = (unsigned int) uRadius / 2; uRandomize = 0; nAngle = 200; crColor = RGB (0,0,0); uFlags = RING_MAXRADIUS | RING_FIXEDANGLE | RING_COLOR; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->RingEffect( m_ltRasView.GetRaster(), nXOrigin, nYOrigin, uRadius, uRingCount, uRandomize, crColor, nAngle, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageShear() { int nMax, i; unsigned int uFlags, uScale, uAmplitudesCount; COLORREF crFill; theApp.m_pRasterProcess->PutUserLUTCurveSize (4); theApp.m_pRasterProcess->PutUserLUTCurveX(0,0); theApp.m_pRasterProcess->PutUserLUTCurveY(0,0); theApp.m_pRasterProcess->PutUserLUTCurveX(1,3); theApp.m_pRasterProcess->PutUserLUTCurveY(1,10); theApp.m_pRasterProcess->PutUserLUTCurveX(2,9); theApp.m_pRasterProcess->PutUserLUTCurveY(2,-10); theApp.m_pRasterProcess->PutUserLUTCurveX(3,12); theApp.m_pRasterProcess->PutUserLUTCurveY(3,0); int nRet = theApp.m_pRasterProcess->GetCurvePoints(GUB_LINEAR); if(nRet != 0) { theApp.DisplayLEADError(nRet); return; } /*Normalize pAmplitudes (maximum value in pAmplitudes is 1000 and lower is -1000)*/ nMax = 0; for(i = 0; i < theApp.m_pRasterProcess->GetAmplitudesCount(); i++) { if(nMax < theApp.m_pRasterProcess->GetAmplitudes(i)) nMax = theApp.m_pRasterProcess->GetAmplitudes(i); } if(nMax) { for(i = 0; i < theApp.m_pRasterProcess->GetAmplitudesCount(); i++) { int aAmplitudes = theApp.m_pRasterProcess->GetAmplitudes(i); aAmplitudes = (1000 * aAmplitudes / abs(nMax)); theApp.m_pRasterProcess->PutAmplitudes(i, aAmplitudes); } } uScale = 50; uAmplitudesCount = theApp.m_pRasterProcess->GetAmplitudesCount() ; crFill = RGB (0,0,0); uFlags = FILL_CLR | SHR_VERT; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); nRet = theApp.m_pRasterProcess->FreeHandShear( m_ltRasView.GetRaster(), uScale, crFill, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageSwirl() { int nRotationAngle; int CenterX, CenterY; nRotationAngle = 50; CenterX = (int) (m_ltRasView.GetRaster().GetBitmapWidth()/2); CenterY = (int) (m_ltRasView.GetRaster().GetBitmapHeight()/2); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Swirl( m_ltRasView.GetRaster(), nRotationAngle, CenterX, CenterY ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageWave() { int nAngle; unsigned int uAmplitude, uWaveLen, uFlags, uHorzFact, uVertFact; COLORREF crFill; uAmplitude = (LONG)(m_ltRasView.GetRaster().GetBitmapWidth() * 0.04); uWaveLen = 15; nAngle = 0; uHorzFact = 100; uVertFact = 100; uFlags = FILL_CLR | DIS_PER | WV_SIN; crFill = RGB(0,0,0); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Wave( m_ltRasView.GetRaster(), uAmplitude, uWaveLen, nAngle, uHorzFact, uVertFact, crFill, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageWind() { int nAngle; unsigned int uDim, uOpacity; uDim = 5; uOpacity = 0; nAngle = 0; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Wind( m_ltRasView.GetRaster(), uDim, nAngle, uOpacity ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageWavezoom() { int nPhase; unsigned int uAmplitude, uFrequency, uFlags, uZoomFact; int CenterX,CenterY; COLORREF crFill; uAmplitude = (LONG)(m_ltRasView.GetRaster().GetBitmapWidth()* 0.04); uFrequency = 25; nPhase = 0; uZoomFact = 0; CenterX = (LONG)(m_ltRasView.GetRaster().GetBitmapWidth() * 0.5); CenterY = (LONG)(m_ltRasView.GetRaster().GetBitmapHeight() * 0.5); crFill = RGB(0,0,0); uFlags = FILL_CLR; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->ZoomWave( m_ltRasView.GetRaster(), uAmplitude, uFrequency, nPhase, uZoomFact, CenterX, CenterY, crFill, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageFindedges() { unsigned int uLevel, uThreshold; uLevel = 50; uThreshold = 0; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->EdgeDetectEffect( m_ltRasView.GetRaster(), uLevel, uThreshold, EDGE_SOFT ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageEdgedetection() { unsigned int uThreshold; uThreshold = 60; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->EdgeDetector( m_ltRasView.GetRaster(), uThreshold, EDG_SOBEL_ALL ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageGlow() { unsigned int uDim, uBright, uThreshold; uDim = 3; uBright = 1; uThreshold = 0; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->GlowFilter( m_ltRasView.GetRaster(), uDim, uBright, uThreshold ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageComsts() { unsigned int uDim, uThreshold; COLORREF crEdgeColor, crBkColor; uDim = 3; uThreshold = 0; crEdgeColor = RGB(255,255,255); crBkColor = RGB(0,0,0); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->EdgeDetectStatistical ( m_ltRasView.GetRaster(), uDim, uThreshold, crEdgeColor, crBkColor ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageStatis() { int nAngle; unsigned int uDim, uThreshold; COLORREF crEdgeColor, crBkColor; uDim = 15; uThreshold = 128; nAngle = 4500; crEdgeColor = RGB(255,255,255); crBkColor = RGB(0,0,0); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->DirectionEdgeStatistical ( m_ltRasView.GetRaster(), uDim, uThreshold, nAngle, crEdgeColor, crBkColor ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); } void CIMGPFView::OnImageFademask() { int nRet; int nXDst, nYDst, nWidth, nHeight; ILEADRaster * pRaster, * pRasterMsk; HRESULT hr; theApp.m_pRasterFileDlg->PutFilter(""); theApp.m_pRasterFileDlg->PutFileDlgFlags(0); theApp.m_pRasterFileDlg->PutFileName(""); theApp.m_pRasterFileDlg->PutDialogTitle("Open File"); theApp.m_pRasterFileDlg->PutUIFlags( OPEN_SHOW_PREVIEW | OPEN_SHOW_FILEINFO | OPEN_SHOW_LOADCOMPRESSED | OPEN_SHOW_LOADROTATED | OPEN_VIEWTOTALPAGES ); nRet = theApp.m_pRasterFileDlg->ShowOpenDlg((long)theApp.m_pMainWnd->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { pRaster = NULL; hr = theApp.CreateRasterObjectLic(&pRaster); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER); return;} theApp.m_pRasterIO->Load(pRaster, theApp.m_pRasterFileDlg->GetFileName(), 0, 1, 1); theApp.m_pRasterProcess->Size( pRaster, 2 * m_ltRasView.GetRaster().GetBitmapWidth() / 3, 2 * m_ltRasView.GetRaster().GetBitmapHeight() / 3, RESIZE_RESAMPLE ); nXDst = (int)(m_ltRasView.GetRaster().GetBitmapWidth() / 6); nYDst = (int)(m_ltRasView.GetRaster().GetBitmapHeight() / 6); nWidth = (int)pRaster->GetBitmapWidth(); nHeight = (int)pRaster->GetBitmapHeight(); pRaster->SetRgnRect ( 0, 0, (float)nWidth, (float)nHeight, L_RGN_SET); pRasterMsk = NULL; hr = theApp.CreateRasterObjectLic(&pRasterMsk); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER); return;} // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); nRet = theApp.m_pRasterProcess->CreateFadedMask( pRasterMsk, pRaster, (int) (min(pRaster->GetBitmapWidth() / 3, pRaster->GetBitmapHeight() / 3)), 15, 3, 0, (FadedMaskConstants)(FADE_DUMPFILL | FADE_NOTRANSPARENCY), 255, RGB(0, 0, 255)); if(nRet != 0) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); pRaster->Release(); pRasterMsk->Release(); return; } nRet = theApp.m_pRasterProcess->FeatherAlphaBlend( m_ltRasView.GetRaster() , (float)nXDst, (float)nYDst, (float)nWidth, (float)nHeight, pRaster, 0, 0, pRasterMsk); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); pRaster->Release(); pRasterMsk->Release(); } theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageOpacity() { ILEADRaster * pRaster; int nRet; HRESULT hr; theApp.m_pRasterFileDlg->PutFilter(""); theApp.m_pRasterFileDlg->PutFileDlgFlags(0); theApp.m_pRasterFileDlg->PutFileName(""); theApp.m_pRasterFileDlg->PutDialogTitle("Open File"); theApp.m_pRasterFileDlg->PutUIFlags( OPEN_SHOW_PREVIEW | OPEN_SHOW_FILEINFO | OPEN_SHOW_LOADCOMPRESSED | OPEN_SHOW_LOADROTATED | OPEN_VIEWTOTALPAGES ); nRet = theApp.m_pRasterFileDlg->ShowOpenDlg((long)theApp.m_pMainWnd->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { pRaster = NULL; hr = theApp.CreateRasterObjectLic(&pRaster); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER); return;} theApp.m_pRasterIO->Load(pRaster, theApp.m_pRasterFileDlg->GetFileName(), 0, 1, 1); theApp.m_pRasterProcess->Size( pRaster, 2 * m_ltRasView.GetRaster().GetBitmapWidth() / 3, 2 * m_ltRasView.GetRaster().GetBitmapHeight() / 3, RESIZE_RESAMPLE ); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->AlphaBlend( m_ltRasView.GetRaster() , m_ltRasView.GetRaster().GetBitmapWidth() / 6, m_ltRasView.GetRaster().GetBitmapHeight() / 6, pRaster->GetBitmapWidth(), pRaster->GetBitmapHeight(), pRaster, 0, 0, 150 ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); pRaster->Release(); } theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageAging() { unsigned int uHScratchCount, uVScratchCount, uMaxScratchLen, uDustDensity; unsigned int uPitsDensity, uMaxPitSize, uFlags; COLORREF crScratch, crDust, crPits; uHScratchCount = 10; uVScratchCount = 10; uMaxScratchLen = 50; uDustDensity = 10; uPitsDensity = 5; uMaxPitSize = 5; crScratch = RGB(0,0,0); crDust = RGB(0,0,0); crPits = RGB(0,0,0); uFlags = 0; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Aging( m_ltRasView.GetRaster(), uHScratchCount, uVScratchCount, uMaxScratchLen, uDustDensity, uPitsDensity, uMaxPitSize, crScratch, crDust, crPits, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageDeinterlace() { unsigned int uFlags; uFlags = DEINTERLACE_SMOOTH | DEINTERLACE_ODD; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Deinterlace( m_ltRasView.GetRaster(), uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageMax() { unsigned int uDim; uDim = 3; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->MaxFilter( m_ltRasView.GetRaster(), uDim ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageMedian() { unsigned int uDim; uDim = 3; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Median( m_ltRasView.GetRaster(), uDim ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageMin() { unsigned int uDim; uDim = 3; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->MinFilter( m_ltRasView.GetRaster(), uDim ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageDice() { unsigned int uXBlock, uYBlock, uRandomize, uFlags; COLORREF crColor; uXBlock = (unsigned int) (m_ltRasView.GetRaster().GetBitmapWidth() / 2); uYBlock = (unsigned int) (m_ltRasView.GetRaster().GetBitmapHeight() / 2); uRandomize = 0; uFlags = DICE_SIZE; crColor = RGB(0, 0, 0); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->DiceEffect( m_ltRasView.GetRaster(), uXBlock, uYBlock, uRandomize, crColor, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageGlassEffect() { unsigned int uCellWidth, uCellHeight, uFlags; uCellWidth = 20; uCellHeight = 20; uFlags = GLASS_WFRQ | GLASS_HFRQ; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->GlassEffect( m_ltRasView.GetRaster(), uCellWidth, uCellHeight, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImagePuzzle() { unsigned int uXBlock, uYBlock, uRandomize, uFlags; COLORREF crColor; uXBlock = (unsigned int) (m_ltRasView.GetRaster().GetBitmapWidth() / 8); uYBlock = (unsigned int) (m_ltRasView.GetRaster().GetBitmapHeight() / 8); uRandomize = 0; uFlags = BITMAP_RESIZE |PUZZLE_SHUFFLE | PUZZLE_SIZE; crColor = RGB(0, 0, 0); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->PuzzleEffect( m_ltRasView.GetRaster(), uXBlock, uYBlock, uRandomize, crColor, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImagePixelate() { unsigned int uCellWidth, uCellHeight, uFlags, uOpacity; unsigned int CenterX, CenterY; uCellWidth = 10; uCellHeight = 10; uOpacity = 100; CenterX = (unsigned int) (m_ltRasView.GetRaster().GetBitmapWidth() / 2); CenterY = (unsigned int) (m_ltRasView.GetRaster().GetBitmapHeight() / 2); uFlags = PIX_AVR | PIX_RECT | PIX_WPER | PIX_HPER; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Pixelate(m_ltRasView.GetRaster(), uCellWidth, uCellHeight, uOpacity, CenterX, CenterY, uFlags ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnFiltersPixelatePicturizeUsesameimage() { unsigned int uxDim, uyDim, uGammaFact; uxDim = 10; uyDim = 10; uGammaFact = 0; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->PicturizeSingle( m_ltRasView.GetRaster(), m_ltRasView.GetRaster(), uxDim, uyDim, uGammaFact ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnFiltersPixelatePicturizeUsemultiplebitmaps() { unsigned int uxDim, uyDim, uLightnessFact; uxDim = 20; uyDim = 15; uLightnessFact = 200; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->PicturizeBitmapList( m_ltRasView.GetRaster(), uxDim, uyDim, uLightnessFact, m_ltRasView.GetRaster() ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageLens() { unsigned int uBright; unsigned int CenterX, CenterY; COLORREF crColor; uBright = 100; CenterX = (unsigned int) (m_ltRasView.GetRaster().GetBitmapWidth() / 2); CenterY = (unsigned int) (m_ltRasView.GetRaster().GetBitmapHeight() / 2); crColor = RGB(0, 0, 0); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->LensFlare( m_ltRasView.GetRaster(), CenterX, CenterY, uBright, crColor, LNS_TYPE_1 ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageLight() { unsigned int CenterX, CenterY, uWidth, uHeight, uBright, uEdge, uOpacity, uLightNo, uImageBright, uAmbient; int nAngle; COLORREF crFill , crAmbient; CenterX = (unsigned int) (m_ltRasView.GetRaster().GetBitmapWidth() / 2); CenterY = (unsigned int) (m_ltRasView.GetRaster().GetBitmapHeight() / 2); uWidth = (unsigned int) (m_ltRasView.GetRaster().GetBitmapWidth() * .5); uHeight = (unsigned int) (m_ltRasView.GetRaster().GetBitmapHeight() * .25); nAngle = 0; uBright = 100; uEdge = 100; crFill = RGB(255,255,255); uOpacity = 100; uLightNo = 1; uImageBright = 100; uAmbient = 100; crAmbient = RGB(255,255,255); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Light ( m_ltRasView.GetRaster(), CenterX, CenterY, uWidth, uHeight, nAngle, uBright, uEdge, crFill, uOpacity, uLightNo, uImageBright, uAmbient, crAmbient, LGT_SPOTLIGHT); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageUnsharp() { int nAmount, nRadius, nThreshold; nAmount = 200; nRadius = 15; nThreshold = 50; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->UnsharpMask( m_ltRasView.GetRaster(), nAmount, nRadius, nThreshold, RGB_SPACE ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageConvmatrix() { theApp.m_pRasterProcess->UserFilterWidth = 3; theApp.m_pRasterProcess->UserFilterHeight = 3; theApp.m_pRasterProcess->UserFilterXCenter = 1; theApp.m_pRasterProcess->UserFilterYCenter = 1; theApp.m_pRasterProcess->UserFilterDivisor = 9; theApp.m_pRasterProcess->UserFilterOffset = 0; theApp.m_pRasterProcess->UserFilterFlags = UD_SUM; for(int i = 0; i < 3; i++) { for(int j = 0; j < 3; j++) { theApp.m_pRasterProcess->PutUserFilterData(i, j, 1); } } // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->UserFilter( m_ltRasView.GetRaster() ); m_ltRasView.ForceRepaint(); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageFft() { unsigned int uFlags; uFlags = FFT_FFT| FFT_GRAY; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->InitFourierTransformation(m_ltRasView.GetRaster()); if( nRet != 0 ) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); return; } nRet = theApp.m_pRasterProcess->FastFourierTransformation(m_ltRasView.GetRaster(),uFlags); if( nRet != 0 ) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); return; } // Change the array data to show effect on the image nRet = theApp.m_pRasterProcess->FrequencyFilterMask(m_ltRasView.GetRaster(), TRUE ); if( nRet != 0 ) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); return; } uFlags = FFT_IFFT| FFT_GRAY | FFT_IFFT_SCL | FFT_IFFT_BOTH; nRet = theApp.m_pRasterProcess->FastFourierTransformation( m_ltRasView.GetRaster() , uFlags ); if( nRet != 0 ) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); return; } nRet = theApp.m_pRasterProcess->FreeFourierTransformation(); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnUpdateImageFft(CCmdUI* pCmdUI) { int nNum, nShift; BOOL bEnable = FALSE; if(m_ltRasView.GetRaster().GetBitmap()) { nNum =(int) m_ltRasView.GetRaster().GetBitmapWidth(); nShift = (int)(log10(nNum) / log10(2)); if (((nNum >> nShift) << nShift) == nNum) { nNum =(int) m_ltRasView.GetRaster().GetBitmapHeight(); nShift = (int)(log10(nNum) / log10(2)); if (((nNum >> nShift) << nShift) == nNum) bEnable = TRUE; } if ((m_ltRasView.GetRaster().GetBitmapWidth() == 1) || (m_ltRasView.GetRaster().GetBitmapHeight() == 1)) bEnable = FALSE; pCmdUI->Enable( bEnable ? TRUE : FALSE ); } else pCmdUI->Enable(FALSE); } void CIMGPFView::OnImageDft() { unsigned int uFlags; int nMinHarmonicX,nMaxHarmonicX,nMinHarmonicY,nMaxHarmonicY; nMinHarmonicX = 0; nMinHarmonicY = 0; nMaxHarmonicX = (int)(m_ltRasView.GetRaster().GetBitmapWidth()/2); nMaxHarmonicY = (int)(m_ltRasView.GetRaster().GetBitmapHeight()/2); uFlags = DFT_DFT | DFT_GRAY | DFT_RANGE | DFT_INSIDE_X | DFT_INSIDE_Y; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->InitFourierTransformation(m_ltRasView.GetRaster()); if( nRet != 0 ) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); return; } nRet = theApp.m_pRasterProcess->DiscreteFourierTransformation(m_ltRasView.GetRaster(),nMinHarmonicX, nMaxHarmonicX,nMinHarmonicY,nMaxHarmonicY,uFlags); if( nRet != 0 ) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); return; } uFlags = DFT_IDFT | DFT_GRAY | DFT_RANGE | DFT_INSIDE_X | DFT_INSIDE_Y | DFT_IDFT_SCL | DFT_IDFT_BOTH; nRet = theApp.m_pRasterProcess->DiscreteFourierTransformation(m_ltRasView.GetRaster(),nMinHarmonicX, nMaxHarmonicX,nMinHarmonicY,nMaxHarmonicY,uFlags); if( nRet != 0 ) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); return; } nRet = theApp.m_pRasterProcess->FreeFourierTransformation(); m_ltRasView.ForceRepaint(); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageOnoffmask() { unsigned int uFlags; int nMinHarmonicX,nMaxHarmonicX,nMinHarmonicY,nMaxHarmonicY; nMinHarmonicX = 0; nMinHarmonicY = 0; nMaxHarmonicX = (int)(m_ltRasView.GetRaster().GetBitmapWidth()/2); nMaxHarmonicY = (int)(m_ltRasView.GetRaster().GetBitmapHeight()/2); uFlags = DFT_DFT | DFT_GRAY | DFT_RANGE | DFT_INSIDE_X | DFT_INSIDE_Y; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->InitFourierTransformation(m_ltRasView.GetRaster()); if( nRet != 0 ) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); return; } nRet = theApp.m_pRasterProcess->DiscreteFourierTransformation(m_ltRasView.GetRaster(),nMinHarmonicX, nMaxHarmonicX,nMinHarmonicY,nMaxHarmonicY,uFlags); if( nRet != 0 ) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); return; } nRet = theApp.m_pRasterProcess->FrequencyFilterMask(m_ltRasView.GetRaster(), TRUE ); if( nRet != 0 ) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); return; } uFlags = DFT_IDFT | DFT_GRAY | DFT_RANGE | DFT_INSIDE_X | DFT_INSIDE_Y | DFT_IDFT_SCL | DFT_IDFT_BOTH; nRet = theApp.m_pRasterProcess->DiscreteFourierTransformation(m_ltRasView.GetRaster(),nMinHarmonicX, nMaxHarmonicX,nMinHarmonicY,nMaxHarmonicY,uFlags); if( nRet != 0 ) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); return; } nRet = theApp.m_pRasterProcess->FreeFourierTransformation(); m_ltRasView.ForceRepaint(); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageDisplayfourier() { unsigned int uFlags; int nMinHarmonicX,nMaxHarmonicX,nMinHarmonicY,nMaxHarmonicY; nMinHarmonicX = 0; nMinHarmonicY = 0; nMaxHarmonicX = (int)(m_ltRasView.GetRaster().GetBitmapWidth() - 1); nMaxHarmonicY = (int)(m_ltRasView.GetRaster().GetBitmapHeight() - 1); uFlags = DFT_DFT | DFT_GRAY | DFT_RANGE | DFT_INSIDE_X | DFT_INSIDE_Y; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->InitFourierTransformation(m_ltRasView.GetRaster()); if( nRet != 0 ) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); return; } nRet = theApp.m_pRasterProcess->DiscreteFourierTransformation(m_ltRasView.GetRaster(),nMinHarmonicX, nMaxHarmonicX,nMinHarmonicY,nMaxHarmonicY,uFlags); if( nRet != 0 ) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); return; } nRet = theApp.m_pRasterProcess->FrequencyFilterMask(m_ltRasView.GetRaster(), TRUE ); if( nRet != 0 ) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); return; } nRet = theApp.m_pRasterProcess->DisplayFourierTransformation( m_ltRasView.GetRaster(), DSP_FT_MAG|DSP_FT_LOG); if( nRet != 0 ) { theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); return; } nRet = theApp.m_pRasterProcess->FreeFourierTransformation(); m_ltRasView.ForceRepaint(); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageSeg() { unsigned int uThreshold; uThreshold = 25; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Segment( m_ltRasView.GetRaster(), uThreshold, SGM_RGB ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageSkelton() { unsigned int uThreshold; uThreshold = 200; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->Skeleton( m_ltRasView.GetRaster(), uThreshold ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageAddbitmap() { int nRet; ILEADRaster * pRaster; HRESULT hr; theApp.m_pRasterFileDlg->PutFilter(""); theApp.m_pRasterFileDlg->PutFileDlgFlags(0); theApp.m_pRasterFileDlg->PutFileName(""); theApp.m_pRasterFileDlg->PutDialogTitle("Open File"); theApp.m_pRasterFileDlg->PutUIFlags( OPEN_SHOW_PREVIEW | OPEN_SHOW_FILEINFO | OPEN_SHOW_LOADCOMPRESSED | OPEN_SHOW_LOADROTATED | OPEN_VIEWTOTALPAGES ); nRet = theApp.m_pRasterFileDlg->ShowOpenDlg((long)theApp.m_pMainWnd->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { pRaster = NULL; hr = theApp.CreateRasterObjectLic(&pRaster); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER); return;} theApp.m_pRasterIO->Load(pRaster, theApp.m_pRasterFileDlg->GetFileName(), 0, 1, 1); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor(); pRaster->InsertBitmapListItem(-1, m_ltRasView.GetRaster().GetBitmap()); theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->AddBitmaps (pRaster, BC_AVG); m_ltRasView.GetRaster().SetBitmap(pRaster->GetBitmap()); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); } theApp.DisplayLEADError(nRet); if(pRaster) pRaster->Release(); } void CIMGPFView::OnImageCombine() { int nRet; ILEADRaster * pRaster; HRESULT hr; theApp.m_pRasterFileDlg->PutFilter(""); theApp.m_pRasterFileDlg->PutFileDlgFlags(0); theApp.m_pRasterFileDlg->PutFileName(""); theApp.m_pRasterFileDlg->PutDialogTitle("Open File"); theApp.m_pRasterFileDlg->PutUIFlags( OPEN_SHOW_PREVIEW | OPEN_SHOW_FILEINFO | OPEN_SHOW_LOADCOMPRESSED | OPEN_SHOW_LOADROTATED | OPEN_VIEWTOTALPAGES ); nRet = theApp.m_pRasterFileDlg->ShowOpenDlg((long)theApp.m_pMainWnd->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { pRaster = NULL; hr = theApp.CreateRasterObjectLic(&pRaster); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER); return;} theApp.m_pRasterIO->Load(pRaster, theApp.m_pRasterFileDlg->GetFileName(), 0, 1, 1); // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->CombineExt( m_ltRasView.GetRaster(), m_ltRasView.GetRaster().GetBitmapWidth() / 2, m_ltRasView.GetRaster().GetBitmapHeight() / 2, pRaster->GetBitmapWidth(), pRaster->GetBitmapHeight(), pRaster, 0, 0, (CombineConstants)(CB_OP_ADD | CB_DST_0 |CB_SRC_RED|CB_DST_GREEN | CB_RES_BLUE) ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); pRaster->Release(); } theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageFreehandnoise() { theApp.m_pRasterProcess->PutUserLUTCurveSize(4); theApp.m_pRasterProcess->PutUserLUTCurveX(0,0); theApp.m_pRasterProcess->PutUserLUTCurveY(0,0); theApp.m_pRasterProcess->PutUserLUTCurveX(1,3); theApp.m_pRasterProcess->PutUserLUTCurveY(1,10); theApp.m_pRasterProcess->PutUserLUTCurveX(2,9); theApp.m_pRasterProcess->PutUserLUTCurveY(2,-10); theApp.m_pRasterProcess->PutUserLUTCurveX(3,12); theApp.m_pRasterProcess->PutUserLUTCurveY(3,0); theApp.m_pRasterProcess->GetCurvePoints(GUB_LINEAR); theApp.m_pRasterProcess->LightRedAmplitude = 50; theApp.m_pRasterProcess->LightGreenAmplitude = 50; theApp.m_pRasterProcess->LightBlueAmplitude = 50; theApp.m_pRasterProcess->LightFrequency = 5000; theApp.m_pRasterProcess->LightAngle = 0; theApp.m_pRasterProcess->LightPhase = 0; theApp.m_pRasterProcess->LightFlags = FL_FREEHAND | FL_ADD; theApp.m_pRasterProcess->LightXOrigin = 0; theApp.m_pRasterProcess->LightYOrigin = 0; theApp.m_pRasterProcess->UserShapeCount = theApp.m_pRasterProcess->GetAmplitudesCount(); for(int i = 0; i < theApp.m_pRasterProcess->UserShapeCount; i++) { theApp.m_pRasterProcess->PutUserShape(i,theApp.m_pRasterProcess->GetAmplitudes(i)); } // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->FunctionalLight(m_ltRasView.GetRaster()); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageAddnoise() { theApp.m_pRasterProcess->LightRedAmplitude = 1; theApp.m_pRasterProcess->LightGreenAmplitude = 0; theApp.m_pRasterProcess->LightBlueAmplitude = 0; theApp.m_pRasterProcess->LightFrequency = 0; theApp.m_pRasterProcess->LightAngle = 0; theApp.m_pRasterProcess->LightPhase = 0; theApp.m_pRasterProcess->LightFlags = FL_LINEAR_QUADRATIC | FL_QUADRATIC_OUTER; theApp.m_pRasterProcess->LightXOrigin = (unsigned int)m_ltRasView.GetRaster().GetBitmapWidth() / 2; theApp.m_pRasterProcess->LightYOrigin = (unsigned int)m_ltRasView.GetRaster().GetBitmapHeight() / 2; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->FunctionalLight(m_ltRasView.GetRaster()); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageAddfuncnoise() { theApp.m_pRasterProcess->LightRedAmplitude = 50; theApp.m_pRasterProcess->LightGreenAmplitude = 50; theApp.m_pRasterProcess->LightBlueAmplitude = 50; theApp.m_pRasterProcess->LightFrequency = 1500; theApp.m_pRasterProcess->LightAngle = 0; theApp.m_pRasterProcess->LightPhase = 0; theApp.m_pRasterProcess->LightFlags = FL_TRIGONOMETRY | FL_CIRCLES | FL_ADD; theApp.m_pRasterProcess->LightXOrigin = (unsigned int)m_ltRasView.GetRaster().GetBitmapWidth() / 2; theApp.m_pRasterProcess->LightYOrigin = (unsigned int)m_ltRasView.GetRaster().GetBitmapHeight() / 2; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->FunctionalLight(m_ltRasView.GetRaster()); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); theApp.DisplayLEADError(nRet); } void CIMGPFView::OnImageConv() { ILEADRaster * pRaster; int nRet; HRESULT hr; char szBuf [MAX_PATH] = ""; unsigned int uMaxPoints, uXStep, uYStep, uThreshold; RECT rcRect; RECT rcRgn; RECT rcOff; // Smaller image is required here sprintf ( szBuf, "Select an image with width and height less than (%d x %d)", m_ltRasView.GetRaster().GetBitmapWidth(), m_ltRasView.GetRaster().GetBitmapHeight() ); theApp.m_pRasterFileDlg->PutFilter(""); theApp.m_pRasterFileDlg->PutFileDlgFlags(0); theApp.m_pRasterFileDlg->PutFileName(""); theApp.m_pRasterFileDlg->PutDialogTitle("Open File"); theApp.m_pRasterFileDlg->PutUIFlags( OPEN_SHOW_PREVIEW | OPEN_SHOW_FILEINFO | OPEN_SHOW_LOADCOMPRESSED | OPEN_SHOW_LOADROTATED | OPEN_VIEWTOTALPAGES ); nRet = theApp.m_pRasterFileDlg->ShowOpenDlg((long)theApp.m_pMainWnd->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { pRaster = NULL; hr = theApp.CreateRasterObjectLic(&pRaster); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER); return;} theApp.m_pRasterIO->Load(pRaster, theApp.m_pRasterFileDlg->GetFileName(), 0, 1, 1); uMaxPoints = 10; uXStep = 1; uYStep = 1; uThreshold = 90; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); theApp.m_pRasterProcess->CorrelationMaxPoints = uMaxPoints; int nRet = theApp.m_pRasterProcess->Correlation ( m_ltRasView.GetRaster(), pRaster, uXStep, uYStep, uThreshold); rcRgn.bottom =(int)(pRaster->GetRgnHeight() - pRaster->GetRgnTop()); rcRgn.top =(int) pRaster->GetRgnTop(); rcRgn.left =(int) pRaster->GetRgnLeft(); rcRgn.right =(int)(pRaster->GetRgnLeft() + pRaster->GetRgnWidth()); if (nRet == 0 && theApp.m_pRasterProcess->GetCorrelationCount()> 0 ) { // Release any previous region rcOff.bottom =(int)(m_ltRasView.GetRaster().GetRgnHeight() - m_ltRasView.GetRaster().GetRgnTop()); rcOff.top =(int) m_ltRasView.GetRaster().GetRgnTop(); rcOff.left =(int) m_ltRasView.GetRaster().GetRgnLeft(); rcOff.right =(int)(m_ltRasView.GetRaster().GetRgnLeft() + m_ltRasView.GetRaster().GetRgnWidth()); for(int i = 0; i < (int)theApp.m_pRasterProcess->GetCorrelationCount(); i++) { rcRect.left = theApp.m_pRasterProcess->GetCorrelationX(i) + rcOff.left; rcRect.top = theApp.m_pRasterProcess->GetCorrelationY(i) + rcOff.top; rcRect.right = rcRect.left + (rcRgn.right - rcRgn.left); rcRect.bottom = rcRect.top + (rcRgn.bottom - rcRgn.top); if(i) { m_ltRasView.SetRgnFrameType(RGNFRAME_ANIMATED); m_ltRasView.GetRaster().SetRgnRect ( (float)rcRect.left, (float)rcRect.top,(float) (rcRect.right - rcRect.left), (float)(rcRect.bottom - rcRect.top), L_RGN_OR ); } else { m_ltRasView.SetRgnFrameType(RGNFRAME_ANIMATED); m_ltRasView.GetRaster().SetRgnRect ( (float)rcRect.left,(float) rcRect.top, (float)(rcRect.right - rcRect.left), (float)(rcRect.bottom - rcRect.top), L_RGN_SET ); } } } theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); pRaster->Release(); } theApp.DisplayLEADError(nRet); } void CIMGPFView::OnFiltersPixelatePicturizeSpecifydirectoryasasource() { ILEADRaster * pRaster; int nRet; HRESULT hr; unsigned int uxDim, uyDim, uLightnessFact; theApp.m_pRasterFileDlg->PutFilter(""); theApp.m_pRasterFileDlg->PutFileDlgFlags(0); theApp.m_pRasterFileDlg->PutFileName(""); theApp.m_pRasterFileDlg->PutDialogTitle("Open File"); theApp.m_pRasterFileDlg->PutUIFlags( OPEN_SHOW_PREVIEW | OPEN_SHOW_FILEINFO | OPEN_SHOW_LOADCOMPRESSED | OPEN_SHOW_LOADROTATED | OPEN_VIEWTOTALPAGES ); nRet = theApp.m_pRasterFileDlg->ShowOpenDlg((long)theApp.m_pMainWnd->m_hWnd); if(nRet == 0 && theApp.m_pRasterFileDlg->GetDialogStatus() == DLG_OK) { pRaster = NULL; hr = theApp.CreateRasterObjectLic(&pRaster); if (FAILED(hr)){theApp.DisplayLEADError(ERROR_INV_PARAMETER); return;} theApp.m_pRasterIO->Load(pRaster, theApp.m_pRasterFileDlg->GetFileName(), 0, 1, 1); uxDim = 20; uyDim = 15; uLightnessFact = 200; // Load the original bitmap if( LoadOriginalBitmap() != 0 ) return; BeginWaitCursor() ; theApp.m_pRasterProcess->PutEnableProgressEvent( TRUE ); int nRet = theApp.m_pRasterProcess->PicturizeBitmapList( m_ltRasView.GetRaster(), uxDim, uyDim, uLightnessFact, pRaster ); theApp.m_pRasterProcess->PutEnableProgressEvent( FALSE ); EndWaitCursor(); pRaster->Release(); } theApp.DisplayLEADError(nRet); } void CIMGPFView::OnUpdateFiltersPixelatePicturizeSpecifydirectoryasasource(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateFiltersPixelatePicturizeUsemultiplebitmaps(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateFiltersPixelatePicturizeUsesameimage(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateColorBalancecolor(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap() && m_ltRasView.GetRaster().GetIsGrayscale() == FALSE) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateColorColoredgray(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap() && m_ltRasView.GetRaster().GetIsGrayscale() == FALSE) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateColorConverttogray(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap() && m_ltRasView.GetRaster().GetIsGrayscale() == FALSE) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateColorGray12(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateColorGray16(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateColorGray8(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateColorHalftone(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateColorSwapcolor(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap() && m_ltRasView.GetRaster().GetIsGrayscale() == FALSE) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageAce(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageAddbitmap(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageAddfuncnoise(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageAddmessage(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageAddnoise(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageAging(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageAntialias(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageAutobinarysegment(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageAutocontrast(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageAutolevel(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageAutoluminosity(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageBalancecolors(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap() && m_ltRasView.GetRaster().GetIsGrayscale() == FALSE) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageBci(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageBinarysegment(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageBnd(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageBump(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageChannelmixer(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap() && m_ltRasView.GetRaster().GetIsGrayscale() == FALSE) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageClrres(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageColorthreshold(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap() && m_ltRasView.GetRaster().GetIsGrayscale() == FALSE) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageCombine(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageComsts(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageConv(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageConvmatrix(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageCr(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageCubismEffect(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageCylender(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageDeinterlace(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageDesat(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap() && m_ltRasView.GetRaster().GetIsGrayscale() == FALSE) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageDft(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageDice(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageDisplayfourier(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageDry(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageDsa(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageDuotone(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageDynamicthreshold(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageEdgedetection(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageExtractmessage(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageFademask(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageFillbitmap(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageFindedges(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageFreePlaneBend(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageFreeRadBend(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageFreehandnoise(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageGaussianblur(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageGetferets(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageGetobjectinfonw(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageGetobjectinfow(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageGetrgnperimeter(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageGlassEffect(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageGlow(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageHandwave(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageHistogram(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageHistogramequalize(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageHsb(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap() && m_ltRasView.GetRaster().GetIsGrayscale() == FALSE) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageImpress(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageLens(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageLeveling(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageLight(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageLightControl(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageLocalhisto(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageMath(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageMax(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageMedian(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageMin(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageMotionblur(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageMrad(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageMultiply(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageMzoom(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageNum(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageOcean(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageOnoffmask(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageOpacity(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImagePinch(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImagePixelate(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImagePlane(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImagePlaneBend(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImagePolar(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImagePuzzle(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageRedeyeremove(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap() && m_ltRasView.GetRaster().GetIsGrayscale() == FALSE) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageRemaphue(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageRemapintensity(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageRepclr(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageResize(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageReveffect(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageRippel(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageSampleTarget(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageSeg(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageSelectivecolor(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()&& m_ltRasView.GetRaster().GetIsGrayscale() == FALSE) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageShadow(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageShear(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageSkelton(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageSmooth(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageSphere(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageSpiral(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageStar(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageStatis(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageSubtractbackground(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageSwirl(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageTunnel(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageUnsharp(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageWave(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageWavezoom(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageWind(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateImageWvrad(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateViewAddborder(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } void CIMGPFView::OnUpdateViewAddframe(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } BEGIN_EVENTSINK_MAP(CIMGPFView, CFormView) //{{AFX_EVENTSINK_MAP(CIMGPFView) ON_EVENT(CIMGPFView, IDC_LEADRASTERVIEW1, 16 /* KeyDown */, OnKeyDownLeadrasterview1, VTS_I2 VTS_I2) ON_EVENT(CIMGPFView, IDC_LEADRASTERVIEW1, 8 /* Paint */, OnPaintLeadRasterView, VTS_I4) //}}AFX_EVENTSINK_MAP END_EVENTSINK_MAP() void CIMGPFView::OnKeyDownLeadrasterview1(short KeyCode, short Shift) { CMainFrame* pFrame = (CMainFrame*)AfxGetApp()->GetMainWnd(); if ( KeyCode == VK_ESCAPE && pFrame->m_bInProcess ) pFrame->m_bAbortProcess = TRUE; } void CIMGPFView::OnImageBrainAnalysis() { CKfmnRgnDlg KfmnRgnDlg; if(LoadOriginalBitmap() != 0 ) return; m_ltRasView.SetRgnFrameType(RGNFRAME_ANIMATED); KfmnRgnDlg.SetDlgParams(this); m_pKfmnDlg = &KfmnRgnDlg; KfmnRgnDlg.DoModal(); if(m_ltRasView.GetRaster().GetHasRgn()) { m_ltRasView.GetRaster().FreeRgn(); } m_pKfmnDlg = NULL; m_ltRasView.ForceRepaint(); } void CIMGPFView::OnPaintLeadRasterView(long hDC) { HBRUSH hBrush, hOldBrush; HRGN hTmpRgn = NULL; RECT rcRect; if(m_pKfmnDlg != NULL) { if(m_pKfmnDlg->m_bShowTrackFrame) { hBrush = CreateSolidBrush(m_pKfmnDlg->m_crFrame); hOldBrush = (HBRUSH)SelectObject((HDC)hDC, hBrush); hTmpRgn = CreateRectRgn(0, 0, 1, 1); CombineRgn(hTmpRgn, m_pKfmnDlg->m_hRgn, 0, RGN_COPY); GetRgnBox(m_pKfmnDlg->m_hRgn, &rcRect); OffsetRgn(hTmpRgn, (int)m_ltRasView.GetDstLeft(), (int)m_ltRasView.GetDstTop()); hBrush = CreateSolidBrush(m_pKfmnDlg->m_crFrame); FrameRgn((HDC)hDC, hTmpRgn, hBrush, 1, 1); SelectObject((HDC)hDC, hOldBrush); DeleteObject(hBrush); DeleteObject(hTmpRgn); } } } BOOL CIMGPFView::OnEraseBkgnd(CDC* pDC) { return TRUE; } void CIMGPFView::OnChangeCursor(LPCTSTR idCursor) { SetCursor(LoadCursor(NULL, idCursor)); } void CIMGPFView::OnUpdateImageBrainAnalysis(CCmdUI* pCmdUI) { if(m_ltRasView.GetRaster().GetBitmap()) pCmdUI->Enable( TRUE ); else pCmdUI->Enable( FALSE ); } int CIMGPFView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFormView::OnCreate(lpCreateStruct) == -1) return -1; // getting current images path HKEY hKey = HKEY_LOCAL_MACHINE; TCHAR szSubKey[MAX_PATH]; memset(szSubKey, 0, sizeof(szSubKey)); #ifndef UNICODE lstrcpy(szSubKey, TEXT("SOFTWARE\\LEAD Technologies, Inc.\\Images")); #else lstrcpy(szSubKey, TEXT("SOFTWARE\\LEAD Technologies, Inc.\\UnicodeImages")); #endif LONG nRet = RegOpenKeyEx(hKey, szSubKey, 0, KEY_READ, &hKey); if (nRet == 0) { DWORD lpType; BYTE data[MAX_PATH]; DWORD sizeData = MAX_PATH; memset(data,0,sizeof(data)); nRet = RegQueryValueEx(hKey, _T(""), NULL, &lpType, data, &sizeData); if (nRet == 0) theApp.m_csImagesPath.Format(_T("%s"), (TCHAR *)&data); RegCloseKey(hKey); } return 0; }