Makalele Posted May 25, 2008 Posted May 25, 2008 Hi Everyone! This is my simple script: expandcollapse popup#Include <ScreenCapture.au3> #Include <GDIPlus.au3> #include <GUIConstants.au3> AutoItSetOption("GUICoordMode",0) Const $clWhite=16777215 Const $clRed=255 Const $clBlack=0 Func Convert($OutputFName,$imgX1,$imgY1,$imgX2,$imgY2) Dim $CX=0 Dim $CY=0 Dim $IW=$imgX2-$imgX1 Dim $IH=$imgY2-$imgY1 Dim $MainBitMap=GUICtrlCreateGraphic(0,0,$IW,$IH) Dim $CPIX=0 For $CY=0 To $IH For $CX=0 to $IW $CPIX=PixelGetColor($CX+$imgX1,$CY+$imgY1) IF ($CPIX=$clBlack) OR ($CPIX=$clRed) Then GUICtrlSetGraphic($MainBitMap,$GUI_GR_COLOR,$CPIX) ;pixel ok Else GUICtrlSetGraphic($MainBitMap,$GUI_GR_COLOR,$clWhite);pixel white EndIf GUICtrlSetGraphic($MainBitMap,$GUI_GR_PIXEL,$CX,$CY) Next Next _GDIPlus_Startup() $GraphicBMP = _GDIPlus_BitmapCreateFromGraphics($IW,$IH,$MainBitMap) $GraphicHBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($GraphicBMP) If FileExists($OutputFName) Then FileDelete("tempfile.bmp") _ScreenCapture_SaveImage($OutputFName,$GraphicHBMP,False) _GDIPlus_Shutdown() EndFunc An Idea of this script is capture part of screen to GUIGraphic (because i don't know how to copy it to memory and i used GUIGraphic) but with converting all colors to white without black and red. ($cdRed & $cdBlack constans). And in this point is the problem. The script hasn't error, but it isn't make a bmp file. Of course I'm using this 2 simple commands: Sleep(5000) Convert("tempfile.bmp",512,512,600,600) Where is the problem? Maybe someone has better script? A protity of this script is fast converting. Please help me Regards, Makalele
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now