C#图形 [英] C# Graphics

查看:85
本文介绍了C#图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想将一些稍微高级的图形添加到我的程序中,并且对哪种动画类型的东西最好采用哪种方法感到好奇.

我很欣赏实现以下目标可能没有错误或正确的方法,但我会对您的意见和建议感兴趣.

假设您要显示旋转轮的图像–假设有5个辐条的车轮.图像可以顺时针或逆时针旋转.

看来有几种方法可以实现这一目标:

1)  在Photoshop中创建单个图像(或类似图像)在视图中显示它,然后使用计时器旋转它.
2)     在Photoshop中创建一系列图像(框架),以显示车轮在各个位置的位置,然后使用计时器以所需的频率以正确的顺序显示这些图像.
3)  直接将图像绘制到视图上,并根据需要重新绘制图像的各个部分以实现动画效果.
I am just getting into including some slightly more advanced graphics into my programs and was curious about which approach would be best to take regarding animation type stuff.

I appreciate that there is probably no wrong or right way to achieve the following but I would be interested in opinions and suggestions.

Imagine you want to display an image of a rotating wheel – lets say a car wheel with 5 spokes. The image can rotate clock wise or counter clockwise.

It would seem there are several ways to achieve this:

1)   Create a single image in Photoshop (or similar) display it in the view and then rotate it using a timer.
2)   Create a series of images (frames) in Photoshop showing the wheel at various positions then using a timer display these in the correct order at the desired frequency.
3)   Draw the image directly onto the view, redrawing various parts of it as required to achieve the animated effect.

推荐答案

3b ) 使用C#的GDI +(System.Drawing.*)绘制到位图,然后将位图绘制到屏幕上.  减少闪烁.  "我不会为学习复杂的API而烦恼,但我也不想让它看起来很恐怖".方法.

4)XNA-在以游戏为中心的范例中,通过C#驱动的DirectX技术.  包含电池"的方法.

4) XNA - DirectX technology driven through C# in a game-centric paradigm.  The "Batteries included" approach.

5)用非托管C ++编写一个DLL,以封装您的呈现引擎.  使用OpenGL或DirectX.通过您自定义设计的最小编程界面来驱动它-使用P/Invoke.  "一切从头开始"方法.

5) Write a DLL in unmanaged C++ that encapsulates your rendering engine.  Use OpenGL or DirectX.  Drive it through a minimal programming interface that you custom design - use P/Invoke.  The "everything from scratch" approach.

6)购买渲染引擎.  "我是首席执行官,我用金钱解决问题"方法.

6) Shop for a rendering engine.  The "I'm a CEO and I solve problems with money" approach.


这篇关于C#图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆