Image类--3-克隆技术

inline Bitmap*
Bitmap::Clone(
    IN REAL x,
    IN REAL y,
    IN REAL width,
    IN REAL height,
    IN PixelFormat format
    )
{
 PixelFormatIndexed                                                                                                 该像素数据包含颜色索引值,这意味着这些值是系统颜色表中颜色的索引,而不是单个颜色值。  
 PixelFormatGdi                                                                                                        像素数据包含 GDI 颜色。  
 PixelFormatAlpha                                                                                                    像素数据包含没有进行过自左乘的 alpha 值。  
 PixelFormatPAlpha                                                                                                 像素格式包含自左乘的 alpha 值。  
 PixelFormatExtended                                                                                             保留。  
 PixelFormatCanonical                                                                                            默认像素格式,每像素 32 位。 此格式指定 24 位颜色深度和一个 8 位 alpha 通道。  
 PixelFormatUndefined                                                                                           未定义像素格式。  
 PixelFormatDontCare                                                                                            没有指定像素格式。  
 PixelFormat1bppIndexed                                                                         指定像素格式为每像素 1 位,并指定它使用索引颜色。 因此颜色表中有两种颜色。  
 PixelFormat4bppIndexed                                                                         指定格式为每像素 4 位而且已创建索引。  
 PixelFormat8bppIndexed                                                                         指定格式为每像素 8 位而且已创建索引。 因此颜色表中有 256 种颜色。  
 PixelFormat16bppGrayScale                                                                  像素格式为每像素 16 位。 该颜色信息指定 65536 种灰色调。  
 PixelFormat16bppRgb555                                                                      指定格式为每像素 16 位;红色、绿色和蓝色分量各使用 5 位。 剩余的 1 位未使用。  
 Pixel Format16bppRgb565                                                                     指定格式为每像素 16 位;红色分量使用 5 位,绿色分量使用 6 位,蓝色分量使用 5 位。  
 PixelFormat16bppArgb1555                        像素格式为每像素 16 位。 该颜色信息指定 32,768 种色调,其中 5 位为红色,5 位为绿色,5 位为蓝色,1 位为 alpha。  
 PixelFormat24bppRgb  指定格式为每像素 24 位;红色、绿色和蓝色分量各使用 8 位。  
Pixel Format32bppRgb  指定格式为每像素 32 位;红色、绿色和蓝色分量各使用 8 位。 剩余的 8 位未使用。  
 PixeltFormat32bppArgb  指定格式为每像素 32 位;alpha、红色、绿色和蓝色分量各使用 8 位。  
PixeltFormat32bppPArgb  指定格式为每像素 32 位;alpha、红色、绿色和蓝色分量各使用 8 位。 根据 alpha 分量,对红色、绿色和蓝色分量进行自左乘。  
Pixel Format48bppRgb  指定格式为每像素 48 位;红色、绿色和蓝色分量各使用 16 位。  
PixeltFormat64bppArgb  指定格式为每像素 64 位;alpha、红色、绿色和蓝色分量各使用 16 位。  
PixelFormat64bppPArgb  指定格式为每像素 64 位;alpha、红色、绿色和蓝色分量各使用 16 位。 根据 alpha 分量,对红色、绿色和蓝色分量进行自左乘。  

 Max  此枚举的最大值。  

示例代码:

	Bitmap orgpic(_T("D:\\1.PNG")) ;
	Graphics g(GetDC()->GetSafeHdc()) ;

	Bitmap *despic = orgpic.Clone(0, 0, orgpic.GetWidth(), orgpic.GetHeight()/2, PixelFormatDontCare) ;
	g.DrawImage(despic, 0, 0) ;
	delete despic ;




创建此 Image 的一个精确副本, 图片不会失真.

具体参看http://msdn.microsoft.com/zh-cn/library/system.drawing.imaging.pixelformat.aspx#Y101

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值