BOOL CreateBitmap( int nWidth, int nHeight, UINT nPlanes, UINT nBitcount, const void* lpBits ); Parameters nWidth Specifies the width (in pixels) of the bitmap. nHeight Specifies the height (in pixels) of the bitmap. nPlanes
因为颜色存储设备上下文可能具有选定的颜色或将图片位图,CreateCompatibleBitmap 函数返回的位图的布局也不总是相同;但是,兼容的位图的布局。nonmemory设备上下文的总是以设备的格式。 当您完成使用 CreateCompatibleBitmap 功能时创建的 CBitmap 对象,请首先选择该在设备上下文之外,然后删除 CBitmap 对象。 要求 Header...
尽管函数CreateBitmap可以用来创建彩色位图,但由于性能方面的原因,应用程序使用CreateBitmap函数来创建单位色位图,创建彩色位图应该使用函数CreateCompatibleBitmap。当由CreateBitmap创建而返回的彩色位图被选入到设备环境时,系统必须确保选入进去的设备环境格式与位图匹配。由于函数CreateComapatbleBitmap获取设备环境,所以它...
BOOL CreateBitmapIndirect( LPBITMAP lpBitmap ); 参数 lpBitmap 指向位图包含有关位图的信息的结构。 返回值 非零,如果成功;否则为0。 备注 虽然位图不能用于显示设备直接进行选择,使用CDC::BitBlt或CDC::StretchBlt功能,它可以选择为当前位图用于存储设备上下文通过使用CDC::SelectObject和复制到所有兼容设备上下文...
CBitmap::CreateBitmap使用具有指定宽度、高度和位模式的设备相关的内存位图初始化对象。 CBitmap::CreateBitmapIndirect使用具有BITMAP结构中给定宽度、高度和位模式(如果已指定)的位图初始化对象。 CBitmap::CreateCompatibleBitmap使用位图初始化对象,使它与指定设备兼容。
BOOL CreateCompatibleBitmap( CDC* pDC, int nWidth, int nHeight ); Parameters pDC Specifies the device context. nWidth Specifies the width (in pixels) of the bitmap. nHeight Specifies the height (in pixels) of the bitmap. Return Value ...
CreateBitmap函数允许用指定的宽度、高度和位图模式初始化一个依赖于设备的内存位图。这提供了高度的灵活性,用于创建在不同设备上表现一致的图像。CreateBitmapIndirect函数则更进一步,它接受BITMAP结构中的宽度、高度和模式(可选)来初始化位图对象。使用此函数可以更精确地控制位图的创建过程,包括在未...
CreateBitmap函数用于初始化一个位图对象,该对象具有指定的宽度、高度和位图模式。创建此对象时,内存会根据指定的参数分配,用于存储位图数据。这种方法适用于需要自定义位图尺寸和模式的场景。CreateBitmapIndirect函数提供了一种更灵活的方式来初始化位图对象。它接受一个BITMAP结构,其中包含宽度、高度和...
Since a color memory device context can have either color or monochrome bitmaps selected, the format of the bitmap returned by the CreateCompatibleBitmap function is not always the same; however, the format of a compatible bitmap for a nonmemory device context is always in the format of the...
总结了以下,大致有以下两种方法:一是利用MFC封装的绘图设备,利用两个CDC,将图像拷贝过来;二是利用CreateBitmap直接构造。 2、实现一: BOOL CopyCBitmapFromSrc(CBitmap* pBitmapDest, CBitmap* pBitmapSrc) { BOOL bFlag = FALSE; CDC dcMemSrc;...