drawingvisual

Bitmap cache on DrawingVisual has blurry parts

喜夏-厌秋 提交于 2020-01-15 11:48:29
问题 Recently I switched to DrawingVisuals to increase the performance of our trending graphs (especially zooming and panning). Here's the code I have: blocksToBeRendered = (baseItem as AvgCurve).GetStreamGeometryBlocks(ActualWidth, ActualHeight, _minPoint.X, _maxPoint.X, FixTimeStep ? _timeStep : 0, IsMainChart); Pen stroke = new Pen((baseItem as AvgCurve).LineBrush, 1); foreach (GeometryGroup group in blocksToBeRendered) { if (group.Children.Count != 0) { if (!cachedBlocks[baseItem].Any(x => x

Dynamically add Columns to DataGrid in wpf

可紊 提交于 2019-12-12 09:44:44
问题 I am currently working on a custom canvas and in that i have to add a table,So i thought dataGrid would be fine. SO i Want to create a " Table" from "Datagrid" by which user can add a table to the canvas at runtime. Till now, I have tried to Populate DataGrid With a list and succeded. How Can I add Columns to a Datagrid at runtime,such that the number of columns and header value Would be taken from the user at runtime using a textbox and based on the value of the textbox the datagrid should

Width and Height of the Image in RenderTargetBitmap in WPF

六眼飞鱼酱① 提交于 2019-12-11 12:40:23
问题 Using the below code I'm drawing on DrawingVisual then rendering it to an Image using RenderTargetBitmap . The final Image is later added to a Canvas and displayed on the screen. My problem is with the pixelWidth and pixelHeight arguments the RenderTargetBitmap method wants. What valued should I give to it? I have noticed that if I give it lower numbers parts of the image is not rendered. On what basis should I choose these? I have given it 1000 in the code below. public class

Windows update KB4040972/73 causes black images with WPF classes

你说的曾经没有我的故事 提交于 2019-12-05 18:39:07
问题 I have an application relying on Deep zoom images (convertion from a PNG to a pyramid of JPGs in various scale) which we use DeepZoomTools.dll for. This is relying on PresentationCore.dll and has been working fine for years. After the rollout of KB4040972 and KB4040973, the conversion from PNG to JPG generates (depending on coordinates) black images instead of the image it should contain. If the below code is run in a console or desktop app, it works. It ONLY doesn't work if run under high

Windows update KB4040972/73 causes black images with WPF classes

我与影子孤独终老i 提交于 2019-12-04 03:07:43
I have an application relying on Deep zoom images (convertion from a PNG to a pyramid of JPGs in various scale) which we use DeepZoomTools.dll for. This is relying on PresentationCore.dll and has been working fine for years. After the rollout of KB4040972 and KB4040973, the conversion from PNG to JPG generates (depending on coordinates) black images instead of the image it should contain. If the below code is run in a console or desktop app, it works. It ONLY doesn't work if run under high privilege SYSTEM account (e.g. from Task scheduler). I have created a project to reproduce the issue,

Fast 2D graphics in WPF

て烟熏妆下的殇ゞ 提交于 2019-11-29 19:26:52
I need to draw a large amount of 2D elements in WPF, such as lines and polygons. Their position also needs to be updated constantly. I have looked at many of the answers here which mostly suggested using DrawingVisual or overriding the OnRender function. To test these methods I've implemented a simple particle system rendering 10000 ellipses and I find that the drawing performance is still really terrible using both of these approaches. On my PC I can't get much above 5-10 frames a second. which is totally unacceptable when you consider that I easily draw 1/2 million particles smoothly using

Fast 2D graphics in WPF

六眼飞鱼酱① 提交于 2019-11-28 14:53:34
问题 I need to draw a large amount of 2D elements in WPF, such as lines and polygons. Their position also needs to be updated constantly. I have looked at many of the answers here which mostly suggested using DrawingVisual or overriding the OnRender function. To test these methods I've implemented a simple particle system rendering 10000 ellipses and I find that the drawing performance is still really terrible using both of these approaches. On my PC I can't get much above 5-10 frames a second.

The reason behind slow performance in WPF

醉酒当歌 提交于 2019-11-27 13:11:29
问题 I'm creating a large number of texts in WPF using DrawText and then adding them to a single Canvas . I need to redraw the screen in each MouseWheel event and I realized that the performance is a bit slow, so I measured the time the objects are created and it was less than 1 milliseconds! So what could be the problem? A long time ago I guess I read somewhere that it actually is the Rendering that takes the time, not creating and adding the visuals. Here is the code I'm using to create the text