本文整理汇总了C#中System.Windows.Media.DrawingImage类的典型用法代码示例。如果您正苦于以下问题:C# DrawingImage类的具体用法?C# DrawingImage怎么用?C# DrawingImage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DrawingImage类属于System.Windows.Media命名空间,在下文中一共展示了DrawingImage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Display_Loaded
private void Display_Loaded(object sender, RoutedEventArgs e)
{
drawingGroup = new DrawingGroup();
var imageSource = new DrawingImage(drawingGroup);
Display.Source = imageSource;
Redraw();
}
开发者ID:virrkharia,项目名称:dynamight,代码行数:7,代码来源:ProjectorCalibration.xaml.cs
示例2: HudRenderer
public HudRenderer(DrawingGroup drawGroup, DrawingImage drawImage, int width, int height)
{
drawingGroup = drawGroup;
drawingImage = drawImage;
displayHeight = height;
displayWidth = width;
}
开发者ID:NathanielRose,项目名称:KinectKannon,代码行数:7,代码来源:HudRenderer.cs
示例3: CreateVisuals
/// <summary>
/// Within the given line add the scarlet box behind the a
/// </summary>
private void CreateVisuals(ITextViewLine line)
{
//grab a reference to the lines in the current TextView
IWpfTextViewLineCollection textViewLines = _view.TextViewLines;
int start = line.Start;
int end = line.End;
//Loop through each character, and place a box around any a
for (int i = start; (i < end); ++i)
{
if (_view.TextSnapshot[i] == 'a')
{
SnapshotSpan span = new SnapshotSpan(_view.TextSnapshot, Span.FromBounds(i, i + 1));
Geometry g = textViewLines.GetMarkerGeometry(span);
if (g != null)
{
GeometryDrawing drawing = new GeometryDrawing(_brush, _pen, g);
drawing.Freeze();
DrawingImage drawingImage = new DrawingImage(drawing);
drawingImage.Freeze();
Image image = new Image();
image.Source = drawingImage;
//Align the image with the top of the bounds of the text geometry
Canvas.SetLeft(image, g.Bounds.Left);
Canvas.SetTop(image, g.Bounds.Top);
_layer.AddAdornment(AdornmentPositioningBehavior.TextRelative, span, null, image, null);
}
}
}
}
开发者ID:AlmatoolboxCE,项目名称:AlmaStyleFix,代码行数:37,代码来源:TextAdornment1.cs
示例4: MainWindow_Loaded
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
if (KinectSensor.KinectSensors.Count > 0)
{
this.sensor = KinectSensor.KinectSensors[0];
if (!this.sensor.IsRunning)
{
this.sensor.DepthStream.Range = DepthRange.Near;
this.sensor.DepthFrameReady += sensor_DepthFrameReady;
this.sensor.DepthStream.Enable();
this.sensor.SkeletonStream.EnableTrackingInNearRange = true;
this.sensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
this.sensor.SkeletonFrameReady += sensor_SkeletonFrameReady;
this.sensor.SkeletonStream.Enable();
this.sensor.Start();
}
this.drawingGroup = new DrawingGroup();
this.imageSource = new DrawingImage(this.drawingGroup);
this.SkeletonController.Source = this.imageSource;
}
}
开发者ID:hh54188,项目名称:King,代码行数:26,代码来源:MainWindow.xaml.cs
示例5: textBox_TextChanged
private void textBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
BitmapImage bmImage = new BitmapImage();
// textBox.PreviewKeyDown += EnterClicked;
if (image != null)
{
bmImage = new BitmapImage(new Uri(hh));
var visual = new DrawingVisual();
using (DrawingContext drawingContext = visual.RenderOpen())
{
string objTextBox = textBox.Text;
drawingContext.DrawImage(bmImage, new Rect(0, 0, bmImage.Width, bmImage.Height));
drawingContext.DrawText(
new FormattedText(objTextBox, CultureInfo.InvariantCulture, FlowDirection.LeftToRight,
new Typeface(comboBox.Text), Convert.ToInt32(comboBox1.SelectedItem), Brushes.Black), new Point(0, 250));
}
var imagei = new DrawingImage(visual.Drawing);
image.Source = imagei;
}
}
开发者ID:vjblind,项目名称:image-facile-c-,代码行数:28,代码来源:MainWindow.xaml.cs
示例6: TranslationAdornment
/// <summary>
/// Creates a square image and attaches an event handler to the layout changed event that
/// adds the the square in the upper right-hand corner of the TextView via the adornment layer
/// </summary>
/// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param>
public TranslationAdornment(IWpfTextView view)
{
_view = view;
Brush brush = new SolidColorBrush(Colors.BlueViolet);
brush.Freeze();
Brush penBrush = new SolidColorBrush(Colors.Red);
penBrush.Freeze();
Pen pen = new Pen(penBrush, 0.5);
pen.Freeze();
//draw a square with the created brush and pen
System.Windows.Rect r = new System.Windows.Rect(0, 0, 30, 30);
Geometry g = new RectangleGeometry(r);
GeometryDrawing drawing = new GeometryDrawing(brush, pen, g);
drawing.Freeze();
DrawingImage drawingImage = new DrawingImage(drawing);
drawingImage.Freeze();
_image = new Image();
_image.Source = drawingImage;
//Grab a reference to the adornment layer that this adornment should be added to
_adornmentLayer = view.GetAdornmentLayer("TranslationAdornment");
_view.ViewportHeightChanged += delegate { this.onSizeChange(); };
_view.ViewportWidthChanged += delegate { this.onSizeChange(); };
}
开发者ID:JeanAzzopardi,项目名称:TranslatorExtensionPackage,代码行数:34,代码来源:TranslationAdornment.cs
示例7: AddDecorationError
public void AddDecorationError(BasePropertyDeclarationSyntax _property, string textFull, string toolTipText, FixErrorCallback errorCallback)
{
var lineSpan = tree.GetLineSpan(_property.Span, usePreprocessorDirectives: false);
int lineNumber = lineSpan.StartLinePosition.Line;
var line = _textView.TextSnapshot.GetLineFromLineNumber(lineNumber);
var textViewLine = _textView.GetTextViewLineContainingBufferPosition(line.Start);
int startSpace = textFull.Length - textFull.TrimStart().Length;
int endSpace = textFull.Length - textFull.TrimEnd().Length;
SnapshotSpan span = new SnapshotSpan(_textView.TextSnapshot, Span.FromBounds(line.Start.Position + startSpace, line.End.Position - endSpace));
Geometry g = _textView.TextViewLines.GetMarkerGeometry(span);
if (g != null)
{
rects.Add(g.Bounds);
GeometryDrawing drawing = new GeometryDrawing(_brush, _pen, g);
drawing.Freeze();
DrawingImage drawingImage = new DrawingImage(drawing);
drawingImage.Freeze();
Image image = new Image();
image.Source = drawingImage;
//image.Visibility = Visibility.Hidden;
Canvas.SetLeft(image, g.Bounds.Left);
Canvas.SetTop(image, g.Bounds.Top);
_layer.AddAdornment(AdornmentPositioningBehavior.TextRelative, span, null, image, (t, ui) =>
{
rects.Remove(g.Bounds);
});
DrawIcon(span, g.Bounds.Left - 30, g.Bounds.Top, toolTipText, errorCallback);
}
}
开发者ID:jefflequeux,项目名称:DarkangeUtils,代码行数:35,代码来源:BaseMef.cs
示例8: KinectBodyView
/// <summary>
/// Initializes a new instance of the KinectBodyView class
/// </summary>
/// <param name="kinectSensor">Active instance of the KinectSensor</param>
public KinectBodyView(KinectSensor kinectSensor)
{
if (kinectSensor == null)
{
throw new ArgumentNullException("kinectSensor");
}
// get the coordinate mapper
_coordinateMapper = kinectSensor.CoordinateMapper;
// get the depth (display) extents
FrameDescription frameDescription = kinectSensor.DepthFrameSource.FrameDescription;
// get size of joint space
_displayWidth = frameDescription.Width;
_displayHeight = frameDescription.Height;
// Create the drawing group we'll use for drawing
_drawingGroup = new DrawingGroup();
// Create an image source that we can use in our image control
_imageSource = new DrawingImage(_drawingGroup);
}
开发者ID:praveenv4k,项目名称:indriya,代码行数:29,代码来源:KinectBodyView.cs
示例9: CreateAndAddAdornment
void CreateAndAddAdornment(ITextViewLine line, SnapshotSpan span, Brush brush, bool extendToRight)
{
var markerGeometry = _view.TextViewLines.GetMarkerGeometry(span);
double left = markerGeometry.Bounds.Left;
double width = extendToRight ? _view.ViewportWidth + _view.MaxTextRightCoordinate : markerGeometry.Bounds.Width;
Rect rect = new Rect(left, line.Top, width, line.Height);
RectangleGeometry geometry = new RectangleGeometry(rect);
GeometryDrawing drawing = new GeometryDrawing(brush, new Pen(), geometry);
drawing.Freeze();
DrawingImage drawingImage = new DrawingImage(drawing);
drawingImage.Freeze();
Image image = new Image();
image.Source = drawingImage;
Canvas.SetLeft(image, geometry.Bounds.Left);
Canvas.SetTop(image, geometry.Bounds.Top);
_layer.AddAdornment(AdornmentPositioningBehavior.TextRelative, span, null, image, null);
}
开发者ID:NoahRic,项目名称:BackgroundColorFix,代码行数:25,代码来源:BackgroundColorVisualManager.cs
示例10: ProjectorViewWindow
public ProjectorViewWindow()
{
InitializeComponent();
drawingGroup = new DrawingGroup();
var imageSource = new DrawingImage(drawingGroup);
Display.Source = imageSource;
}
开发者ID:virrkharia,项目名称:dynamight,代码行数:7,代码来源:ProjectorViewWindow.xaml.cs
示例11: Init
public void Init()
{
DrawingGroup dg = new DrawingGroup();
ImageDrawing id = new ImageDrawing(UnderlayImage, new Rect(0, 0, UnderlayImage.PixelWidth, UnderlayImage.PixelHeight));
dg.Children.Add(id);
pointsGeometryGroup = new GeometryGroup();
linesGeometryGroup = new GeometryGroup();
middlePointGeoGrp = new GeometryGroup();
if (points != null)
{
SetPointsGeometry();
}
GeometryDrawing gd = new GeometryDrawing(Brushes.Blue, null, pointsGeometryGroup);
dg.Children.Add(gd);
GeometryDrawing gd2 = new GeometryDrawing(null, new Pen(Brushes.LightGreen,3), linesGeometryGroup);
dg.Children.Add(gd2);
GeometryDrawing gd1 = new GeometryDrawing(Brushes.Red, null, middlePointGeoGrp);
dg.Children.Add(gd1);
Brush b = new SolidColorBrush(Colors.Red);
b.Opacity = 0.5;
mousePointGeometryDrwaing = new GeometryDrawing(b, null, null);
dg.Children.Add(mousePointGeometryDrwaing);
DrawingImage di = new DrawingImage(dg);
this.Source = di;
chosenPoint = -1;
}
开发者ID:gp1313,项目名称:morethantechnical,代码行数:33,代码来源:Window1.xaml.cs
示例12: MainWindow
public MainWindow()
{
drawingGroup = new DrawingGroup();
imageSource = new DrawingImage( drawingGroup );
this.DataContext = this;
InitializeComponent();
}
开发者ID:noa99kee,项目名称:K4W2-Book,代码行数:7,代码来源:MainWindow.xaml.cs
示例13: GetImageSourceFromAxoColor
public static ImageSource GetImageSourceFromAxoColor(AxoColor axoColor, int width, int height)
{
var innerRect = new Rect(0, 0, width, height);
var geometryDrawing = new GeometryDrawing() { Geometry = new RectangleGeometry(innerRect) };
geometryDrawing.Brush = new SolidColorBrush(GuiHelper.ToWpf(axoColor));
DrawingImage geometryImage = new DrawingImage(geometryDrawing);
geometryImage.Freeze(); // Freeze the DrawingImage for performance benefits.
return geometryImage;
}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:9,代码来源:MaterialConverter.cs
示例14: Manager
private Manager()
{
#region Creates Loading Threads
_loaderThreadForThumbnails = new Thread(LoaderThreadThumbnails)
{
IsBackground = true,
Priority = ThreadPriority.BelowNormal
};
_loaderThreadForThumbnails.Start();
_loaderThreadForNormalSize = new Thread(LoaderThreadNormalSize)
{
IsBackground = true,
Priority = ThreadPriority.BelowNormal
};
_loaderThreadForNormalSize.Start();
#endregion
Application.Current.Exit += Current_Exit;
#region Loading Images from Resources
var resourceDictionary = new ResourceDictionary
{
Source = new Uri("csCommon;component/Resources/Styles/Resources.xaml", UriKind.Relative)
};
_loadingImage = resourceDictionary["ImageLoading"] as DrawingImage;
_loadingImage.Freeze();
_errorThumbnail = resourceDictionary["ImageError"] as DrawingImage;
_errorThumbnail.Freeze();
#endregion
# region Create Loading Animation
ScaleTransform scaleTransform = new ScaleTransform(0.5, 0.5);
SkewTransform skewTransform = new SkewTransform(0, 0);
RotateTransform rotateTransform = new RotateTransform(0);
TranslateTransform translateTransform = new TranslateTransform(0, 0);
TransformGroup group = new TransformGroup();
group.Children.Add(scaleTransform);
group.Children.Add(skewTransform);
group.Children.Add(rotateTransform);
group.Children.Add(translateTransform);
DoubleAnimation doubleAnimation = new DoubleAnimation(0, 359, new TimeSpan(0, 0, 0, 1));
doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
rotateTransform.BeginAnimation(RotateTransform.AngleProperty, doubleAnimation);
_loadingAnimationTransform = group;
#endregion
}
开发者ID:TNOCS,项目名称:csTouch,代码行数:57,代码来源:Manager.cs
示例15: KinectBodyDrawer
/// <summary></summary>
/// <param name="kinectConnector"></param>
public KinectBodyDrawer(KinectConnector kinectConnector)
{
this.kinectConnector = kinectConnector;
drawingGroup = new DrawingGroup();
ImageSource = new DrawingImage(drawingGroup);
kinectConnector.BodyUpdated += (_, e) => Draw(e.Body);
}
开发者ID:malaybaku,项目名称:KinectForPepper,代码行数:11,代码来源:KinectBodyDrawer.cs
示例16: CreateImageToHighlightLine
private Image CreateImageToHighlightLine(Geometry geometry, LineResultMarker marker)
{
GeometryDrawing backgroundGeometry = new GeometryDrawing(marker.Fill, marker.Outline, geometry);
backgroundGeometry.Freeze();
DrawingImage backgroundDrawning = new DrawingImage(backgroundGeometry);
backgroundDrawning.Freeze();
return new Image {Source = backgroundDrawning};
}
开发者ID:BenHall,项目名称:lonestar,代码行数:10,代码来源:EditorHighlighterProcessor.cs
示例17: DrawThumbnail
public ImageSource DrawThumbnail(LayerModel layer)
{
var thumbnailRect = new Rect(0, 0, 18, 18);
var visual = new DrawingVisual();
using (var c = visual.RenderOpen())
c.DrawImage(ImageUtilities.BitmapToBitmapImage(Resources.mousemat), thumbnailRect);
var image = new DrawingImage(visual.Drawing);
return image;
}
开发者ID:SpoinkyNL,项目名称:Artemis,代码行数:10,代码来源:MousematType.cs
示例18: ShowMidPoint
public void ShowMidPoint()
{
DrawingGroup dg = new DrawingGroup();
ImageDrawing id = new ImageDrawing(UnderlayImage, new Rect(0, 0, UnderlayImage.PixelWidth, UnderlayImage.PixelHeight));
dg.Children.Add(id);
GeometryDrawing gd1 = new GeometryDrawing(Brushes.Red, null, middlePointGeoGrp);
dg.Children.Add(gd1);
DrawingImage di = new DrawingImage(dg);
this.Source = di;
}
开发者ID:gp1313,项目名称:morethantechnical,代码行数:10,代码来源:Window1.xaml.cs
示例19: BodyCamera
public BodyCamera(Image image, int width, int height)
{
this.width = width;
this.height = height;
drawingGroup = new DrawingGroup();
drawingImage = new DrawingImage(drawingGroup);
image.Source = drawingImage;
}
开发者ID:wuyuntao,项目名称:Mokap,代码行数:10,代码来源:BodyCamera.cs
示例20: CreateImage
/// <summary>
/// Freezes and then creates an image object from a GeometryGroup.
/// </summary>
/// <param name="brush">The fill brush for the group.</param>
/// <param name="pen">The Border pen for the group.</param>
/// <param name="group">The group to create an image from.</param>
/// <returns>An image object that can be added to the canvas.</returns>
public static Image CreateImage(this GeometryGroup group, Brush brush, Pen pen)
{
group.Freeze();
var drawing = new GeometryDrawing(brush, pen, group);
drawing.Freeze();
var drawingImage = new DrawingImage(drawing);
drawingImage.Freeze();
return new Image { Source = drawingImage };
}
开发者ID:vserrago,项目名称:LiveDescribe-Desktop,代码行数:19,代码来源:GeometryGroupExtensions.cs
注:本文中的System.Windows.Media.DrawingImage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论