Has anyone made an effort at wrapping Direct2D for use with ahk v2?
I'm particularly struggling to marry a D2D1 bitmap with a GDIp bitmap's pBits and then draw to a layered hWnd RenderTarget. Any help would be greatly appreciated.
Direct2D
Re: Direct2D
@malcev
Thank you, I've managed to piece that together already. I'm struggling with two things in particular:
1] How do I convert a GDIp bitmap such that when I lock it's bits, I can pass that to ID2D1Bitmap::CopyFromMemory
2] How do I construct D2D1_POINT_2F for use with https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawline? The parameters are structs but they don't take pointers, it makes no sense lol.
Thank you, I've managed to piece that together already. I'm struggling with two things in particular:
1] How do I convert a GDIp bitmap such that when I lock it's bits, I can pass that to ID2D1Bitmap::CopyFromMemory
2] How do I construct D2D1_POINT_2F for use with https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawline? The parameters are structs but they don't take pointers, it makes no sense lol.
Re: Direct2D
I am currently not interested in ahk 2, but You may read here
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=63527
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=63527
Re: Direct2D
Very well, thank you.
Re: Direct2D
Cloaker on the AHK Discord server solved this for me. Here is the working solution:
Code: Select all
DrawLine(x1, y1, x2, y2, brush, strokeWidth := 1.0, strokeStyle := 0) {
point0 := Buffer(8)
NumPut("Float", x1, "Float", y1, point0)
point1 := Buffer(8)
NumPut("Float", x2, "Float", y2, point1)
ComCall(15, this.Ptr, "Double", NumGet(point0, "Double"), "Double", NumGet(point1, "Double"), "Ptr", brush, "Float", strokeWidth, "Ptr", strokeStyle, "Int")
}