public override void DrawEffectImage(Bitmap current, Bitmap next, EffectingPanel effecingPanel) { int step = 1; Graphics bg; Bitmap doubleBufferingBitmap; SolidBrush solidBrush; Rectangle rectangle; Matrix matrix = null; try { doubleBufferingBitmap = new Bitmap(current); // ダブルバッファリング用画面 bg = Graphics.FromImage(doubleBufferingBitmap); // ダブルバッファリング用画面描画用Graphics solidBrush = new SolidBrush(System.Drawing.Color.Black); rectangle = new Rectangle(0, 0, current.Width, current.Height); matrix = new Matrix(); step = doubleBufferingBitmap.Width / 50; if (step < 1) { step = 1; } ResetInterval(); for (int x = 0; x < doubleBufferingBitmap.Width; x += step) { bg.ResetTransform(); // リセット座標変換 bg.FillRectangle(solidBrush, rectangle); // current画像 matrix.Reset(); matrix.Translate(x, 0, MatrixOrder.Append); // 原点移動 bg.Transform = matrix; // 座標設定 bg.DrawImage(current, 0, 0); // next画像 matrix.Reset(); matrix.Translate(x - doubleBufferingBitmap.Width, 0, MatrixOrder.Append); bg.Transform = matrix; bg.DrawImage(next, 0, 0); effecingPanel.pictureBox.Image = doubleBufferingBitmap; effecingPanel.pictureBox.Refresh(); DoEventAtIntervals(); } matrix.Dispose(); bg.Dispose(); doubleBufferingBitmap.Dispose(); effecingPanel.pictureBox.Image = next; } catch (SystemException ex) { Console.WriteLine(ex.Message); } }
public override void DrawEffectImage(Bitmap current, Bitmap next, EffectingPanel effecingPanel) { Bitmap doubleBufferingBitmap = null; // ダブルバッファリング用画面 Graphics bg = null; // ダブルバッファリング用画面描画用Graphics SolidBrush solidBrush = null; Rectangle rectangle; ColorMatrix colorMatrix = null; ImageAttributes imageAttributes = null; try { doubleBufferingBitmap = new Bitmap(current); bg = Graphics.FromImage(doubleBufferingBitmap); solidBrush = new SolidBrush(System.Drawing.Color.Black); rectangle = new Rectangle(0, 0, current.Width, current.Height); colorMatrix = new ColorMatrix(); imageAttributes = new ImageAttributes(); ResetInterval(); // フェードアウト for (float alpha = 0.9f; alpha >= 0.0f; alpha -= 0.05f) { bg.FillRectangle(solidBrush, rectangle); colorMatrix.Matrix33 = alpha; imageAttributes.SetColorMatrix(colorMatrix); bg.DrawImage(current, rectangle, 0, 0, doubleBufferingBitmap.Width, doubleBufferingBitmap.Height, GraphicsUnit.Pixel, imageAttributes); Thread.Sleep(10); effecingPanel.pictureBox.Image = doubleBufferingBitmap; effecingPanel.pictureBox.Refresh(); DoEventAtIntervals(); } for (float alpha = 0.0f; alpha <= 1.0f; alpha += 0.05f) { bg.FillRectangle(solidBrush, rectangle); colorMatrix.Matrix33 = alpha; imageAttributes.SetColorMatrix(colorMatrix); bg.DrawImage(next, rectangle, 0, 0, doubleBufferingBitmap.Width, doubleBufferingBitmap.Height, GraphicsUnit.Pixel, imageAttributes); Thread.Sleep(10); effecingPanel.pictureBox.Image = doubleBufferingBitmap; effecingPanel.pictureBox.Refresh(); DoEventAtIntervals(); } bg.Dispose(); } catch (SystemException ex) { Console.WriteLine(ex.Message); } }
public override void DrawEffectImage(Bitmap current, Bitmap next, EffectingPanel effecingPanel) { Bitmap doubleBufferingBitmap = null; // ダブルバッファリング用画面 Graphics bg = null; // ダブルバッファリング用画面描画用Graphics SolidBrush solidBrush = null; Rectangle rectangle; Matrix matrix = null; try { int deltaDegree = 10; doubleBufferingBitmap = new Bitmap(current); bg = Graphics.FromImage(doubleBufferingBitmap); solidBrush = new SolidBrush(System.Drawing.Color.Black); rectangle = new Rectangle(0, 0, current.Width, current.Height); matrix = new Matrix(); ResetInterval(); for (int angle = 0; angle <= 360; angle += deltaDegree) { bg.ResetTransform(); // リセット座標変換 bg.FillRectangle(solidBrush, rectangle); matrix.Reset(); matrix.Translate(doubleBufferingBitmap.Width / 2, doubleBufferingBitmap.Height / 2, MatrixOrder.Append); // 原点移動 matrix.Rotate((float)angle); bg.Transform = matrix; // 座標設定 bg.DrawImage(current, -doubleBufferingBitmap.Width / 2, -doubleBufferingBitmap.Height / 2); // 画像の中心が(0, 0)になるように描画 effecingPanel.pictureBox.Image = doubleBufferingBitmap; effecingPanel.pictureBox.Refresh(); Thread.Sleep(20); DoEventAtIntervals(); } matrix.Dispose(); bg.Dispose(); doubleBufferingBitmap.Dispose(); } catch(SystemException ex) { Console.WriteLine(ex.Message); } }
public virtual void DrawEffectImage(Bitmap current, Bitmap next, EffectingPanel effecingPanel) { }