Old 12-09-2018, 07:33 PM   #1
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 301
Default How do you add an image to a GUI?

I have tried and searched and done things that I can't say in public to figure out how to add a simple .png as a logo to a Lokasenna generated script, and I just can't figure this stuff out. There's gfx, buffers, and dare I say, blitting (oh, my!) that I don't understand how they all work together in the GUI environment. I totally got lost looking through this thread.

What super powers must one possess in order to put a .png image at x=5, y=5, w=150, h=120 on a Lokasenna GUI? And where in the script must it be placed?
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is offline   Reply With Quote
Old 12-09-2018, 07:51 PM   #2
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,223
Default

Is it a script, that uses his Gui-Lib?

If yes, theres an image-class, that you can use.

More on his GUI-lib at:
https://forum.cockos.com/showthread.php?t=177772
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is online now   Reply With Quote
Old 12-09-2018, 08:00 PM   #3
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 301
Default

Quote:
Originally Posted by mespotine View Post
Is it a script, that uses his Gui-Lib?

If yes, theres an image-class, that you can use.

More on his GUI-lib at:
https://forum.cockos.com/showthread.php?t=177772
I've gone over that page a few times too. Where's this image class?

And yes, it's using his GUI-Lib.
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."

Last edited by tXShooter; 12-09-2018 at 08:05 PM.
tXShooter is offline   Reply With Quote
Old 12-09-2018, 08:26 PM   #4
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,223
Default

Hmm...for some reasons I can't find it. I know only an old version, so maybe it's not there anymore.

But you can try:

Code:
gfx.loadimg(100,"picturefilename.png") -- load imagefile into framebuffer 100
gfx.x=5 -- set x-position to 5
gfx.y=5 -- set y-position to 5
gfx.blit(100,1,0) -- blit at x and y position in original size and unrotated
gfx.update()
which should blit the image in the framebuffer 100(as set by the loadimg-function).
You can use the longer version of gfx.blit, with which you can also set, which part of the framebuffer 100 you want to blit(src-named-parameters), as well as the exact position, at which to blit the framebuffer 100(dst-named parameters).

I don't know, where to include it, probably after GUI.Init() and before GUI.update()-functions
(I hope, these functions still exist in the current version...)
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is online now   Reply With Quote
Old 12-09-2018, 08:56 PM   #5
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 301
Default

Quote:
Originally Posted by mespotine View Post
Hmm...for some reasons I can't find it. I know only an old version, so maybe it's not there anymore.

But you can try:

Code:
gfx.loadimg(100,"picturefilename.png") -- load imagefile into framebuffer 100
gfx.x=5 -- set x-position to 5
gfx.y=5 -- set y-position to 5
gfx.blit(100,1,0) -- blit at x and y position in original size and unrotated
gfx.update()
which should blit the image in the framebuffer 100(as set by the loadimg-function).
You can use the longer version of gfx.blit, with which you can also set, which part of the framebuffer 100 you want to blit(src-named-parameters), as well as the exact position, at which to blit the framebuffer 100(dst-named parameters).

I don't know, where to include it, probably after GUI.Init() and before GUI.update()-functions
(I hope, these functions still exist in the current version...)
I had tried essentially just that, except that I tried it in buffers 0 and 1 instead of 100. I tried it in the Init(), in the Main(), and in the beginning, and in the end, and in the... hmm... I think that I even tried it with green eggs and ham.

I'm obviously missing something elemental.
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is offline   Reply With Quote
Old 12-09-2018, 09:44 PM   #6
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,223
Default

Have you tried it in a new script? Just to see, whether it works in the first place..
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:23 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.