protected override void DrawCanvasContent(Graphics graphics)
        {
            // if our cached copy is old or nonexistant, redraw it and save it
            // TODO: this may not be perfectly accurate, since it's possible for someone else to come along and render
            // the effect, which would make it non-dirty, but we don't know about it yet. Not ideal. Add a serial or GUID to effect rendering, to be able to track it.
            if (EffectNode.Effect.IsDirty || CachedCanvasContent == null ||
                CachedCanvasContent.Width != (int)graphics.VisibleClipBounds.Width ||
                CachedCanvasContent.Height != (int)graphics.VisibleClipBounds.Height)
            {
                CachedCanvasContent = new Bitmap((int)graphics.VisibleClipBounds.Width, (int)graphics.VisibleClipBounds.Height);
                EffectRasterizer effectRasterizer = new EffectRasterizer();
                using (Graphics g = Graphics.FromImage(CachedCanvasContent)) {
                    effectRasterizer.Rasterize(EffectNode.Effect, g);
                }
            }

            graphics.DrawImage(CachedCanvasContent, 0, 0);

            // add text describing the effect
            using (Font f = new Font("Arial", 7))
                using (Brush b = new SolidBrush(TextColor)) {
                    graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
                    graphics.DrawString(EffectNode.Effect.EffectName, f, b, new RectangleF(5, 3, 50, 12));
                    graphics.DrawString("Start: " + EffectNode.StartTime.ToString(@"m\:ss\.fff"), f, b, new PointF(60, 3));
                    graphics.DrawString("Length: " + EffectNode.TimeSpan.ToString(@"m\:ss\.fff"), f, b, new PointF(60, 16));
                }

            ElementTimeHasChangedSinceDraw = false;
        }
 protected override void DrawCanvasContent(Graphics graphics)
 {
     EffectRasterizer.Rasterize(EffectNode.Effect, graphics);
     ElementTimeHasChangedSinceDraw = false;
 }
Ejemplo n.º 3
0
 protected override void DrawCanvasContent(Graphics g, TimeSpan startTime, TimeSpan endTime, int overallWidth, bool redBorder)
 {
     EffectRasterizer.Rasterize(this, g, startTime, endTime, overallWidth);
     ElementTimeHasChangedSinceDraw = false;
 }
Ejemplo n.º 4
0
        protected override void DrawCanvasContent(Graphics graphics)
        {
            // if our cached copy is old or nonexistant, redraw it and save it
            // TODO: this may not be perfectly accurate, since it's possible for someone else to come along and render
            // the effect, which would make it non-dirty, but we don't know about it yet. Not ideal. Add a serial or GUID to effect rendering, to be able to track it.
            if (EffectNode.Effect.IsDirty || CachedCanvasContent == null ||
                CachedCanvasContent.Width != (int)graphics.VisibleClipBounds.Width ||
                CachedCanvasContent.Height != (int)graphics.VisibleClipBounds.Height)
            {
                CachedCanvasContent = new Bitmap((int)graphics.VisibleClipBounds.Width, (int)graphics.VisibleClipBounds.Height);
                EffectRasterizer effectRasterizer = new EffectRasterizer();
                using (Graphics g = Graphics.FromImage(CachedCanvasContent)) {
                    effectRasterizer.Rasterize(EffectNode.Effect, g);
                }
            }

            graphics.DrawImage(CachedCanvasContent, 0, 0);

            // add text describing the effect
            using (Font f = new Font("Arial", 7))
            using (Brush b = new SolidBrush(TextColor)) {
                graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
                graphics.DrawString(EffectNode.Effect.EffectName, f, b, new RectangleF(5, 3, 50, 12));
                graphics.DrawString("Start: " + EffectNode.StartTime.ToString(@"m\:ss\.fff"), f, b, new PointF(60, 3));
                graphics.DrawString("Length: " + EffectNode.TimeSpan.ToString(@"m\:ss\.fff"), f, b, new PointF(60, 16));
            }

            ElementTimeHasChangedSinceDraw = false;
        }