public AnimationMaker(System.Drawing.Size pSize, LedAnimation pAnimation) { this.InitializeComponent(); pAnimation.EAnimation.PageCount = 0; base.Size = pSize; this.displaySize = pSize; this.animation = pAnimation; this.Wpr = new AnimationMaker.FlaWndProc(this.EFFWndProc); this.OldWndProc = AnimationMaker.SetWindowLong(this.player.Handle, -4, this.Wpr); this.ChangeEffect(); }
public void Make() { if (this.isBackgroundModel) { this.background.Draw(AnimationMaker.GetImageOfControl(this.player, this.displaySize)); } else { this.animation.Draw(AnimationMaker.GetImageOfControl(this.player, this.displaySize)); } this.GetCount++; }
public AnimationMaker(System.Drawing.Size pSize, LedBackground pBackground) { if (pSize.Width > 1000) { pSize.Width = 1000; } this.isBackgroundModel = true; this.InitializeComponent(); base.Size = pSize; this.displaySize = pSize; this.Wpr = new AnimationMaker.FlaWndProc(this.EFFWndProc); this.OldWndProc = AnimationMaker.SetWindowLong(this.player.Handle, -4, this.Wpr); this.background = pBackground; this.background.PageCount = 0; }
private IntPtr EFFWndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam) { IntPtr result; try { if (msg == 516) { result = (IntPtr)0; } else { result = AnimationMaker.CallWindowProc(this.OldWndProc, hWnd, msg, wParam, lParam); } } catch { result = hWnd; } return(result); }
public void changeMaterial() { if (this.isBackgroundModel) { try { this.player.Location = new System.Drawing.Point(0, 0); this.player.Size = new System.Drawing.Size(this.displaySize.Width + 10, this.displaySize.Height + 10); this.player.Movie = LedCommonConst.MaterialSwfPath + this.background.MaterialName; this.player.Scale(new System.Drawing.SizeF((float)(this.displaySize.Width + 10), (float)(this.displaySize.Height + 10))); this.player.ScaleMode = 2; this.player.Play(); return; } catch { return; } } LedEffects dataByName = AnimationMaker.GetDataByName(this.animation.AnimationEffectsSetting.Name); FileStream fileStream = new FileStream(AnimationMaker.tempDir + "\\efl.zhs", FileMode.Create); FileStream fileStream2 = new FileStream(AnimationMaker.tempDir + "\\efl1.zhs", FileMode.Create); fileStream.Write(dataByName.OriginalData, 0, dataByName.OriginalData.Length); fileStream2.Write(dataByName.OriginalData, 0, dataByName.OriginalData.Length); fileStream.Close(); fileStream2.Close(); File.Delete(AnimationMaker.tempDir + "\\back.xml"); try { this.player.Movie = AnimationMaker.tempDir + "\\efl1.zhs"; } catch { this.player.Movie = AnimationMaker.tempDir + "\\efl.zhs"; } this.RefrshAnimation(false); }
public static System.Drawing.Bitmap GetImageOfControl(Control control, System.Drawing.Size pSize) { int width = pSize.Width; int height = pSize.Height; System.Drawing.Graphics graphics = control.CreateGraphics(); System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(width, height, graphics); System.Drawing.Graphics graphics2 = System.Drawing.Graphics.FromImage(bitmap); IntPtr hdc = graphics.GetHdc(); IntPtr hdc2 = graphics2.GetHdc(); AnimationMaker.BitBlt(hdc2, 0, 0, width, height, hdc, 0, 0, AnimationMaker.TernaryRasterOperations.SRCCOPY); graphics.ReleaseHdc(hdc); graphics2.ReleaseHdc(hdc2); graphics.Dispose(); if (pSize.Width > 950) { graphics2.FillRectangle(new System.Drawing.SolidBrush(System.Drawing.Color.Black), new System.Drawing.Rectangle(bitmap.Width - 5, 0, 4, bitmap.Height)); } graphics2.Dispose(); return(bitmap); }
public void RefrshAnimation(bool pGenerate) { this.isGenerate = pGenerate; if (this.isBackgroundModel) { return; } System.Drawing.Bitmap image = new System.Drawing.Bitmap(10, 10); System.Drawing.Graphics.FromImage(image); System.Drawing.Size stringToBitmapSize = LedGraphics.GetStringToBitmapSize("国", this.animation.EAnimation.Font.GetFont()); System.Drawing.Size stringToBitmapSize2 = LedGraphics.GetStringToBitmapSize("w", this.animation.EAnimation.Font.GetFont()); int num = stringToBitmapSize.Width * 100; int num2 = stringToBitmapSize2.Width * 110; int num3 = (int)((float)(num / 100) * -0.06f); num3 += this.animation.AnimationEffectsSetting.Kerning; this.finalSpace = num3; if (this.isLoadingParam) { return; } System.Drawing.Size size = this.displaySize; string text = "<invoke name=\"addText\" returntype=\"xml\"><arguments><string>"; text = text + this.GetMovieString() + "`"; text = text + size.Width.ToString() + "`"; text = text + size.Height.ToString() + "`"; text = text + this.TransFont(this.animation.EAnimation.Font.FamilyName) + "`"; text = text + (int)((double)this.animation.EAnimation.Font.Size / 72.0 * 96.0) + "`"; text = text + (int)this.animation.EAnimation.Align + "`"; text = text + num3.ToString() + "`"; text = text + this.animation.EAnimation.VerticalOffset + "`"; text = text + this.animation.EAnimation.HorizontalOffset + "`"; text = text + AnimationMaker.GetColorRGB(this.animation.EAnimation.ForeColor) + "`"; text = text + AnimationMaker.GetColorRGB(this.animation.EAnimation.ForeColor) + "`"; text = text + AnimationMaker.GetColorRGB(this.animation.EAnimation.ForeColor) + "`"; text = text + this.GetboolStr(this.animation.EAnimation.ColorRandomized) + "`"; text = text + this.GetboolStr(this.animation.EAnimation.Font.Bold) + "`"; text = text + this.GetboolStr(this.animation.EAnimation.Font.Italic) + "`"; text = text + this.GetboolStr(this.animation.EAnimation.Font.Underline) + "`"; text = text + this.GetboolStr(pGenerate) + "`"; text = text + this.animation.EAnimation.Speed + "`"; text = text + this.GetAlphaString(this.animation.EAnimation.Alpha) + "`"; text = text + AnimationMaker.GetColorRGB(this.animation.EAnimation.BackColor) + "`"; text = text + this.animation.Background.EffectsValueName + ".swf`"; text = text + this.GetboolStr(this.animation.Background.Enabled) + "`"; if (AnimationMaker.IsEffectNoStay(this.animation.AnimationEffectsSetting.Name)) { text += "0`"; } else { text += "2000`"; } text = text + num.ToString() + "`"; text = text + num2.ToString() + "`"; text += "</string></arguments></invoke>"; try { this.player.CallFunction(text); } catch { } }
public void ChangeEffect() { if (this.isBackgroundModel) { try { LedEffects dataByName = AnimationMaker.GetDataByName(this.background.EffectsValueName); FileStream fileStream = new FileStream(AnimationMaker.tempDir + "\\efl.zhs", FileMode.Create); FileStream fileStream2 = new FileStream(AnimationMaker.tempDir + "\\efl1.zhs", FileMode.Create); StreamWriter streamWriter = new StreamWriter(AnimationMaker.tempDir + "\\back.xml", false); fileStream.Write(dataByName.OriginalData, 0, dataByName.OriginalData.Length); fileStream2.Write(dataByName.OriginalData, 0, dataByName.OriginalData.Length); string text = dataByName.PropertyXml.Replace("Movie.Back.Width", (this.displaySize.Width + 20).ToString()); text = text.Replace("Movie.Back.Height", (this.displaySize.Height + 10).ToString()); int num = text.IndexOf("Param.Back.Number"); if (num > 0) { string text2 = text.Substring(num, 20); string backgroundNumber = AnimationMaker.GetBackgroundNumber(this.background.EffectsValueName, text2, this.displaySize); text = text.Replace(text2, backgroundNumber); streamWriter.Write(text); } else { streamWriter.Write(text); } streamWriter.Close(); fileStream.Close(); fileStream2.Close(); this.player.Size = new System.Drawing.Size(this.player.Width + 3, this.player.Height); try { this.player.Movie = AnimationMaker.tempDir + "\\efl.zhs"; } catch { this.player.Movie = AnimationMaker.tempDir + "\\efl1.zhs"; } return; } catch { return; } } LedEffects dataByName2 = AnimationMaker.GetDataByName(this.animation.AnimationEffectsSetting.Name); FileStream fileStream3 = new FileStream(AnimationMaker.tempDir + "\\efl.zhs", FileMode.Create); FileStream fileStream4 = new FileStream(AnimationMaker.tempDir + "\\efl1.zhs", FileMode.Create); fileStream3.Write(dataByName2.OriginalData, 0, dataByName2.OriginalData.Length); fileStream4.Write(dataByName2.OriginalData, 0, dataByName2.OriginalData.Length); fileStream3.Close(); fileStream4.Close(); File.Delete(AnimationMaker.tempDir + "\\back.xml"); try { this.player.Movie = AnimationMaker.tempDir + "\\efl1.zhs"; } catch { this.player.Movie = AnimationMaker.tempDir + "\\efl.zhs"; } this.RefrshAnimation(false); }