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

How do I use flags (scale and crop) with other arguments in ImagePutWindow? (More/more detailed examples please.) #20

Closed JoanEliot closed 1 year ago

JoanEliot commented 1 year ago

The main reference for ImagePutWindow documents the arguments (title, pos, style, etc.) individually but doesn't discuss calling the function with keyword instead of positional arguments. Then in the documentation for the flags, we get examples with keyword arguments for the image and the flags, but no examples/discussion of how to include other arguments (pos, title, etc.) when calling with flags.

I couldn't figure it out — my AHK is occasional — so I took the long way round: scaled with ImagePutBuffer first, then called ImagePutWindow with positional arguments, starting with the buffer pointer.

Additional examples using all the arguments, in both positional and keyword versions, would be appreciated, for those of us beginners, with perhaps a little explanation. Thanks.

iseahound commented 1 year ago

Feel free to suggest any changes to the documentation.

ImagePutWindow({image: "cats.jpg", scale: 2}, "My Title", [0, 0])

You can replace the image parameter with an object. Positional arguments are handled normally.

iseahound commented 1 year ago

For examples, please suggest what examples you would like to see. And if they are included as a download, file, or as text in the documentation.

iseahound commented 1 year ago

https://github.com/iseahound/ImagePut/wiki/Input-Types-&-Output-Functions#usage

JoanEliot commented 1 year ago

Those examples are very helpful, thanks.

A short explanation as to when and how the different types of parameters are used and how they are combined (and maybe what not to do) would also be nice. After seeing the examples, I think the basic idea is that if you use any of the flags, then you must use a keyword argument for the image type and the flags, and place the combination of the image type and flag keyword arguments in curly brackets as the first positional argument in your call. I'm sure there's a simpler way to say that.

Appreciate very much your work.

iseahound commented 1 year ago

I'm sure there's a simpler way to say that.

I'm not too sure about that. I'd have to resort to phrases like positional arguments, keywords, wrapper objects, generic types. So, I deleted that. I think Examples short and succinct can do the trick.

I'll close this ticket for now.