> Added concept to paint GUI black before painting image - not sure how to tune to interact with this sub Global PicDC, PicWidth, PicHeight, GuiWidth, GuiHeight Gui, Show, w%GuiWidth% h%GuiHeight%, PICTURE RE_SIZE DEMO think the small Max - large Max resizer capability should go here, but not 100% sure PicDC := DllCall("CreateCompatibleDC", "uint", 0)ĭllCall("SelectObject", "uint", PicDC, "uint", PicBackground) Create a device context for drawing the bitmap. PicBackground := DllCall("CopyImage","uint",ErrorLevel,"uint",0ĭllCall("GetObject", "uint", PicBackground, "int", 24, "uint", &bm)
SendMessage, 0x173, 0, ahk_id %PicWnd% STM_GETIMAGE Get the bitmap associated with the picture control. Gui, Add, Picture, Hidden hwndPicWnd, AutoHotkey_logo.gif Add a hidden picture control to load the image. WS_CLIPCHILDREN (0x2000000) is necessary if the GUI has controls.
I am just getting lost in the idea how to take the size, and somehow interpret it to the code to make it all flow so nicely. I am of the belief there may be a easier way toġ) Stop the image from being opened larger than its original sizeĢ) Stop the image from being shrunk (too small) The earlier code I write, I don't know if is redundant. but the nuances of the commands are a bit vague to me. I was trying to figure out how and get that part hooked in. lexiKos, if I understand your thinking in your earlier message, for this to work properly, I would need to paint the GUI black before painting the image? Why is that? Is that region not going to be visible anyway? This time has given me some deep thinking into this.
LexiKos, I only started my software development education 2 years ago, and in the belief of trying to learn why and wherefores of coding. (GDI+ offers additional stretching options see the GDI+ section.) Use SetStretchBltMode() to change between stretching modes:Īn alternative to scaling is using multiple images, each designed for a different DPI. HALFTONE stretching is slower, but provides much higher quality. The default stretching mode, COLORONCOLOR, is fast but loses a lot of details. This is most noticeable when scaling from a small DPI to a large one, but scaling down also has problems the details the scaling algorithm chooses to keep are not necessarily the details you would choose. Scaling does degrade the quality of the image. HdcBitmap, 0, 0, info.bmWidth, info.bmHeight, SRCCOPY) DeleteDC(hdcBitmap) SCALEX(info.bmWidth), SCALEY(info.bmHeight), HDC hdcBitmap = CreateCompatibleDC(target) GetObject(bitmap, sizeof(info), (PTSTR) &info) This example takes a bitmap designed for 96 DPI, and draws it scaled: StretchBlt can be used to do this, as well. It’s often easier for the application to scale the image when it is loaded, rather than scaling when the image is drawn. You can scale a bitmap by calling StretchBlt() instead of BitBlt(). If the display’s DPI is not the same as the DPI for which the image was designed, the image needs to be scaled in order to appear the correct physical size.
Images are more difficult to deal with than fonts, since images consist of discrete pixels. “Images” covers all raster-based image files (such as BMP, JPEG, and GIF), icons, and cursors.