|
|
|
12-09-2018, 07:33 PM
|
#1
|
Human being with feelings
Join Date: Aug 2017
Posts: 336
|
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."
|
|
|
12-09-2018, 07:51 PM
|
#2
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
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
|
|
|
12-09-2018, 08:00 PM
|
#3
|
Human being with feelings
Join Date: Aug 2017
Posts: 336
|
Quote:
Originally Posted by mespotine
|
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.
|
|
|
12-09-2018, 08:26 PM
|
#4
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
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...)
|
|
|
12-09-2018, 08:56 PM
|
#5
|
Human being with feelings
Join Date: Aug 2017
Posts: 336
|
Quote:
Originally Posted by mespotine
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."
|
|
|
12-09-2018, 09:44 PM
|
#6
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Have you tried it in a new script? Just to see, whether it works in the first place..
|
|
|
Thread Tools |
|
Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 02:54 PM.
|