Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Possible bug when using Indexed BMPs with "Gui,Color"



  • Please log in to reply
1 reply to this topic
twiz
  • Members
  • 33 posts
  • Last active: Oct 08 2013 11:47 PM
  • Joined: 08 Nov 2011

When using "Gui,Color" to change the background color of a window, it will also change the color of all 0xF3F4F4 pixels, the default background color, in Indexed BMP as you can see in the image below. Both boxes are pixel-for-pixel the same, but the left one is saved as RGB, while the right one is an Indexed BMP.

http://i.imgur.com/J8J3tkJ.png

J8J3tkJ.png

 

My sample script below shows the issue, it creates an Image folder in the Script Directory, and downloads the two images to that folder.

http://pastebin.com/AHKJG3RJ

#SingleInstance, Force
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Recommended for catching common errors.
SetWorkingDir, %A_ScriptDir% ; Ensures a consistent starting directory.

Dropbox := "https://dl.dropboxusercontent.com/u/517697/AHK%20Stuff/"

IfNotExist, %A_ScriptDir%\images\
    FileCreateDir, %A_ScriptDir%\images\
IfNotExist, %A_ScriptDir%\images\F3F4F4_RGB.bmp
    UrlDownloadToFile, %Dropbox%F3F4F4_RGB.bmp, %A_ScriptDir%\images\F3F4F4_RGB.bmp
IfNotExist, %A_ScriptDir%\images\F3F4F4_Index.bmp
    UrlDownloadToFile, %Dropbox%F3F4F4_Index.bmp, %A_ScriptDir%\images\F3F4F4_Index.bmp

Gui, Color, FF00FF
Gui, Add, Picture, x5  y5 vBackground1 0x4000000, images\F3F4F4_RGB.bmp
Gui, Add, Picture, x+5 y5 vBackground2 0x4000000, images\F3F4F4_Index.bmp
Gui, Show, w115 h60
Return

GuiClose:
ExitApp


Seidenweber
  • Moderators
  • 638 posts
  • Last active: Sep 06 2015 01:51 PM
  • Joined: 10 May 2011
✓  Best Answer

AltSubmit does the job. ( http://www.autohotke...ols.htm#Picture )

Gui, Add, Picture, x+5 y5 vBackground2 0x4000000 AltSubmit, images\F3F4F4_Index.bmp

 

Specifying the word AltSubmit in Options tells the program to use Microsoft's GDIPlus.dll to load the image, which might result in a different appearance for GIF, BMP, and icon images. For example, it would load an ICO/GIF that has a transparent background as a transparent bitmap, which allows the BackgroundTrans option to take effect. If GDIPlus is not available (see next paragraph), AltSubmit is ignored and the image is loaded using the normal method.


All questions & answers are related to AHK 1.1.19.03 x64 Unicode