Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Crop HBITMAP?

$
0
0

Hi

 

Is it possible to crop a HBITMAP directly? I got it working by using GDI+ by converting to bitmap, copy wanted part, then convert back to hbitmp.

#include <GDIPlus.au3> #Include <ScreenCapture.au3> _GDIPlus_Startup () $begin = TimerInit()    ; Test, screenshot direct to hbitmap Local $hHBMP = _ScreenCapture_Capture('',0,0,@DesktopWidth,@DesktopHeight,False) ConsoleWrite("Creating _ScreenCapture_Capture hbitmap Desktop screenshot took " & TimerDiff($begin) & " milliseconds"& @LF) $begin = TimerInit()    ; Test, Crop from hbitmap Local $hBMP= _GDIPlus_BitmapCreateFromHBITMAP($hHBMP) Local $hBMP_Cropped = _GDIPlus_BitmapCloneArea($hBMP, 0, 0, 110, 110) Local $hHBMP_Cropped = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBMP_Cropped) ;_GDIPlus_ImageSaveToFile($hBMP_Cropped, $BMP3) ConsoleWrite("Creating cropped hbitmap Desktop screenshot took " & TimerDiff($begin) & " milliseconds"& @LF)

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>