Beispiel #1
0
        void Canvas_Draw(CanvasControl sender, CanvasDrawEventArgs args)
        {
            if (CanvasImage.IsHistogramSupported(sender.Device))
            {
                SetEffectProperties();

                // Draw the image.
                if (!ThumbnailGenerator.IsDrawingThumbnail)
                {
                    args.DrawingSession.DrawImage(hueEffect, (sender.Size.ToVector2() - bitmap.Size.ToVector2()) * new Vector2(0.5f, 0.25f));
                }

                // Overlay a histogram for each color channel.
                args.DrawingSession.Blend = CanvasBlend.Add;

                DrawHistogram(args.DrawingSession, sender.Size, EffectChannelSelect.Red, redBrush);
                DrawHistogram(args.DrawingSession, sender.Size, EffectChannelSelect.Green, greenBrush);
                DrawHistogram(args.DrawingSession, sender.Size, EffectChannelSelect.Blue, blueBrush);
            }
            else
            {
                DrawNotSupported(args.DrawingSession, sender.Size);
            }
        }