Old 12-09-2018, 07:33 PM   #1
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
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
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
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
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 12-09-2018, 08:00 PM   #3
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
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
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
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...)
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 12-09-2018, 08:56 PM   #5
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
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
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Have you tried it in a new script? Just to see, whether it works in the first place..
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   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 02:54 PM.


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