Jump to content

Search the Community

Showing results for tags '_GDIPlus_BitmapLockBits'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 2 results

  1. I'm experimenting with GetPixel functions (in order to find the fastest) and have this simple part in my script: Local $iWidth = 150 Local $iHeight = 300 Local $array[$iHeight][$iWidth] For $i = 1 To $iHeight Step 1 For $j = 1 To $iWidth Step 1 $array[$i-1][$j-1] = PixelGetColor($iHeight-1, $iWidth-1, $Handle) Next Next Trying to get the equivalent using the GDI+ library (more specifically, using the _GDIPlus_BitmapLockBits function) I've got this code: Global $Handle = WinGetHandle("Paint") Local $sWow64 = "" If @AutoItX64 Then $sWow64 = "\Wow6432Node" ; X64 running support ; Initialize GDI+ library _GDIPlus_Startup() ; Capture 32 bit bitmap to a HBITMAP WinActivate($Handle) Local $hBMP = _ScreenCapture_CaptureWnd("", $Handle) ; _ScreenCapture_CaptureWnd returns a handle to an HBITMAP if $sFileName is empty Local $pBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) Local $iWidth = 150 Local $iHeight = 300 Local $array[$iHeight][$iWidth] Local $BitmapData = _GDIPlus_BitmapLockBits($pBitmap, 0, 0, $iWidth, $iHeight, $GDIP_ILMREAD, $GDIP_PXF32RGB) Local $Scan0 = DllStructGetData($BitmapData, "Scan0") Local $Stride = DllStructGetData($BitmapData, "Stride") Local $pixel = $Scan0 + $Stride + 4 Local $dPixel = DllStructCreate("dword", $pixel) MsgBox(0, "mBox", "$Scan0=" & $Scan0 & " $Stride=" & $Stride & " pixel=" & $pixel) For $i = 1 To $iHeight Step 1 For $j = 1 To $iWidth Step 1 ; <?> Next Next ; Clean up resources _GDIPlus_BitmapUnlockBits($pBitmap, $BitmapData) _GDIPlus_BitmapDispose($pBitmap) _WinAPI_DeleteObject($hBMP) _GDIPlus_Shutdown() And yeah, there's where I'm struggling at the moment (see ; <?> line). I don't get any return value from the DllStructCreate() call (to the $dPixel variable) The $pixel variable contains at this point 0x026D7A84. I need help to proceed, and I don't fully understand the $Scan0 and $Stride usage. And how to convert pixel data to x and y coordinates for use in the loop (i and j). My goal is to get the decimal value of each pixel into the array (exactly the same way as when using the PixelGetColor() method, see above) hAlp
  2. In my script i check a small area (say 20x20 pixels) with looped PixelGetColor. This has worked without any real problems for months and has taken about 20ms to complete. To test my script, I'm running Photoshop and activate different layers to show different photos. This has also worked great. After a GPU replace (to the better) a week ago it worked great the first few days, but now I've come to a dead end. This is the deal: I open my .psd file and runs my script - performance is ok I switch to layer 2 and runs my script - performance is ok I switch back to layer 1 and runs my script - performance is horrible, almost 50ms. At this point it doesn't matter what I do, every use of PixelGetColor() is slow. Now, if I close Photoshop completely, reopens my .psd file and run the script again - performance is ok What could possible be the problem!? Could it be anything with the new Nvidia drivers - PhysX/hyperthreading and all that new shit (which I didnt use earlier)? After a search through the forums I've found some interesting stuff making me far from the only one having general performance issues using the PixelGetColor() function. I'm gonna take a shot using _GDIPlus_BitmapLockBits instead and see if that helps. But I wonder if there might be something more at work in my case? As mentioned, I'm using the same script as I have for months. I've tested with Photoshop again and again - same result. Also tried using Paint but then its horrible speed constantly. It's just now the problems started. Related links on the matter Setup WinXP GPU 1GB GeForce 3 GB RAM 1600x1200x32 Window Classic theme with all Performance Visual Effects turned off. AutoIt v3.3.8.1
×
×
  • Create New...