找回密码
 加入
搜索
查看: 3272|回复: 1

[图形处理] GDI 如何创建一幅jpg图片,并使用graphics进行操作后保存?

[复制链接]
发表于 2013-12-26 13:33:32 | 显示全部楼层 |阅读模式
本帖最后由 lsf1012 于 2013-12-26 13:44 编辑

如题,整了好久,搞不成。。。
下面用的ScreenCapture是可以的。但BitmapCreateFromFile是不行的。
#include <GDIPlus.au3>
#include <ScreenCapture.au3>

Example()

Func Example()
    Local $hBitmap,$hImage

    ; Initialize GDI+ library
    _GDIPlus_Startup()

    $hBitmap = _ScreenCapture_Capture("")
    ;$hBitmap=_GDIPlus_BitmapCreateFromFile(@MyDocumentsDir & "\XX.JPG")
    $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
    $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage)
    _GDIPlus_GraphicsClear($hGraphic,0xFFFF0FFF)
    ; Save bitmap to file
    _GDIPlus_ImageSaveToFile($hImage, @MyDocumentsDir & "\GDIPlus_Image.jpg")

    ; Clean up resources
    _GDIPlus_ImageDispose($hImage)
    _WinAPI_DeleteObject($hBitmap)

    ; Shut down GDI+ library
    _GDIPlus_Shutdown()
EndFunc   ;==>Example
发表于 2013-12-27 04:48:21 | 显示全部楼层
什么意思?是这个意思吗
#include <WinAPIEx.au3>
#include <APIConstants.au3>
#include <GDIPLus.au3>
#include <ScreenCapture.au3>

_ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image.jpg", 0, 0, 600, 400)
_GDIPlus_Startup()
Local $Image=_GDIPlus_BitmapCreateFromFile(@MyDocumentsDir & "\GDIPlus_Image.jpg")
Local $hImage=_GDIPlus_BitmapCreateFromScan0(400, 300,0, $GDIP_PXF32ARGB)
Local $hGraphics=_GDIPlus_ImageGetGraphicsContext($hImage)
_GDIPlus_GraphicsDrawImageRectRect($hGraphics,$Image,100,50,400,300,0,0,400,300)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_ImageSaveToFile($hImage,@MyDocumentsDir & "\GDIPlus_Image2.jpg")
_GDIPlus_BitmapDispose($hImage)
_GDIPlus_BitmapDispose($Image)
_GDIPlus_Shutdown()
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-24 03:37 , Processed in 0.073500 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表