I come, I see, I conquer

                    —Gaius Julius Caesar

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

 

System.Drawing 命名空间

System.Drawing 命名空间提供了对 GDI+ 基本图形功能的访问。 System.Drawing.Drawing2DSystem.Drawing.ImagingSystem.Drawing.Text 命名空间中提供了更高级的功能。

Graphics 类提供了绘制到显示设备的方法。 诸如 RectanglePoint 等类可封装 GDI+ 基元。 Pen 类用于绘制直线和曲线,而从抽象类 Brush 派生出的类则用于填充形状的内部。

请参考MSDN:http://msdn.microsoft.com/zh-cn/library/xs6ftd89

 

 

Graphics 类

Graphics 类提供将对象绘制到显示设备的方法。 Graphics 与特定的设备上下文关联。

 

Graphics object by calling the Control.CreateGraphics method on an object that inherits from System.Windows.Forms.Control, or by handling a control's Control.Paint event and accessing the Graphics property of the System.Windows.Forms.PaintEventArgs class.">通过调用继承自 System.Windows.Forms.Control 的对象上的 Control.CreateGraphics 方法,或通过处理控件的 Control.Paint 事件并访问 System.Windows.Forms.PaintEventArgs 类的 Graphics 属性,可以获取 Graphics 对象。 也可以使用 FromImage 方法从图像创建 Graphics 对象。 有关创建 Graphics 对象的更多信息,请参见如何:创建用于绘制的 Graphics 对象

 

可以使用 Graphics 对象绘制许多不同的形状和线条。 有关如何绘制线条和形状的更多信息,请参见针对要绘制的线条或形状的特定 DrawGraphicalElement 方法。 这些方法包括 DrawLineDrawArcDrawClosedCurveDrawPolygonDrawRectangle 有关如何绘制线条和形状的更多信息,请参见使用钢笔绘制线条和形状使用画笔填充形状

 

还可以分别使用 DrawImageDrawIcon 方法来绘制图像和图标。 要执行颜色数据从屏幕到 Graphics 对象的绘图图面的位块传输,请参见CopyFromScreen 有关如何使用 Graphics 对象绘制图像的更多信息,请参见使用图像、位图、图标和图元文件

 

此外,您可以操作由 Graphics 对象使用的坐标系。 有关坐标系及其操作方法的更多信息,请参见坐标系和坐标变换

 

private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs pe) 
{
   // Declares the Graphics object and sets it to the Graphics object
   
// supplied in the PaintEventArgs.
   Graphics g = pe.Graphics;
   // Insert code to paint the form here.
}

 

Graphics g;
// Sets g to a graphics object representing the drawing surface of the
// control or form g is a member of.
g = this.CreateGraphics();

 

Bitmap myBitmap = new Bitmap(@"C:\Documents and 
   Settings\Joe\Pics\myPic.bmp
");
Graphics g = Graphics.FromImage(myBitmap);

 

 

示例:TARGET.DrawImage(SOURCE, xx, ...)

 

// Uses the System.Environment.GetFolderPath to get the path to the current user's MyPictures folder.
Bitmap myBitmap = new Bitmap (System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures));
// Creates a Graphics object that represents the drawing surface of Button1.
Graphics g = Button1.CreateGraphics();
g.DrawImage(myBitmap, 11);

 

请参考MSDN:http://msdn.microsoft.com/zh-cn/library/ac148eb3

 

 

Image 类

为源自 BitmapMetafile 的类提供功能的抽象基类。

请参考MSDN:http://msdn.microsoft.com/zh-cn/library/system.drawing.image

 

 

Bitmap 类

封装 GDI+ 位图,此位图由图形图像及其特性的像素数据组成。 Bitmap 是用于处理由像素数据定义的图像的对象。

 

备注:

位图由图形图像及其特性的像素数据组成。 可使用许多标准格式将位图保存到文件中。 GDI+ 支持下列文件格式:BMP、GIF、EXIF、JPG、PNG 和 TIFF。 有关支持的格式的更多信息,请参见位图类型

可以使用 Bitmap 构造函数中的一种来从文件、流和其他源创建图像,然后使用 Save 方法将这些图像保存到流或文件系统中。 使用 Graphics 对象的 DrawImage 方法,将图像绘制到屏幕上或内存中。 有关使用图像文件的主题的列表,请参见使用图像、位图、图标和图元文件

 

请参考MSDN:http://msdn.microsoft.com/zh-cn/library/system.drawing.bitmap

 

 

 

颜色与图像

1、什么是RGB、CMYK、HSB颜色模型?

2、什么是灰度?

3、什么是单色位图、16色位图、256色位图、24位位图?

4、什么是调色板?

5、什么是Alpha通道?

6、常见图像文件格式有哪些?什么区别?

7、什么是图像分辨率?

8、图像缩放原理是什么?

9、什么是矢量图?

 

【参考】

图像格式:http://baike.baidu.com/view/13674.htm

位图BMP:http://baike.baidu.com/view/189487.htm

矢量图:http://baike.baidu.com/view/138039.htm

Bitmap:http://en.wikipedia.org/wiki/Bitmap

 

posted on 2012-07-07 17:48  jcsu  阅读(19141)  评论(0编辑  收藏  举报