iseahound / ImagePut

A core library for images in AutoHotkey. Supports AutoHotkey v1 and v2.
https://www.autohotkey.com/boards/viewtopic.php?f=83&t=76633
MIT License
116 stars 24 forks source link

I need an image window without a title bar, can it be achieved? #6

Closed sanmaodo closed 2 years ago

sanmaodo commented 2 years ago

I need an image window without a title bar, can it be achieved?

1019222412
iseahound commented 2 years ago

use ImageRender. It is part of TextRender. https://github.com/iseahound/TextRender

iseahound commented 2 years ago

Sample Script:

#include TextRender (for v1).ahk
#include ImagePut (for v1).ahk

buffer := ImagePutBuffer("media\untitled.png")
ir := ImageRender()
ir.Render(buffer.pBitmap, "t:1.5s k:s s:15 q:0")

Esc:: ExitApp

Also see: https://github.com/iseahound/TextRender/wiki/Styles, the styles are very similar for ImageRender, just that s becomes scale.

sanmaodo commented 2 years ago

think!

telppa commented 2 years ago
hWin := imageputwindow("1.png")
WinSet, Style, -0xC00000, ahk_id %hWin%

imageputwindow return window's hwnd. so you can easily remove the title bar.

iseahound commented 2 years ago

Hmm... That does something weird on my system. It's actually very easy to make one without a titlebar. I specifically tried to create a window with a title bar for the ImagePutWindow function. And make the windows without titlebar part of ImageRender.

iseahound commented 2 years ago

If I add a window without a titlebar, what do I call this new function? ImagePutWindow is already taken.

telppa commented 2 years ago

ImagePutDisplay ? ImagePutShow ? ImagePutMinWindow ? ImagePutWindow(p1, p2, notitlebar:=true) ?

iseahound commented 2 years ago

Alright I've decided on ImageShow().

ImageShow("https://picsum.photos/200")
ImageShow("https://picsum.photos/500", "a random pic", [500])
ImagePutWindow("https://picsum.photos/200/300")
ImagePut.gdiplusStartup()
ImagePut.show(ImagePutBitmap("https://picsum.photos/100"))

It's been added to the main script, feel free to test it out. In addition, ImagePutWindow has been extended to include a position parameter.

iseahound commented 2 years ago

Function signature

;   title      -  Window Title            |  string   ->   MyTitle
;   pos        -  Window Coordinates      |  array    ->   [x,y,w,h] or [0,0]
;   style      -  Window Style            |  uint     ->   WS_VISIBLE
;   styleEx    -  Window Extended Style   |  uint     ->   WS_EX_LAYERED
;   parent     -  Window Parent           |  ptr      ->   hwnd
ImageShow(image, title := "", pos := "", style := 0x10000000, styleEx := 0x80088, parent := 0) {
    return ImagePut("show", image, title, pos, style, styleEx, parent)
}