// SpFxDlg.cpp : implementation file // #include "stdafx.h" #include "SpFxCOM.h" #include "SpFxDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #define MAX_IMAGES 5 #define DIR TEXT("..\\images") CString acsFileName[MAX_IMAGES]; void FillFileNameArray(CString csDir) { int x; CString csFile; for(x=0;xLoadIcon(IDR_MAINFRAME); m_pltRasIO = NULL; m_pltFXD = NULL; m_bDrawPersist = VARIANT_FALSE; m_bDlgUp = FALSE; } void CSpFxDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CSpFxDlg) DDX_Control(pDX, IDC_SHOWTRANSITION, m_ShowTransition); DDX_Control(pDX, IDC_SHOWTEXT, m_ShowText); DDX_Control(pDX, IDC_SHOWSHAPE, m_ShowShape); DDX_Check(pDX, IDC_DRAWPERSIST, m_bPersist); DDX_Control(pDX, IDC_LEADRASTERVIEW, m_ltRasView); DDX_Control(pDX, IDC_LEADRASTERVIEW1, m_ltRasView2); //}}AFX_DATA_MAP m_bFilesNotFound = FALSE; } BEGIN_MESSAGE_MAP(CSpFxDlg, CDialog) //{{AFX_MSG_MAP(CSpFxDlg) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_SHAPE, OnShape) ON_BN_CLICKED(IDC_TEXT, OnText) ON_BN_CLICKED(IDC_TRANSITION, OnTransition) ON_BN_CLICKED(IDC_EFFECT, OnEffect) ON_BN_CLICKED(IDC_SHOW, OnShow) ON_BN_CLICKED(IDC_DRAWPERSIST, OnDrawpersist) ON_WM_DESTROY() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CSpFxDlg message handlers BOOL CSpFxDlg::OnInitDialog() { CDialog::OnInitDialog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } HRESULT hr; hr = ::CoCreateInstance(CLSID_LEADRasterIO, NULL, CLSCTX_ALL, IID_ILEADRasterIO, (void**)&m_pltRasIO); if (FAILED (hr) || (m_pltRasIO == NULL)) return FALSE; hr = ::CoCreateInstance(CLSID_LEADRasterFXD, NULL, CLSCTX_ALL, IID_ILEADRasterFXD, (void**)&m_pltFXD); if (FAILED (hr) || (m_pltFXD == NULL)) { m_pltRasIO->Release (); m_pltRasIO = NULL; return FALSE; } m_pRasterKrnDlg = NULL; hr = ::CoCreateInstance(CLSID_LEADRasterDlgKrn, NULL, CLSCTX_ALL, IID_ILEADRasterDlgKrn, (void**)&m_pRasterKrnDlg); if (FAILED (hr) || (m_pRasterKrnDlg == NULL)) { m_pRasterKrnDlg ->Release (); m_pRasterKrnDlg = NULL; return FALSE; } m_pRasterKrnDlg->InitDlg(INIT_WITH_COLOR); m_pRasterEfxDlg = NULL; hr = ::CoCreateInstance(CLSID_LEADRasterDlgEfx, NULL, CLSCTX_ALL, IID_ILEADRasterDlgEfx, (void**)&m_pRasterEfxDlg); if (FAILED (hr) || (m_pRasterEfxDlg == NULL)) { m_pRasterEfxDlg ->Release (); m_pRasterEfxDlg = NULL; return FALSE; } // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here m_nEffectStyle = 16001;//EFX_EFFECT_ELLIPSE_C_OUT; m_nEffectGrain = 10; m_nEffectDelay = 50; m_nEffectMaxPass = 1; m_nEffectTransparent = 0; m_nEffectTransparentColor = RGB(0, 0, 0); m_nEffectWandWidth = 0; m_nEffectWandColor = RGB(255, 0, 0); m_nTransitionStyle = 5003;//EFX_GRADIENT_CONE_FROM_B; m_nTransitionBackColor = RGB(255, 0, 0); m_nTransitionForeColor = RGB(0, 0, 255); m_nTransitionSteps = 100; m_nTransitionEffectStyle = 16000;//EFX_EFFECT_ELLIPSE_C_IN; m_nTransitionEffectGrain = 10; m_nTransitionEffectDelay = 0; m_nTransitionEffectMaxPass = 1; m_nTransitionEffectTransparent = 0; m_nTransitionEffectTransparentColor = RGB(128, 128, 128); m_nTransitionEffectWandWidth = 0; m_nTransitionEffectWandColor = RGB(0, 128, 0); m_nShapeStyle = 9001;//EFX_SHAPE_STAR5; m_nShapeBackStyle = FXD_BACKSTYLE_TRANSPARENT; m_nShapeFillStyle = DRAWFILLSTYLE_UPWARD_DIAGONAL; m_nShapeBorderColor = RGB(192, 192, 192); m_nShapeBorderStyle = FXD_BORDERSTYLE_SOLID; m_nShapeBorderWidth = 3; m_nShapeInnerStyle = 0;//EFX_INNERSTYLE_INSET; m_nShapeInnerWidth = 3; m_nShapeInnerHiliteColor = RGB(255, 255, 255); m_nShapeInnerShadowColor = RGB(128, 128, 128); m_nShapeOuterStyle = 1;//EFX_OUTERSTYLE_RAISED; m_nShapeOuterWidth = 3; m_nShapeOuterHiliteColor = RGB(255, 255, 255); m_nShapeOuterShadowColor = RGB(128, 128, 128); m_nShapeShadowXDepth = 5; m_nShapeShadowYDepth = 5; m_nShapeShadowColor = RGB(0, 0, 0); m_nShapeForeColor = RGB(255, 0, 0); m_nShapeBackColor = RGB(0, 0, 255); m_strTextSample = CString("LEAD Tools"); m_nTextAngle = 0; m_nTextStyle = FXD_TEXTSTYLE_OUTLINEBLOCK; m_nTextAlign = FXD_TEXTALIGN_HCENTER_VCENTER; m_nTextWordWrap = 1; m_nTextColor = RGB(255, 0, 0); m_nTextHiliteColor = RGB(255, 255, 255); m_nTextShadowColor = RGB(0, 0, 0); m_nTextShadowXDepth = 5; m_nTextShadowYDepth = 5; m_nTextUseForegroundImage = 0; m_oleTextFont = m_pRasterKrnDlg->GetDlgFont(); /* CY cySize; cySize = m_oleTextFont.GetSize(); cySize.Lo *= 5; m_oleTextFont.SetSize(cySize); */ m_nFileIndex = 0; m_ltRasView.SetEnableMethodErrors(VARIANT_FALSE); m_ltRasView.SetAutoPan(VARIANT_FALSE); m_ltRasView.SetAutoRepaint(VARIANT_FALSE); m_ltRasView.SetAutoScroll(VARIANT_TRUE); m_ltRasView.SetBackErase(VARIANT_FALSE); m_ltRasView.SetPaintSizeMode(1/*PAINTSIZEMODE_STRETCH*/); m_ltRasView.SetScaleMode(3); m_pRasterEfxDlg->PutEnableMethodErrors(VARIANT_FALSE); m_bFilesNotFound = FALSE; FillFileNameArray(DIR); return TRUE; // return TRUE unless you set the focus to a control } void CSpFxDlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout; dlgAbout.DoModal(); } else { CDialog::OnSysCommand(nID, lParam); } } // If you add a minimize button to your dialog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the framework. void CSpFxDlg::OnPaint() { CPaintDC dc(this); // device context for painting OnShow(); } // The system calls this to obtain the cursor to display while the user drags // the minimized window. HCURSOR CSpFxDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon; } void CSpFxDlg::OnShape() { int nResult; CRect rcRect; TCHAR strDirectory[MAX_PATH]; GetCurrentDirectory(MAX_PATH,strDirectory); m_pRasterEfxDlg->GetShape()->PutShapeStyle(m_nShapeStyle); m_pRasterEfxDlg->GetShape()->PutBackgroundStyle(m_nShapeBackStyle); m_pRasterEfxDlg->GetShape()->PutFillStyle(m_nShapeFillStyle); m_pRasterEfxDlg->GetShape()->PutBorderColor(m_nShapeBorderColor); m_pRasterEfxDlg->GetShape()->PutBorderStyle(m_nShapeBorderStyle); m_pRasterEfxDlg->GetShape()->PutBorderThickness(m_nShapeBorderWidth); m_pRasterEfxDlg->GetShape()->PutInnerStyle(m_nShapeInnerStyle); m_pRasterEfxDlg->GetShape()->PutInnerThickness(m_nShapeInnerWidth); m_pRasterEfxDlg->GetShape()->PutInnerHiliteColor(m_nShapeInnerHiliteColor); m_pRasterEfxDlg->GetShape()->PutInnerShadowColor(m_nShapeInnerShadowColor); m_pRasterEfxDlg->GetShape()->PutOuterStyle(m_nShapeOuterStyle); m_pRasterEfxDlg->GetShape()->PutOuterThickness(m_nShapeOuterWidth); m_pRasterEfxDlg->GetShape()->PutOuterHiliteColor(m_nShapeOuterHiliteColor); m_pRasterEfxDlg->GetShape()->PutOuterShadowColor(m_nShapeOuterShadowColor); m_pRasterEfxDlg->GetShape()->PutShadowXDepth(m_nShapeShadowXDepth); m_pRasterEfxDlg->GetShape()->PutShadowYDepth(m_nShapeShadowYDepth); m_pRasterEfxDlg->GetShape()->PutShadowColor(m_nShapeShadowColor); m_pRasterEfxDlg->GetShape()->PutForeColor(m_nShapeForeColor); m_pRasterEfxDlg->GetShape()->PutBackColor(m_nShapeBackColor); m_pRasterEfxDlg->PutUIFlags(SHAPE_SHOW_PREVIEW | SHAPE_BACKSTYLE | SHAPE_FILLSTYLE | SHAPE_FORE_BACK_COLOR | SHAPE_BORDERSTYLE | SHAPE_BORDERWIDTH | SHAPE_BORDERCOLOR | SHAPE_INNERSTYLE | SHAPE_INNERWIDTH | SHAPE_INNER_HILITE_SHADOW | SHAPE_OUTERSTYLE | SHAPE_OUTERWIDTH | SHAPE_OUTER_HILITE_SHADOW | SHAPE_SHADOWCOLOR | SHAPE_SHADOW_X_Y | SHAPE_BROWSEIMAGE | SHAPE_CLASS_SQUARE | SHAPE_CLASS_RECTANGLE | SHAPE_CLASS_PARALLELOGRAM | SHAPE_CLASS_TRAPEZOID | SHAPE_CLASS_TRIANGLE | SHAPE_CLASS_OTHER | SHAPE_CLASS_CIRCLE | SHAPE_CLASS_ELLIPSE | SHAPE_CLASS_STAR | SHAPE_CLASS_CROSS | SHAPE_CLASS_ARROW); m_pRasterEfxDlg->PutBitmap(m_ltRasView.GetRaster().GetBitmap()); m_bDlgUp = TRUE; nResult = m_pRasterEfxDlg->ShowShapeDlg((long)this->m_hWnd); m_bDlgUp = FALSE; if (nResult == 0 && m_pRasterEfxDlg->GetDialogStatus() == DLG_OK) { m_nShapeStyle = m_pRasterEfxDlg->GetShape()->GetShapeStyle(); m_nShapeBackStyle = m_pRasterEfxDlg->GetShape()->GetBackgroundStyle(); m_nShapeFillStyle = m_pRasterEfxDlg->GetShape()->GetFillStyle(); m_nShapeBorderColor = m_pRasterEfxDlg->GetShape()->GetBorderColor(); m_nShapeBorderStyle = m_pRasterEfxDlg->GetShape()->GetBorderStyle(); m_nShapeBorderWidth = m_pRasterEfxDlg->GetShape()->GetBorderThickness(); m_nShapeInnerStyle = m_pRasterEfxDlg->GetShape()->GetInnerStyle(); m_nShapeInnerWidth = m_pRasterEfxDlg->GetShape()->GetInnerThickness(); m_nShapeInnerHiliteColor = m_pRasterEfxDlg->GetShape()->GetInnerHiliteColor(); m_nShapeInnerShadowColor = m_pRasterEfxDlg->GetShape()->GetInnerShadowColor(); m_nShapeOuterStyle = m_pRasterEfxDlg->GetShape()->GetOuterStyle(); m_nShapeOuterWidth = m_pRasterEfxDlg->GetShape()->GetOuterThickness(); m_nShapeOuterHiliteColor = m_pRasterEfxDlg->GetShape()->GetOuterHiliteColor(); m_nShapeOuterShadowColor = m_pRasterEfxDlg->GetShape()->GetOuterShadowColor(); m_nShapeShadowXDepth = m_pRasterEfxDlg->GetShape()->GetShadowXDepth(); m_nShapeShadowYDepth = m_pRasterEfxDlg->GetShape()->GetShadowYDepth(); m_nShapeShadowColor = m_pRasterEfxDlg->GetShape()->GetShadowColor(); m_nShapeForeColor = m_pRasterEfxDlg->GetShape()->GetForeColor(); m_nShapeBackColor = m_pRasterEfxDlg->GetShape()->GetBackColor(); m_ltRasView2.GetRaster().SetBitmap(m_pRasterEfxDlg->GetShape()->BackgroundBitmap); m_ShowShape.SetCheck(TRUE); GetWindowRect(rcRect); InvalidateRect(rcRect, FALSE); } SetCurrentDirectory(strDirectory); } void CSpFxDlg::OnText() { int nResult; CRect rcRect; m_pRasterEfxDlg->GetText()->PutSampleText((LPCTSTR)m_strTextSample); m_pRasterEfxDlg->GetText()->PutTextStyle(m_nTextStyle); m_pRasterEfxDlg->GetText()->PutAlign(m_nTextAlign); m_pRasterEfxDlg->GetText()->PutWordWrap((short)m_nTextWordWrap); m_pRasterEfxDlg->GetText()->PutColor(m_nTextColor); m_pRasterEfxDlg->GetText()->PutHiliteColor(m_nTextHiliteColor); m_pRasterEfxDlg->GetText()->PutEnableUseForegroundImage((short)m_nTextUseForegroundImage); m_pRasterEfxDlg->GetText()->PutShadowXDepth(m_nTextShadowXDepth); m_pRasterEfxDlg->GetText()->PutShadowYDepth(m_nTextShadowYDepth); m_pRasterEfxDlg->GetText()->PutShadowColor(m_nTextShadowColor); m_pRasterEfxDlg->GetText()->PutAngle(m_nTextAngle); m_pRasterEfxDlg->PutUIFlags(TEXT_SHOW_PREVIEW | TEXT_SAMPLETEXT | TEXT_STYLE | TEXT_COLOR | TEXT_BORDERCOLOR | TEXT_ALIGN | TEXT_ANGLE | TEXT_WORDWRAP | TEXT_FONT | TEXT_SHADOWCOLOR | TEXT_SHADOW_X_Y); m_pRasterEfxDlg->PutBitmap(m_ltRasView.GetRaster().GetBitmap()); m_bDlgUp = TRUE; nResult = m_pRasterEfxDlg->ShowTextDlg((long)this->m_hWnd); m_bDlgUp = FALSE; if (nResult == 0 && m_pRasterEfxDlg->GetDialogStatus() == DLG_OK) { m_strTextSample =(LPCTSTR) m_pRasterEfxDlg->GetText()->SampleText; m_nTextStyle = m_pRasterEfxDlg->GetText()->GetTextStyle(); m_nTextAlign = m_pRasterEfxDlg->GetText()->GetAlign(); m_nTextWordWrap = m_pRasterEfxDlg->GetText()->GetWordWrap(); m_nTextColor = m_pRasterEfxDlg->GetText()->GetColor(); m_nTextHiliteColor = m_pRasterEfxDlg->GetText()->GetHiliteColor(); m_nTextUseForegroundImage = m_pRasterEfxDlg->GetText()->GetEnableUseForegroundImage(); m_nTextShadowXDepth = m_pRasterEfxDlg->GetText()->GetShadowXDepth(); m_nTextShadowYDepth = m_pRasterEfxDlg->GetText()->GetShadowYDepth(); m_nTextShadowColor = m_pRasterEfxDlg->GetText()->GetShadowColor(); m_nTextAngle = m_pRasterEfxDlg->GetText()->GetAngle(); m_pRasterEfxDlg->GetText()->GetFont()->QueryInterface(IID_IFontDisp, (void**) &m_oleTextFont); m_ShowText.SetCheck(TRUE); GetWindowRect(rcRect); InvalidateRect(rcRect, FALSE); } } void CSpFxDlg::OnTransition() { int nResult; CRect rcRect; m_pRasterEfxDlg->GetTransition()->PutTransitionStyle(m_nTransitionStyle); m_pRasterEfxDlg->GetTransition()->PutForeColor(m_nTransitionForeColor); m_pRasterEfxDlg->GetTransition()->PutBackColor(m_nTransitionBackColor); m_pRasterEfxDlg->GetTransition()->put_Grain(m_nTransitionSteps); m_pRasterEfxDlg->GetTransition()->PutEffectStyle(m_nTransitionEffectStyle); m_pRasterEfxDlg->GetTransition()->PutGrain(m_nTransitionEffectGrain); m_pRasterEfxDlg->GetTransition()->PutDelay(m_nTransitionEffectDelay); m_pRasterEfxDlg->GetTransition()->PutMaxPass(m_nTransitionEffectMaxPass); m_pRasterEfxDlg->GetTransition()->PutTransparent((short)m_nTransitionEffectTransparent); m_pRasterEfxDlg->GetTransition()->PutTransparentColor(m_nTransitionEffectTransparentColor); m_pRasterEfxDlg->GetTransition()->PutWandThickness(m_nTransitionEffectWandWidth); m_pRasterEfxDlg->GetTransition()->PutWandColor(m_nTransitionEffectWandColor); m_pRasterEfxDlg->PutUIFlags(TRANSITION_SHOW_PREVIEW | TRANSITION_FORECOLOR | TRANSITION_BACKCOLOR | TRANSITION_DELAY | TRANSITION_GRAIN | TRANSITION_EFFECT | TRANSITION_PASSES | TRANSITION_WAND | TRANSITION_TRANSPARENT | TRANSITION_GRADIENT); m_pRasterEfxDlg->PutBitmap(m_ltRasView.GetRaster().GetBitmap()); m_bDlgUp = TRUE; nResult = m_pRasterEfxDlg->ShowTransitionDlg((long)this->m_hWnd); m_bDlgUp = FALSE; if (nResult == 0 && m_pRasterEfxDlg->GetDialogStatus() == DLG_OK) { m_nTransitionStyle = m_pRasterEfxDlg->GetTransition()->GetTransitionStyle(); m_nTransitionForeColor = m_pRasterEfxDlg->GetTransition()->GetForeColor(); m_nTransitionBackColor = m_pRasterEfxDlg->GetTransition()->GetBackColor(); m_nTransitionSteps = m_pRasterEfxDlg->GetTransition()->GetSteps(); m_nTransitionEffectStyle = m_pRasterEfxDlg->GetTransition()->GetEffectStyle(); m_nTransitionEffectGrain = m_pRasterEfxDlg->GetTransition()->GetGrain(); m_nTransitionEffectDelay = m_pRasterEfxDlg->GetTransition()->GetDelay(); m_nTransitionEffectMaxPass = m_pRasterEfxDlg->GetTransition()->GetMaxPass(); m_nTransitionEffectTransparent = m_pRasterEfxDlg->GetTransition()->GetTransparent(); m_nTransitionEffectTransparentColor = m_pRasterEfxDlg->GetTransition()->GetTransparentColor(); m_nTransitionEffectWandWidth = m_pRasterEfxDlg->GetTransition()->GetWandThickness(); m_nTransitionEffectWandColor = m_pRasterEfxDlg->GetTransition()->GetWandColor(); m_ShowTransition.SetCheck(TRUE); GetWindowRect(rcRect); InvalidateRect(rcRect, FALSE); } } void CSpFxDlg::OnEffect() { int nResult; CRect rcRect; m_pRasterEfxDlg->GetEffect()->PutEffectStyle(m_nEffectStyle); m_pRasterEfxDlg->GetEffect()->PutGrain(m_nEffectGrain); m_pRasterEfxDlg->GetEffect()->PutDelay(m_nEffectDelay); m_pRasterEfxDlg->GetEffect()->PutMaxPass(m_nEffectMaxPass); m_pRasterEfxDlg->GetEffect()->PutTransparent((short)m_nEffectTransparent); m_pRasterEfxDlg->GetEffect()->PutTransparentColor(m_nEffectTransparentColor); m_pRasterEfxDlg->GetEffect()->PutWandThickness(m_nEffectWandWidth); m_pRasterEfxDlg->GetEffect()->PutWandColor(m_nEffectWandColor); m_pRasterEfxDlg->PutUIFlags (EFFECT_SHOW_PREVIEW | EFFECT_DELAY | EFFECT_GRAIN | EFFECT_PASSES | EFFECT_TRANSPARENT | EFFECT_WAND | EFFECT_CLASS_NONE | EFFECT_CLASS_WIPE | EFFECT_CLASS_WIPERECT | EFFECT_CLASS_WIPECIRCLE | EFFECT_CLASS_PUSH | EFFECT_CLASS_SLIDE | EFFECT_CLASS_ROLL | EFFECT_CLASS_ROTATE | EFFECT_CLASS_ZOOM | EFFECT_CLASS_DRIP | EFFECT_CLASS_BLIND | EFFECT_CLASS_RANDOM | EFFECT_CLASS_CHECK | EFFECT_CLASS_BLOCKS | EFFECT_CLASS_CIRCLE | EFFECT_CLASS_ELLIPSE); m_pRasterEfxDlg->PutBitmap(m_ltRasView.GetRaster().GetBitmap()); m_bDlgUp = TRUE; nResult = m_pRasterEfxDlg->ShowEffectDlg((long)this->m_hWnd); m_bDlgUp = FALSE; if (nResult == 0 && m_pRasterEfxDlg->GetDialogStatus() == DLG_OK) { m_nEffectStyle = m_pRasterEfxDlg->GetEffect()->GetEffectStyle(); m_nEffectGrain = m_pRasterEfxDlg->GetEffect()->GetGrain(); m_nEffectDelay = m_pRasterEfxDlg->GetEffect()->GetDelay(); m_nEffectMaxPass = m_pRasterEfxDlg->GetEffect()->GetMaxPass(); m_nEffectTransparent = m_pRasterEfxDlg->GetEffect()->GetTransparent(); m_nEffectTransparentColor = m_pRasterEfxDlg->GetEffect()->GetTransparentColor(); m_nEffectWandWidth = m_pRasterEfxDlg->GetEffect()->GetWandThickness(); m_nEffectWandColor = m_pRasterEfxDlg->GetEffect()->GetWandColor(); GetWindowRect(rcRect); InvalidateRect(rcRect, FALSE); } } void CSpFxDlg::OnShow() { short iRet; CLEADRaster ltRaster = m_ltRasView.GetRaster(); CString strFileName; //-----Begin Transition------------------------------------------------------ if(!m_bDlgUp && !m_bFilesNotFound) { if (m_ShowTransition.GetCheck()) { if (m_nTransitionStyle <= FXD_PATTERN_MAX) { m_ltRasView.SetTransitionStyle(2/*EFX_TRANSITION_PATTERN*/); if (m_nTransitionStyle == FXD_PATTERN_SOLID) { m_ltRasView.SetPatternStyle(m_nTransitionStyle); } else { m_ltRasView.SetPatternStyle(m_nTransitionStyle+1); } m_ltRasView.SetPatternForeColor(m_nTransitionForeColor); m_ltRasView.SetPatternBackColor(m_nTransitionBackColor); } else { m_ltRasView.SetTransitionStyle(1/*EFX_TRANSITION_GRADIENT*/); m_ltRasView.SetGradientStyle(m_nTransitionStyle); m_ltRasView.SetGradientStartColor(m_nTransitionBackColor); m_ltRasView.SetGradientEndColor(m_nTransitionForeColor); m_ltRasView.SetGradientSteps(m_nTransitionSteps); } m_ltRasView.SetTransitionEffect(m_nTransitionEffectStyle); m_ltRasView.SetEffectGrain(m_nTransitionEffectGrain); m_ltRasView.SetTransitionDelay(m_nTransitionEffectDelay); m_ltRasView.SetPaintTransitionMaxPasses(m_nTransitionEffectMaxPass); ltRaster.SetBitmapEnableTransparency(m_nTransitionEffectTransparent); ltRaster.SetBitmapTransparentColor(m_nTransitionEffectTransparentColor); m_ltRasView.SetWandSize(m_nTransitionEffectWandWidth); m_ltRasView.SetWandColor(m_nTransitionEffectWandColor); } else { m_ltRasView.SetTransitionEffect(1000/*EFX_EFFECT_NONE*/); m_ltRasView.SetTransitionStyle(0/*EFX_TRANSITION_NONE*/); } //-----End Transition-------------------------------------------------------- //-----Begin Effect---------------------------------------------------------- if (m_nFileIndex >= MAX_IMAGES) { m_nFileIndex = 0; } { strFileName = acsFileName[m_nFileIndex]; m_pltRasIO->EnableMethodErrors = FALSE; iRet = m_pltRasIO->Load(m_ltRasView.GetRaster(), strFileName.AllocSysString(), 0, 0, 1); if(iRet == ERROR_FILENOTFOUND) { HRESULT hr; ILEADRasterDlgFile * pRasterFileDlg=NULL; hr = CoCreateInstance(CLSID_LEADRasterDlgFile, NULL, CLSCTX_ALL, IID_ILEADRasterDlgFile, (void**)&pRasterFileDlg); if (FAILED(hr)) { AfxMessageBox(TEXT("Error Creating Common Dialog Object"), MB_OK|MB_ICONERROR); EndDialog(IDCANCEL); return; } m_bDlgUp = TRUE; m_bFilesNotFound = TRUE; iRet = pRasterFileDlg->ShowDirectoryDlg((long)GetSafeHwnd()); m_bDlgUp = FALSE; if(iRet == 0 && pRasterFileDlg->GetDialogStatus() == DLG_OK) { BSTR bstr = pRasterFileDlg->GetDirectory(); CString csDir = bstr; SysFreeString(bstr); FillFileNameArray(csDir); strFileName = acsFileName[m_nFileIndex]; iRet = m_pltRasIO->Load(m_ltRasView.GetRaster(), strFileName.AllocSysString(), 0, 0, 1); } else { EndDialog(IDCANCEL); return; } } if(iRet!=0) { MessageBox(TEXT("Cannot Find the Image Files!")); EndDialog(IDCANCEL); return; } m_nFileIndex++; m_bFilesNotFound = FALSE; } m_ltRasView.SetPaintEffect(m_nEffectStyle); m_ltRasView.SetEffectGrain(m_nEffectGrain); m_ltRasView.SetEffectDelay(m_nEffectDelay); m_ltRasView.SetPaintEffectMaxPasses(m_nEffectMaxPass); ltRaster.SetBitmapEnableTransparency(m_nEffectTransparent); ltRaster.SetBitmapTransparentColor(m_nEffectTransparentColor); m_ltRasView.SetWandSize(m_nEffectWandWidth); m_ltRasView.SetWandColor(m_nEffectWandColor); if (m_bDrawPersist == VARIANT_FALSE) m_ltRasView.ForceRepaint(); //-----End Effect------------------------------------------------------------ //-----Begin Shape----------------------------------------------------------- if (m_ShowShape.GetCheck()) { m_pltFXD->PutShapeLeft(0.0f); m_pltFXD->PutShapeTop(0.0f); if (m_bDrawPersist) { m_pltFXD->PutShapeWidth((float)ltRaster.GetBitmapWidth()); m_pltFXD->PutShapeHeight((float)ltRaster.GetBitmapHeight()); } else { m_pltFXD->PutShapeWidth((float)m_ltRasView.GetScaleWidth()); m_pltFXD->PutShapeHeight((float)m_ltRasView.GetScaleHeight()); } m_pltFXD->PutBackgroundImageLeft(0.0f); m_pltFXD->PutBackgroundImageTop(0.0f); m_pltFXD->PutBackgroundImageWidth((float)m_ltRasView.GetScaleWidth()); m_pltFXD->PutBackgroundImageHeight((float)m_ltRasView.GetScaleHeight()); m_pltFXD->PutDstLeft(0); m_pltFXD->PutDstTop(0); m_pltFXD->PutDstRight((long)ltRaster.GetBitmapWidth()); m_pltFXD->PutDstBottom((long)ltRaster.GetBitmapHeight()); m_pltFXD->PutSrcLeft(0); m_pltFXD->PutSrcTop(0); m_pltFXD->PutSrcRight((long)ltRaster.GetBitmapWidth()); m_pltFXD->PutSrcBottom((long)ltRaster.GetBitmapHeight()); m_pltFXD->PutShapeBorderThickness(m_nShapeBorderWidth); m_pltFXD->PutShapeBorderColor(m_nShapeBorderColor); m_pltFXD->PutShapeInnerBandStyle(m_nShapeInnerStyle); m_pltFXD->PutShapeInnerBandThickness(m_nShapeInnerWidth); m_pltFXD->PutShapeInnerBandHiliteColor(m_nShapeInnerHiliteColor); m_pltFXD->PutShapeInnerBandShadowColor(m_nShapeInnerShadowColor); m_pltFXD->PutShapeOuterBandStyle(m_nShapeOuterStyle); m_pltFXD->PutShapeOuterBandThickness(m_nShapeOuterWidth); m_pltFXD->PutShapeOuterBandHiliteColor(m_nShapeOuterHiliteColor); m_pltFXD->PutShapeOuterBandShadowColor(m_nShapeOuterShadowColor); m_pltFXD->PutShapeBackgroundStyle(m_nShapeBackStyle); m_pltFXD->PutShapeBorderStyle(m_nShapeBorderStyle); m_pltFXD->PutShadowXDepth(m_nShapeShadowXDepth); m_pltFXD->PutShadowYDepth(m_nShapeShadowYDepth); m_pltFXD->PutShadowColor(m_nShapeShadowColor); m_pltFXD->PutBackgroundImageLeft(0.0f); m_pltFXD->PutBackgroundImageTop(0.0f); if(m_ltRasView2.GetRaster().GetBitmap()!= 0) { m_pltFXD->PutBackgroundImageWidth((float)m_ltRasView2.GetRaster().GetBitmapWidth()); m_pltFXD->PutBackgroundImageHeight((float)m_ltRasView2.GetRaster().GetBitmapHeight()); } if (m_nShapeFillStyle <= FXD_PATTERN_MAX) { m_pltFXD->PutPatternStyle(m_nShapeFillStyle); m_pltFXD->PutPatternForeColor(m_nShapeForeColor); m_pltFXD->PutPatternBackColor(m_nShapeBackColor); } else { m_pltFXD->PutGradientStyle(m_nShapeFillStyle); m_pltFXD->PutGradientStartColor(m_nShapeBackColor); m_pltFXD->PutGradientEndColor(m_nShapeForeColor); } { ILEADRaster * pltRaster = NULL; HRESULT hr; hr = ltRaster.m_lpDispatch->QueryInterface (IID_ILEADRaster, (void **)&pltRaster); if (FAILED (hr) || (pltRaster == NULL)) return; HWND hWnd = m_ltRasView.GetSafeHwnd(); HDC hDC = ::GetDC(hWnd); if ((m_pltFXD->ShapeBackgroundStyle == FXD_BACKSTYLE_TILED_IMAGE) || (m_pltFXD->ShapeBackgroundStyle == FXD_BACKSTYLE_TRANSLUCENT_TILED_IMAGE)) m_pltFXD->DrawShape (pltRaster, (long)hDC, m_nShapeStyle, m_ltRasView2.GetRaster().GetBitmap()); else m_pltFXD->DrawShape (pltRaster, (long)hDC,m_nShapeStyle, 0); ::ReleaseDC (hWnd, hDC); pltRaster->Release (); } } //-----End Shape------------------------------------------------------------- //-----Begin Text------------------------------------------------------------ if (m_ShowText.GetCheck()) { LPDISPATCH pDisp = m_oleTextFont.m_lpDispatch; pDisp->AddRef (); m_pltFXD->PutFont((IFontDisp *)pDisp); pDisp->Release (); if (m_bDrawPersist == VARIANT_FALSE) { m_pltFXD->PutTextLeft(m_ltRasView.GetScaleWidth() * 0.01f); m_pltFXD->PutTextTop(m_ltRasView.GetScaleHeight() * 0.01f); m_pltFXD->PutTextWidth(m_ltRasView.GetScaleWidth() * 0.98f); m_pltFXD->PutTextHeight(m_ltRasView.GetScaleHeight() * 0.98f); } else { m_pltFXD->PutTextLeft(ltRaster.GetBitmapWidth() * 0.01f); m_pltFXD->PutTextTop(ltRaster.GetBitmapHeight() * 0.01f); m_pltFXD->PutTextWidth(ltRaster.GetBitmapWidth() * 0.98f); m_pltFXD->PutTextHeight(ltRaster.GetBitmapHeight() * 0.98f); } m_pltFXD->PutTextAngle((short)m_nTextAngle); m_pltFXD->PutTextStyle(m_nTextStyle); m_pltFXD->PutTextAlign(m_nTextAlign); m_pltFXD->PutTextWordWrap((short)m_nTextWordWrap); m_pltFXD->PutTextHiliteColor(m_nTextHiliteColor); m_pltFXD->PutDrawFontColor(m_nTextColor); m_pltFXD->PutShadowXDepth(m_nTextShadowXDepth); m_pltFXD->PutShadowYDepth(m_nTextShadowYDepth); m_pltFXD->PutShadowColor(m_nTextShadowColor); { ILEADRaster * pltRaster = NULL; HRESULT hr; hr = ltRaster.m_lpDispatch->QueryInterface (IID_ILEADRaster, (void **)&pltRaster); if (FAILED (hr) || (pltRaster == NULL)) return; HWND hWnd = m_ltRasView.GetSafeHwnd(); HDC hDC = ::GetDC(hWnd); if (m_nTextUseForegroundImage) { m_pltFXD->DrawText(pltRaster, (long)hDC, (LPCTSTR)m_strTextSample, 0); } else { m_pltFXD->DrawText(pltRaster, (long)hDC, (LPCTSTR)m_strTextSample, 0); } ::ReleaseDC (hWnd, hDC); pltRaster->Release (); } } //-----End Text-------------------------------------------------------------- if (m_bDrawPersist == VARIANT_TRUE) m_ltRasView.ForceRepaint(); } } void CSpFxDlg::OnDrawpersist() { UpdateData (TRUE); if (m_bPersist) m_bDrawPersist = VARIANT_TRUE; else m_bDrawPersist = VARIANT_FALSE; m_pltFXD->PutDrawPersistence (m_bDrawPersist); } void CSpFxDlg::OnDestroy() { CDialog::OnDestroy(); if (m_pltRasIO) m_pltRasIO->Release (); if (m_pltFXD) m_pltFXD->Release (); if (m_pRasterEfxDlg) m_pRasterEfxDlg->Release (); m_pRasterKrnDlg->FreeDlg(); if(m_pRasterKrnDlg) m_pRasterKrnDlg->Release (); m_pltRasIO = NULL; m_pltFXD = NULL; }