我TextBlock在一个3D面板(Planerator)中放了一个,我用它Storyboard来制作动画.(作为抓取文本)
当视野为1时,一切正常,但如果我将视野设置为50以上,帧速率将急剧下降,渲染将会不稳定.
我用了CompositionTarget.rendering.
请看下面的图片:
我需要3D视图中的2D动画具有良好的性能.
请告诉我如何解决这个问题?我应该离开WPF并转到DirectX吗?
更新1:
我只想在3D空间中移动一个 2Dtext,但性能很差.(渲染不顺畅,不稳定)
这是一个示例项目.
更新2:
这是基于cokeman19的答案的示例项目更新版本.(性能提升了~10帧,但我需要完美渲染)
更新3:
最后,在cokeman19的回答和本页内容的帮助下,我获得了可接受的表现.
我使用 gdigrab 来捕获窗口。效果很好,但是鼠标指针闪烁。(特别是当窗口尺寸较大时)
我的命令(c#):
Process FFProc= new Process();
FFProc.StartInfo.FileName = "cmd.exe";
FFProc.StartInfo.Arguments="/C ffmpeg -y -f gdigrab -framerate 25 -i title=\"MyWin\" out.mpg";
FFProc.Start();
Run Code Online (Sandbox Code Playgroud)
或(c++):
system("ffmpeg -y -f gdigrab -framerate 25 -i title=\"MyWin\" out.mpg");
Run Code Online (Sandbox Code Playgroud)
请告诉我如何通过 FFmpeg 捕获窗口时避免鼠标指针闪烁?
FFmpeg = 最新的Zeranoe版本
操作系统 = MS Windows 8.1
我想使用 Glyph 渲染从右到左的语言文本(例如阿拉伯语或混合英语和阿拉伯语)。
\n\n我正在使用这段代码:
\n\n Typeface typeface = new Typeface(new FontFamily("Arial"),\n FontStyles.Italic,\n FontWeights.Normal,\n FontStretches.Normal);\n\n GlyphTypeface glyphTypeface;\n if (!typeface.TryGetGlyphTypeface(out glyphTypeface))\n throw new InvalidOperationException("No glyphtypeface found");\n\n string text = "Hello , \xd8\xb3\xd9\x84\xd8\xa7\xd9\x85";\n double size = 40;\n\n ushort[] glyphIndexes = new ushort[text.Length];\n double[] advanceWidths = new double[text.Length];\n\n double totalWidth = 0;\n\n for (int n = 0; n < text.Length; n++)\n {\n ushort glyphIndex = glyphTypeface.CharacterToGlyphMap[text[n]];\n glyphIndexes[n] = glyphIndex;\n\n double width = glyphTypeface.AdvanceWidths[glyphIndex] * size;\n advanceWidths[n] = width;\n\n totalWidth += width;\n }\n\n Point …Run Code Online (Sandbox Code Playgroud) 我想冻结窗口中的所有可冻结对象。(以获得更好的性能)
为此,我使用了几个这样的循环:
foreach (Brush item in FindLogicalChildren<Brush>(myWin))
if( item != null && item.CanFreeze)item.Freeze();
foreach (Transform item in FindLogicalChildren<Transform>(myWin))
if( item != null && item.CanFreeze)item.Freeze();
foreach (Geometry item in FindLogicalChildren<Geometry>(myWin))
if( item != null && item.CanFreeze)item.Freeze();
Run Code Online (Sandbox Code Playgroud)
但它不起作用。
如何调用Freeze()任何可冻结的 WPF 对象?
编辑:
我刚刚意识到FindLogicalChildren找不到任何东西,所以它不起作用。
编辑2:
如何使用 ONE 循环在任何可冻结对象上调用 Freeze()。
请帮我。