Integrating into a C# application does not mean you have to use C# - you can write code in C++ or other languages and use p/invoke to call it from C#. But unless you're doing something really inefficient in C# you can get pretty decent performance out of it (I work on what is essentially a flight simulator written in C#, and it's pretty high performance - not as high as we could achieve with C++, but still a perfectly viable/realistic alternative, and it's so much faster to develop).
However, unless you are writing a realtime app for a very low-spec CPU and it's already struggling to keep up with its tasks, loading and displaying a 100kB image at any likely framerate shouldn't be much of a problem.
As you don't really specify the bounds of what you can do, it's hard to give a precise answer.
In general, it would make sense to use DirectX/OpenGL in preference to GDI in preference to GDI+ to get decent rendering/blitting performance.
If you have control over it, then there are many file formats that you can use which will help the speed (by compressing the data well to minimise the amount of data to be loaded, and/or by using hardware decompression approaches, better data streaming and caching approaches, pre-processing to optimise the image data to suit the target hardware, etc). If you have this much flexibility you may be able to use a video playback library or even an external video playback application that will do all the work for you, leaving you to write a trivial bit of "control logic" in C#. This will get you a much more efficient system than you are likely to achieve by rolling your own solution.
发布评论
评论(1)
集成到 C# 应用程序中并不意味着您必须使用 C# - 您可以使用 C++ 或其他语言编写代码,并使用 p/invoke 从 C# 调用它。但是,除非你在 C# 中做一些效率很低的事情,否则你可以获得相当不错的性能(我的工作本质上是用 C# 编写的飞行模拟器,并且它的性能相当高 - 没有我们用 C++ 所能达到的那么高,但仍然是一个完全可行/现实的替代方案,而且开发速度要快得多)。
然而,除非您正在为规格非常低的 CPU 编写实时应用程序,并且它已经在努力跟上其任务,否则以任何可能的帧速率加载和显示 100kB 图像应该不成问题。
由于您没有真正指定您可以做什么的范围,因此很难给出准确的答案。
一般来说,为了获得良好的渲染/位块传输性能,优先使用 DirectX/OpenGL(而不是 GDI)是有意义的。
如果您可以控制它,那么您可以使用许多文件格式来提高速度(通过很好地压缩数据以最大限度地减少要加载的数据量,和/或通过使用硬件解压缩方法,更好的数据流和缓存方法、预处理以优化图像数据以适应目标硬件等)。如果您有如此大的灵活性,您也许可以使用视频播放库甚至外部视频播放应用程序来为您完成所有工作,而您只需用 C# 编写一些简单的“控制逻辑”即可。这将为您带来比您自己的解决方案更高效的系统。
Integrating into a C# application does not mean you have to use C# - you can write code in C++ or other languages and use p/invoke to call it from C#. But unless you're doing something really inefficient in C# you can get pretty decent performance out of it (I work on what is essentially a flight simulator written in C#, and it's pretty high performance - not as high as we could achieve with C++, but still a perfectly viable/realistic alternative, and it's so much faster to develop).
However, unless you are writing a realtime app for a very low-spec CPU and it's already struggling to keep up with its tasks, loading and displaying a 100kB image at any likely framerate shouldn't be much of a problem.
As you don't really specify the bounds of what you can do, it's hard to give a precise answer.
In general, it would make sense to use DirectX/OpenGL in preference to GDI in preference to GDI+ to get decent rendering/blitting performance.
If you have control over it, then there are many file formats that you can use which will help the speed (by compressing the data well to minimise the amount of data to be loaded, and/or by using hardware decompression approaches, better data streaming and caching approaches, pre-processing to optimise the image data to suit the target hardware, etc). If you have this much flexibility you may be able to use a video playback library or even an external video playback application that will do all the work for you, leaving you to write a trivial bit of "control logic" in C#. This will get you a much more efficient system than you are likely to achieve by rolling your own solution.