// FxDlg.cpp : implementation file // #include "stdafx.h" #include "FxDemo.h" #include "FxDlg.h" char *szFileName[] = { "..\\images\\sample1.cmp", "..\\images\\sample2.cmp", "..\\images\\sample3.cmp", "..\\images\\sample4.cmp", "..\\images\\sample5.cmp", }; ///////////////////////////////////////////////////////////////////////////// // CFxDemoDlg dialog CFxDemoDlg::CFxDemoDlg(CWnd* pParent /*=NULL*/) : CDialog(CFxDemoDlg::IDD, pParent) { //{{AFX_DATA_INIT(CFxDemoDlg) //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CFxDemoDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CFxDemoDlg) DDX_Control(pDX, IDC_SHOW_TRANSITION, m_ShowTransition); DDX_Control(pDX, IDC_SHOW_TEXT, m_ShowText); DDX_Control(pDX, IDC_SHOW_SHAPE, m_ShowShape); DDX_Control(pDX, IDC_LEAD, m_Lead); DDX_Control(pDX, IDC_LEADSHAPE, m_LeadShape); DDX_Control(pDX, IDC_LEADTEXT, m_LeadText); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CFxDemoDlg, CDialog) //{{AFX_MSG_MAP(CFxDemoDlg) 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_WM_PAINT() ON_WM_DESTROY() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CFxDemoDlg message handlers BOOL CFxDemoDlg::OnInitDialog() { CDialog::OnInitDialog(); // 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 m_nEffectStyle = EFX_EFFECT_ELLIPSE_C_OUT; m_nEffectGrain = 10; m_nEffectDelay = 0; m_nEffectMaxPass = 1; m_nEffectTransparent = 0; m_nEffectTransparentColor = RGB(0, 0, 0); m_nEffectWandWidth = 0; m_nEffectWandColor = RGB(255, 0, 0); m_nTransitionStyle = EFX_GRADIENT_CONE_FROM_B; m_nTransitionBackColor = RGB(255, 0, 0); m_nTransitionForeColor = RGB(0, 0, 255); m_nTransitionSteps = 100; m_nTransitionEffectStyle = 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 = EFX_SHAPE_STAR5; m_nShapeBackStyle = EFX_BACKSTYLE_TRANSPARENT; m_nShapeFillStyle = DRAWFILLSTYLE_UPWARD_DIAGONAL; m_nShapeBorderColor = RGB(192, 192, 192); m_nShapeBorderStyle = EFX_BORDERSTYLE_SOLID; m_nShapeBorderWidth = 3; m_nShapeInnerStyle = EFX_INNERSTYLE_INSET; m_nShapeInnerWidth = 3; m_nShapeInnerHiliteColor = RGB(255, 255, 255); m_nShapeInnerShadowColor = RGB(128, 128, 128); m_nShapeOuterStyle = 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 = EFX_TEXTSTYLE_OUTLINEBLOCK; m_nTextAlign = EFX_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; UNLOCKSUPPORT(m_Lead); UNLOCKSUPPORT(m_LeadShape); UNLOCKSUPPORT(m_LeadText); m_nFileIndex = 0; m_Lead.SetEnableMethodErrors(FALSE); m_Lead.SetAutoPan(FALSE); m_Lead.SetAutoRepaint(FALSE); m_Lead.SetAutoScroll(TRUE); m_Lead.SetBackErase(FALSE); m_Lead.SetEnableProgressEvent(FALSE); m_Lead.SetPaintSizeMode(PAINTSIZEMODE_STRETCH); m_Lead.SetScaleMode(3); m_LeadShape.SetEnableMethodErrors(FALSE); m_LeadShape.SetAutoRepaint(FALSE); m_LeadShape.SetAutoScroll(TRUE); m_LeadShape.SetBackErase(FALSE); m_LeadShape.SetEnableProgressEvent(FALSE); m_LeadShape.SetPaintSizeMode(PAINTSIZEMODE_NORMAL); m_LeadShape.SetScaleMode(3); m_LeadShape.ShowWindow(SW_HIDE); m_LeadText.SetEnableMethodErrors(FALSE); m_LeadText.SetAutoRepaint(FALSE); m_LeadText.SetAutoScroll(TRUE); m_LeadText.SetBackErase(FALSE); m_LeadText.SetEnableProgressEvent(FALSE); m_LeadText.SetPaintSizeMode(PAINTSIZEMODE_NORMAL); m_LeadText.SetScaleMode(3); m_LeadText.ShowWindow(SW_HIDE); CoInitialize(NULL); HRESULT hr; m_pRasterKrnDlg = NULL; hr = CoCreateInstance( CLSID_LEADRasterDlgKrn_D, NULL, CLSCTX_ALL, IID_ILEADRasterDlgKrn_D, (void**)&m_pRasterKrnDlg ); if (FAILED(hr)){DisplayLEADError(ERROR_INV_PARAMETER);EndDialog(0); return FALSE;} m_pRasterKrnDlg->InitDlg(INIT_WITH_COLOR); m_pRasterKrnDlg->EnableMethodErrors = FALSE; m_pRasterEfxDlg=NULL; hr = CoCreateInstance( CLSID_LEADRasterDlgEfx_D, NULL, CLSCTX_ALL, IID_ILEADRasterDlgEfx_D, (void**)&m_pRasterEfxDlg ); if (FAILED(hr)){DisplayLEADError(ERROR_INV_PARAMETER);EndDialog(0); return FALSE;} m_pRasterEfxDlg->EnableMethodErrors = FALSE; char buf[MAX_PATH]; GetCurrentDirectory(MAX_PATH, buf); m_szAppPath = buf; return TRUE; // return TRUE unless you set the focus to a control } void CFxDemoDlg::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_Lead.GetBitmap()); nResult = m_pRasterEfxDlg->ShowEffectDlg((long)this->m_hWnd); 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 CFxDemoDlg::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_Lead.GetBitmap()); nResult = m_pRasterEfxDlg->ShowTransitionDlg((long)this->m_hWnd); 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 CFxDemoDlg::OnShape() { int nResult; CRect rcRect; 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_Lead.GetBitmap()); nResult = m_pRasterEfxDlg->ShowShapeDlg((long)this->m_hWnd); 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_LeadShape.SetBitmap(m_pRasterEfxDlg->GetShape()->BackgroundBitmap); m_ShowShape.SetCheck(TRUE); GetWindowRect(rcRect); InvalidateRect(rcRect, FALSE); } } void CFxDemoDlg::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_Lead.GetBitmap()); nResult = m_pRasterEfxDlg->ShowTextDlg((long)this->m_hWnd); 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 CFxDemoDlg::OnShow() { int nResult; //-----Begin Transition------------------------------------------------------ if (m_ShowTransition.GetCheck()) { if (m_nTransitionStyle <= EFX_PATTERN_MAX) { m_Lead.SetTransitionStyle(EFX_TRANSITION_PATTERN); if (m_nTransitionStyle == EFX_PATTERN_SOLID) { m_Lead.SetPatternStyle(m_nTransitionStyle); } else { m_Lead.SetPatternStyle(m_nTransitionStyle+1); } m_Lead.SetPatternForeColor(m_nTransitionForeColor); m_Lead.SetPatternBackColor(m_nTransitionBackColor); } else { m_Lead.SetTransitionStyle(EFX_TRANSITION_GRADIENT); m_Lead.SetEffectDelay(m_nTransitionEffectDelay); m_Lead.SetGradientStyle(m_nTransitionStyle); m_Lead.SetGradientStartColor(m_nTransitionForeColor); m_Lead.SetGradientEndColor(m_nTransitionBackColor); m_Lead.SetGradientSteps(m_nTransitionSteps); } m_Lead.SetTransitionEffect(m_nTransitionEffectStyle); m_Lead.SetEffectGrain(m_nTransitionEffectGrain); m_Lead.SetEffectDelay(m_nTransitionEffectDelay); m_Lead.SetPaintMaxPasses(m_nTransitionEffectMaxPass); m_Lead.SetBitmapEnableTransparency(m_nTransitionEffectTransparent); m_Lead.SetBitmapTransparentColor(m_nTransitionEffectTransparentColor); m_Lead.SetWandSize(m_nTransitionEffectWandWidth); m_Lead.SetWandColor(m_nTransitionEffectWandColor); } else { m_Lead.SetTransitionEffect(EFX_EFFECT_NONE); m_Lead.SetTransitionStyle(EFX_TRANSITION_NONE); } m_Lead.ForceRepaint(); //-----End Transition-------------------------------------------------------- //-----Begin Effect---------------------------------------------------------- if (m_nFileIndex >= sizeof(szFileName) / sizeof(szFileName[0])) { m_nFileIndex = 0; } CString csFile; csFile.Format("%s\\%s", m_szAppPath, szFileName[m_nFileIndex]); nResult = m_Lead.Load(csFile, 0, 0, 1); if (nResult != 0) { AfxMessageBox("Please change the filenames."); return; } m_nFileIndex++; m_Lead.SetPaintEffect(m_nEffectStyle); m_Lead.SetEffectGrain(m_nEffectGrain); m_Lead.SetEffectDelay(m_nEffectDelay); m_Lead.SetPaintMaxPasses(m_nEffectMaxPass); m_Lead.SetBitmapEnableTransparency(m_nEffectTransparent); m_Lead.SetBitmapTransparentColor(m_nEffectTransparentColor); m_Lead.SetWandSize(m_nEffectWandWidth); m_Lead.SetWandColor(m_nEffectWandColor); m_Lead.ForceRepaint(); //-----End Effect------------------------------------------------------------ //-----Begin Shape----------------------------------------------------------- if (m_ShowShape.GetCheck()) { m_Lead.SetShapeLeft(0.0f); m_Lead.SetShapeTop(0.0f); m_Lead.SetShapeWidth((float)m_Lead.GetScaleWidth()); m_Lead.SetShapeHeight((float)m_Lead.GetScaleHeight()); m_Lead.SetShapeBorderThickness(m_nShapeBorderWidth); m_Lead.SetShapeBorderColor(m_nShapeBorderColor); m_Lead.SetShapeInnerBandStyle(m_nShapeInnerStyle); m_Lead.SetShapeInnerBandThickness(m_nShapeInnerWidth); m_Lead.SetShapeInnerBandHiliteColor(m_nShapeInnerHiliteColor); m_Lead.SetShapeInnerBandShadowColor(m_nShapeInnerShadowColor); m_Lead.SetShapeOuterBandStyle(m_nShapeOuterStyle); m_Lead.SetShapeOuterBandThickness(m_nShapeOuterWidth); m_Lead.SetShapeOuterBandHiliteColor(m_nShapeOuterHiliteColor); m_Lead.SetShapeOuterBandShadowColor(m_nShapeOuterShadowColor); m_Lead.SetShapeBackgroundStyle(m_nShapeBackStyle); m_Lead.SetShapeBorderStyle(m_nShapeBorderStyle); m_Lead.SetShadowXDepth(m_nShapeShadowXDepth); m_Lead.SetShadowYDepth(m_nShapeShadowYDepth); m_Lead.SetShadowColor(m_nShapeShadowColor); m_Lead.SetBackgroundImageLeft(0.0f); m_Lead.SetBackgroundImageTop(0.0f); m_Lead.SetBackgroundImageWidth((float)m_Lead.GetScaleWidth()); m_Lead.SetBackgroundImageHeight((float)m_Lead.GetScaleHeight()); if (m_nShapeFillStyle <= EFX_PATTERN_MAX) { m_Lead.SetTransitionStyle(EFX_TRANSITION_PATTERN); m_Lead.SetPatternStyle(m_nShapeFillStyle); m_Lead.SetPatternForeColor(m_nShapeForeColor); m_Lead.SetPatternBackColor(m_nShapeBackColor); } else { m_Lead.SetTransitionStyle(EFX_TRANSITION_GRADIENT); m_Lead.SetGradientStyle(m_nShapeFillStyle); m_Lead.SetGradientStartColor(m_nShapeForeColor); m_Lead.SetGradientEndColor(m_nShapeBackColor); } m_Lead.DrawShape(m_nShapeStyle, m_LeadShape.GetBitmap()); } //-----End Shape------------------------------------------------------------- //-----Begin Text------------------------------------------------------------ if (m_ShowText.GetCheck()) { m_Lead.SetFont(m_oleTextFont); m_Lead.SetTextLeft(m_Lead.GetScaleWidth() * 0.1f); m_Lead.SetTextTop(m_Lead.GetScaleHeight() * 0.1f); m_Lead.SetTextWidth(m_Lead.GetScaleWidth() * 0.8f); m_Lead.SetTextHeight(m_Lead.GetScaleHeight() * 0.8f); m_Lead.SetTextAngle((short)m_nTextAngle); m_Lead.SetTextStyle(m_nTextStyle); m_Lead.SetTextAlign(m_nTextAlign); m_Lead.SetTextWordWrap(m_nTextWordWrap); m_Lead.SetTextHiliteColor(m_nTextHiliteColor); m_Lead.SetDrawFontColor(m_nTextColor); m_Lead.SetShadowXDepth(m_nTextShadowXDepth); m_Lead.SetShadowYDepth(m_nTextShadowYDepth); m_Lead.SetShadowColor(m_nTextShadowColor); if (m_nTextUseForegroundImage) { m_Lead.DrawText((LPCTSTR)m_strTextSample, m_LeadText.GetBitmap()); } else { m_Lead.DrawText((LPCTSTR)m_strTextSample, 0); } } //-----End Text-------------------------------------------------------------- } void CFxDemoDlg::OnPaint() { CPaintDC dc(this); // device context for painting OnShow(); } BEGIN_EVENTSINK_MAP(CFxDemoDlg, CDialog) //{{AFX_EVENTSINK_MAP(CFxDemoDlg) ON_EVENT(CFxDemoDlg, IDC_LEAD, 18 /* PaintNotification */, OnPaintNotificationLead, VTS_I2 VTS_I2) //}}AFX_EVENTSINK_MAP END_EVENTSINK_MAP() void CFxDemoDlg::OnPaintNotificationLead(short uPass, short uType) { if((uType == EFX_NOTIFY_IMAGE) && (uPass == 0)) { m_Lead.SetEffectDelay(m_nEffectDelay); m_Lead.SetEffectGrain(m_nEffectGrain); m_Lead.SetWandSize(m_nEffectWandWidth); m_Lead.SetWandColor(m_nEffectWandColor); m_Lead.SetBitmapEnableTransparency(m_nEffectTransparent); m_Lead.SetBitmapTransparentColor(m_nEffectTransparentColor); } if((uType == EFX_NOTIFY_TRANSITION) && (uPass == m_Lead.GetPaintMaxPasses())) { //set the colors m_Lead.SetPaintEffect(m_nEffectStyle); m_Lead.SetPaintMaxPasses(m_nEffectMaxPass); } } int CFxDemoDlg::DisplayLEADError(int nCode) { CString str; if(nCode) { str.Format("A LEADTOOLS error has occured.\nCODE = %d", nCode); MessageBox(str); } return(nCode); } void CFxDemoDlg::OnDestroy() { CDialog::OnDestroy(); m_pRasterKrnDlg->FreeDlg(); if (m_pRasterKrnDlg != NULL) m_pRasterKrnDlg->Release(); if (m_pRasterEfxDlg != NULL) m_pRasterEfxDlg->Release(); }