-
Notifications
You must be signed in to change notification settings - Fork 28
Internal Documentation
Calling ImagePut("file", "cats.jpg")
is the same as calling ImagePutFile("cats.jpg")
.
There are 3 steps:
- Calling ImageType on the input image.
- Passing the type and input image to ToBitmap.
- Passing the Bitmap and any optional arguments to BitmapToCoimage.
Example:
#include ImagePut.ahk
ImagePut.gdiplusStartup() ; Allow handling of GDI+ bitmaps.
image_type := ImagePut.ImageType("cats.jpg") ; Get the image_type as "file".
pBitmap := ImagePut.ToBitmap(image_type, "cats.jpg") ; Convert to pixel data.
hwnd := ImagePut.BitmapToCoimage("window", pBitmap, "Cat!") ; Show the image on-screen with a caption.
Dereferences objects like {file: "cats.jpg"}
to "cats.jpg".
Where all the magic happens. Calling ImagePut.ImageType("cats.jpg") will retrieve the windows image data type.
This function converts an image into a bitmap. Dispatches to all functions beginning with from_XXX.
pBitmap := ImagePut.ToBitmap("file", "cats.jpg")
Converts a bitmap into any supported image type. Dispatches to all functions beginning with put_XXX.
ImagePut.BitmapToCoimage("window", pBitmap)
This function converts an image into a stream. Dispatches to all functions beginning with get_XXX.
pStream := ImagePut.ToStream("file", "cats.jpg")
Converts a stream into any supported image type. Dispatches to all functions beginning with set_XXX.
filepath := ImagePut.StreamToCoimage("file", pStream)
These functions always convert to a pBitmap.
; Get the current wallpaper as a bitmap.
pBitmap := ImagePut.from_wallpaper()
; Get the current cursor as a bitmap.
pBitmap := ImagePut.from_cursor()
; Get a web image as a bitmap.
pBitmap := ImagePut.from_url("https://i.imgur.com/PBy1WBT.png")
These functions always convert from a bitmap into some type.
; Set the current wallpaper.
ImagePut.put_wallpaper(pBitmap)
; Set the cursor.
ImagePut.put_cursor(pBitmap)
These functions always convert to a pStream.
These functions always convert from a stream into some type.
SHCreateMemStream creates a memorystream. CreateStreamOnHGlobal creates a stream. The difference between the two outputs is that only GetHGlobalFromStream is supported by streams. Therefore to maximize compatibility, all set_XXX functions will create streams without the shlwapi functions. And all get_XXX functions will read both streams and memorystreams by never calling GetHGlobalFromStream.