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

GDI+ Color Format

$
0
0
Well I try to set a color for a bitmap pixels and when I read them I got new colors. Is that because of color format?
[ autoit ]         
#include <GDIPlus.au3> _GDIPlus_Startup() ; Create a HBITMAP $hHBITMAP = _WinAPI_CreateBitmap(200,200,1,32) ; Create a bitmap $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBITMAP) $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) ; Set pixels color 0xFCFF0000 _GDIPlus_GraphicsClear($hContext,0xFCFF0000) ; In this phase the color is 0xFFFC0000 ConsoleWrite(GetPixel($hBitmap,10,10) & @CRLF) ; Create a bitmap clone in format ARGB $hClone = _GDIPlus_BitmapCloneArea($hBitmap,0,0,200,200,$GDIP_PXF32ARGB) $hCloneContext = _GDIPlus_ImageGetGraphicsContext($hClone) ; Set pixels color 0xFCFF0000 _GDIPlus_GraphicsClear($hCloneContext,0xFCFF0000) ; In this phase the color is 0xFCFE0000 ConsoleWrite(GetPixel($hClone,10,10) & @CRLF) ; Clean up resources _GDIPlus_GraphicsDispose($hCloneContext) _GDIPlus_BitmapDispose($hClone) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BitmapDispose($hBitmap) _WinAPI_DeleteObject($hHBITMAP) _GDIPlus_Shutdown() Func GetPixel($hBitmap,$X,$Y)     Local $tPixel = DllStructCreate("dword Pixel")     DllCall($ghGDIPDll,"int","GdipBitmapGetPixel","handle",$hBitmap,"int",$X,"int",$Y,"ptr",DllStructGetPtr($tPixel))     Return Hex(DllStructGetData($tPixel,"Pixel"),8) EndFunc

Viewing all articles
Browse latest Browse all 12506

Trending Articles



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