当前位置:网站首页>Stretchdibits function
Stretchdibits function
2022-07-02 18:32:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
quote :http://blog.csdn.net/giantchen547792075/article/details/6996011
The StretchDIBits function copies the color data for a rectangle of pixels in a DIB, JPEG, or PNG image to the specified destination rectangle. If the destination rectangle is larger than the source rectangle, this function stretches the rows and columns of color data to fit the destination rectangle. If the destination rectangle is smaller than the source rectangle, this function compresses the rows and columns by using the specified raster operation.
translate :
StretchDIBits Function DIB、JPEG、PNG The pixel color data in a rectangular area of the image is copied to the specified target rectangle . If the destination rectangle is larger than the source rectangle , This function stretches the rows and columns to fit the color data of the target rectangle . If the destination rectangle is smaller than the source rectangle , Then this function uses the specified raster operation to compress rows and columns .
grammar :
int StretchDIBits (HDC hdc,int XDest,YDest,int int nDestWidth,int nDestHeight,int XSrc,int YSrc,int nSrcWidth,int nSrcHeight,const VOID __in * lpBits,__in const BITMAPINFO * lpBitsInfo,__in UINT iUsage,__in dword = dwRop) ;
Parameters :
hdc [ Enter the reference ]
Handle to the target device context .
XDest [ Enter the reference ]
Corner x coordinate , The upper left corner of the destination rectangle in logical units .
YDest [ Enter the reference ]
Y coordinate , The upper left corner of the target rectangle on the logical unit .
nDestWidth [ Enter the reference ]
Logical unit , The width of the target rectangle .
nDestHeight [ Enter the reference ]
Logical unit , The height of the target rectangle .
XSrc [ Enter the reference ]
Angular x coordinate , In pixels , Source rectangle image .
YSrc [ Enter the reference ]
Y coordinate , In pixels , Source rectangle image .
nSrcWidth [ Enter the reference ]
Width , In pixels , Source rectangle image .
nSrcHeight [ Enter the reference ]
The height is in pixels , Source rectangle image .
lpBits [ Enter the reference ]
Bit of image , Pointer stored as a byte array . For more information , Please refer to the remarks section .
lpBitsInfo [ Enter the reference ]
Directional inclusion DIB Related information BITMAPINFO Pointer to structure .
iUsage [ Enter the reference ]
Specify whether to provide BITMAPINFO Structural bmiColors member , And if so , whether bmiColors Contains explicit red 、 green 、 blue (RGB) Value or index .IUsage The parameter must be one of the following values .
value | remarks |
---|---|
DIB_RGB_COLORS | The color table contains text RGB value . |
DIB_PAL_COLORS | This array contains... Into the logical palette of the source device context 16 Bit index . |
dwRop [ Enter the reference ]
Combine together in the specified way to form a new image source pixel 、 Current brush and target pixel of the target device context . For more information , Please refer to the remarks section below .
Return value
If the function succeeds , Then the return value is the number of rows scanned and copied . Please note that , This value can be negative image content .
If the function fails , Or no scan line is copied , The return value is 0.
If the driver does not support JPEG or PNG File image is passed to StretchDIBits, This function will fail and return GDI_ERROR. If something goes wrong , Applications must rely on their own JPEG or PNG Support , Decompress the image into bitmap , Then pass the bitmap to StretchDIBits.
remarks
Bottom up DIB The starting position of is the lower left corner ; From top to bottom DIB The starting position of is the upper left corner .
StretchDIBits Create an image of a bitmap mirror , If nSrcWidth and nDestWidth These two parameters or nSrcHeight and nDestHeight The symbols of these two parameters are different .NSrcWidth and nDestWidth Different symbols , Then this function creates an edge x Axis mirrored bitmap image .NSrcHeight and nDestHeight Different symbols , Then the function is created along y Axis mirrored bitmap image .
This function allows JPEG or PNG The image is passed in as the source image . How each parameter is used remains unchanged , Unless :
- If BITMAPINFOHEADER Of biCompression The members are BI_JPEG or BI_PNG,lpBits Directional inclusion JPEG or PNG Image separate buffer .BITMAPINFOHEADER Structural biSizeImage Member specifies the size of the buffer .IUsage The parameter has to be set to DIB_RGB_COLORS.DwRop The parameter has to be set to SRCCOPY.
- To ensure that there is an appropriate metafile cache pool when printing , Calling StretchDIBits Before , The application must call CHECKJPEGFORMAT or CHECKPNGFORMAT Escape to verify that the printer can recognize JPEG or PNG Images .
ICM: If by using SetICMMode Of iEnableICM Parameter set to ICM_ON The call of enables color management , Then color management will be implemented . If by lpBitsInfo The specified bitmap has a specified gamma and member endpoint member BITMAPV4HEADER Structure or a designation profileData and profileSize Member of or gamma and member end knot member BITMAPV5HEADER Then all pixels of the bitmap will be regarded as expressed in the color space described by these members rather than the source color space of the device context .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/148419.html Link to the original text :https://javaforall.cn
边栏推荐
- 巴比特 | 元宇宙每日必读:一千块就能买一个虚拟主播?这是小企业的直播福音还是在“割韭菜”?...
- RDK仿真实验
- 使用NPOI导出Excel文件
- 又一所双非改考408,会爆冷么?南昌航空大学软件学院
- Qt官方示例:Qt Quick Controls - Gallery
- 哪个券商公司网上开户佣金低又安全又可靠
- 微信核酸检测预约小程序系统毕业设计毕设(2)小程序功能
- NM02-独立于总线协议的NM模块调用序列图及代码解释
- Architecture design - ID generator "suggestions collection"
- Unity学习shader笔记[八十一]简单的颜色调整后处理(亮度,饱和度,对比度)
猜你喜欢
Editor Editor Extension add button and logo in scene view
Relax again! These fresh students can settle directly in Shanghai
Web版3D可视化工具,程序员应该知道的97件事,AI前沿论文 | 资讯日报 #2022.07.01
Steamos 3.3 beta release, steam deck Chinese keyboard finally came
Redis(7)----数据库与过期键
QT official example: QT quick controls - Gallery
实施阴影介绍
Implementation shadow introduction
夜神模拟器+Fiddler抓包测试App
Qt官方示例:Qt Quick Controls - Gallery
随机推荐
深度神经网络总结
初夏,开源魔改一个带击杀音效的电蚊拍!
Vi/vim delete: one line, one character, word, the first character of each line command
微信小程序视频分享平台系统毕业设计毕设(2)小程序功能
Troubleshooting ideas that can solve 80% of faults
国金证券是国企吗?在国金证券开户资金安全吗?
夜神模擬器+Fiddler抓包測試App
vi/vim 删除:一行, 一个字符, 单词, 每行第一个字符 命令
Web聊天工具
Unity学习shader笔记[八十二]增强单通道颜色渲染的黑白处理
快速排序基本思路(通俗易懂+例子)「建议收藏」
巴比特 | 元宇宙每日必读:一千块就能买一个虚拟主播?这是小企业的直播福音还是在“割韭菜”?...
微信小程序视频分享平台系统毕业设计毕设(4)开题报告
揭秘得物客服IM全链路通信过程
Steamos 3.3 beta release, steam deck Chinese keyboard finally came
微信小程序视频分享平台系统毕业设计毕设(7)中期检查报告
UE4 用spline画正圆
Basic idea of quick sorting (easy to understand + examples) "suggestions collection"
“栈”的典型应用—表达式求值(C语言实现)
Picking up the camera is the best artistic healing