Solving cursor and bitmap issues in GDI for AutoHotkey v2
The video discusses using GDI to solve bitmap and picture control issues, including capturing and pasting images with the cursor, and explores different methods for creating and saving bitmaps in C++ and Python.
00:00 👨💻 Isaias and Hellbent worked on bitmap and picture control issues, creating a new screenshot class with cursor capture function using GDI.
Isaias and Hellbent worked through bitmap and picture control issues in the GDI library, sharing deep learning experiences.
Created a new class called screenshot in hotkey V2 that can take screenshots from screen, activity window, and client, with a function called capture, which had an issue with reading information in the wrong order but was eventually resolved.
The speaker captures the cursor using GDI and fills out a specific structure with information about the cursor’s size, flags, position, and type.
The function gets the icon, reads values from the cursor, draws it using GDI, and returns the context for that particular cursor.
04:30 📋 When working with GDI, manually releasing objects and copying memory prior to setting up the clipboard can solve issues with capturing and pasting images, including the I-beam cursor.
When working with GDI, objects must be released manually, and creating a new bitmap can cause issues when trying to copy it to the clipboard.
The speaker explains a function that captures cursor information and saves it properly into the clipboard, but when using an I-beam cursor, the captured image appears as a blank square.
The I-beam cursor changes color depending on the background and may not actually be an I-beam, with the bit mask and color playing a potential role in its appearance.
Copying memory prior to setting up the clipboard may solve issues with the H Global memory handle.
Is there a GDI function to convert H Global to H bitmap for use in a picture control?
The speaker demonstrated how to copy an image to the clipboard and paste it into a program using the “get image” function.
13:37 📚 Use GDI plus underscore create bitmap from clipboard to easily copy and retrieve images for quick prototyping in the library.
The solution is to take the internet into the library.
The speaker found a function called GDI plus underscore create bitmap from clipboard that allows for copying images from the clipboard to the screen.
Quickly prototype by using a simple two-line code to transfer clipboard data into a bitmap or h-bitmap for testing.
The speaker explains how to copy an image to the clipboard and retrieve it using a static function in a class method.
20:00 🔍 Knowing the difference between calling static and instance methods is important in V1 and V2.
The speaker discusses the difference between calling static and instance methods in V1 and V2, and the importance of knowing which one to call.
The speaker encountered a problem with the clipboard data and pointer allocation while trying to access a screenshot image class.
The speaker debugs an issue with a clipboard function by opening the clipboard before trying to get information out of it.
The issue with displaying data is not the data itself, but rather the control used to display it, specifically the use of GDI.
26:18 📋 The speaker discusses saving a bitmap to a file and converting a pointer to a bitmap using “convert HP” function.
Copying an image to the clipboard requires an additional step of saving it to a file and then reading the file.
The speaker plans to save a bitmap to a file but is unsure if it will solve the problem they are currently facing.
The speaker discusses converting a pointer to a bitmap using a function called “convert HP” and notes that taking a screenshot already sets the H bitmap.
Create a bitmap and save it to a file using the pivot map.
31:54 💻 Updating libraries and code is crucial for project success, while exploring different methods to create and save bitmaps in a file.
Always use Unicode and include the GDI plus library for testing, as there is no library for read.
The speaker is discussing the use of a codec to decode a string and obtain encoder parameters.
The speaker suggests the need for a visual confirmation when saving files and encounters an issue with the control function.
The speaker explores different methods to create and save bitmaps in a file.
The speaker discusses issues with outdated libraries and code in a project, and mentions the need to update to a newer version.
40:09 👨💻 The speaker discusses file creation, pointer usage, and image saving in C++ and Python, encountering issues with if statements and file verification.
The speaker discusses creating a file and using a pointer in a function.
The code saves a bitmap to an H file and creates a BMP file using GDI library.
The speaker encountered an issue with an if statement, made some adjustments, and successfully wrote to a file, but had to specify the type of number every time, and still needed to verify if the file had the correct icon.
The speaker demonstrates how to locally load and save an image file in Python using the show function.
Using alt submit and GDI plus library allows for proper rendering of binary data in picture controls.
Data can be stored in a rock using ones and zeros.
50:24 📷 Using GDI+ Library’s set image function can improve the quality of PNG images in a picture control, but there may be bugs with submitting images on a handle.
PNG images have transparency and opacity represented by zeros and ones, and GDI plus is required to work with newer image formats like PNG, which creates composite images with transparency.
The speaker discusses the issue of loading PNG images in a picture control and how specifying the image type as PNG does not work with a handle, but using the GDI+ Library’s set image function can improve the quality of the image.
The speaker encountered issues with a control’s size and loading a bitmap using GDI plus, but found that it worked correctly when using a BMP file and the “alt submit” command.
The rendering function doesn’t know how to handle transparency bits, resulting in different values when viewing an image in different ways.
The speaker discusses their process of creating a function to take screenshots from different sources and mentions the potential for using it in a Window Snipping Tool.
The issue of submitting images on a handle is complex and there may be a bug with the old submit that needs to be addressed.