请教各位牛人一个简单的问题~~~~~~~~

zhkand 2009-05-26 10:08:22
给点指导Bitmap Clone()这个函数怎么用啊?最好有实例啊!!!!!
各位牛人指点啊!!
...全文
134 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
Bitmap.Clone

Creates a copy of the section of this Bitmap defined with a specified PixelFormat.

Overload List
Name Description
Bitmap.Clone () Creates an exact copy of this Image.
Bitmap.Clone (Rectangle, PixelFormat) Creates a copy of the section of this Bitmap defined by Rectangle structure and with a specified PixelFormat enumeration.
Bitmap.Clone (RectangleF, PixelFormat) Creates a copy of the section of this Bitmap defined with a specified PixelFormat enumeration.


public:
virtual Object^ Clone () sealed

Return Value
The Image this method creates, cast as an object


C++
public:
Bitmap^ Clone (
Rectangle rect,
PixelFormat format
)
Parameters
rect
Defines the portion of this Bitmap to copy. Coordinates are relative to this Bitmap.

format
Specifies the PixelFormat enumeration for the destination Bitmap.

Return Value
The new Bitmap that this method creates.

public:
void Clone_Example1( PaintEventArgs^ e )
{
// Create a Bitmap object from a file.
Bitmap^ myBitmap = gcnew Bitmap( "Grapes.jpg" );

// Clone a portion of the Bitmap object.
Rectangle cloneRect = Rectangle(0,0,100,100);
System::Drawing::Imaging::PixelFormat format = myBitmap->PixelFormat;
Bitmap^ cloneBitmap = myBitmap->Clone( cloneRect, format );

// Draw the cloned portion of the Bitmap object.
e->Graphics->DrawImage( cloneBitmap, 0, 0 );
}



C++
public:
Bitmap^ Clone (
RectangleF rect,
PixelFormat format
)

Parameters
rect
Defines the portion of this Bitmap to copy.

format
Specifies the PixelFormat enumeration for the destination Bitmap.


Return Value
The Bitmap that this method creates.

public:
void Clone_Example2( PaintEventArgs^ e )
{
// Create a Bitmap object from a file.
Bitmap^ myBitmap = gcnew Bitmap( "Grapes.jpg" );

// Clone a portion of the Bitmap object.
RectangleF cloneRect = RectangleF(0,0,100,100);
System::Drawing::Imaging::PixelFormat format = myBitmap->PixelFormat;
Bitmap^ cloneBitmap = myBitmap->Clone( cloneRect, format );

// Draw the cloned portion of the Bitmap object.
e->Graphics->DrawImage( cloneBitmap, 0, 0 );
}

BruceLin2008 2009-05-27
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 Mackz 的回复:]
Example


The following example creates a Bitmap object from an image file, clones the upper-left portion of the image, and then draws the cloned image.


Hide Example


C/C++ codeVOID Example_Clone(HDC hdc)
{
Graphics graphics(hdc);

// Create a Bitmap object from a JPEG file.
Bitmap bitmap(L"Climber.jpg");

// Clone a portion of the bitmap.
Bitmap* clone = bi…
[/Quote]

自己查都能查到,就是这样的
菜牛 2009-05-26
  • 打赏
  • 举报
回复
Example


The following example creates a Bitmap object from an image file, clones the upper-left portion of the image, and then draws the cloned image.


Hide Example

VOID Example_Clone(HDC hdc)
{
Graphics graphics(hdc);

// Create a Bitmap object from a JPEG file.
Bitmap bitmap(L"Climber.jpg");

// Clone a portion of the bitmap.
Bitmap* clone = bitmap.Clone(Rect(0, 0, 100, 100), PixelFormatDontCare);

// Draw the clone.
graphics.DrawImage(clone, 0, 0);

delete clone;
}

19,464

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧