Liberty BASIC Community Forum
« Graphicbox »

Welcome Guest. Please Login or Register.
Mar 29th, 2017, 04:16am


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Graphicbox  (Read 166 times)
johnatuna
Senior Member
ImageImageImageImage


member is offline

Avatar

Oh cool! My computer comes with a coffee cup holder!


PM

Gender: Male
Posts: 287
xx Graphicbox
« Thread started on: Jun 10th, 2016, 04:48am »

Is it possible to load a bmp in a graphicbox? If so, How? smiley
User IP Logged

Johnatuna = John at UNA(University of North Alabama)
JohnnyD
Guru
ImageImageImageImageImage


member is offline

Avatar

"If something should, then it doesn't, isn't, can't, hasn't or won't"


Homepage PM

Gender: Male
Posts: 749
xx Re: Graphicbox
« Reply #1 on: Jun 10th, 2016, 05:45am »

Hi,

There is an example in the help file, but this is how:

Code:
    nomainwin
    graphicbox #main.gr,0,0,100,100
    loadbmp "copyimage","bmp\copy.bmp"
    open "graphics" for window as #main
    #main,"trapclose [quit]"
    #main.gr,"drawbmp copyimage 10 10"
    wait


[quit]
    unloadbmp ("copyimage")
    close #main
    end
 


Just change to name of the BMP ("copy.bmp" above) and the reference to it ("copybmp") to whatever you want and there you go.

JohnnyD.
User IP Logged

johnatuna
Senior Member
ImageImageImageImage


member is offline

Avatar

Oh cool! My computer comes with a coffee cup holder!


PM

Gender: Male
Posts: 287
xx Re: Graphicbox
« Reply #2 on: Jun 10th, 2016, 06:50am »

I tried this code:

Code:
nomainwin
    graphicbox #main.gr,10,10,100,100
    loadbmp "card","bmp\SQUARTTT.bmp"
    open "graphics" for window as #main
    #main,"trapclose [quit]"
    #main.gr,"drawbmp card 100 100"
    wait


[quit]
    unloadbmp ("card")
    close #main
    end
 


The graphicbox stays white. No picture is in the box???
User IP Logged

Johnatuna = John at UNA(University of North Alabama)
MKnarr
Senior Member
ImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 424
xx Re: Graphicbox
« Reply #3 on: Jun 10th, 2016, 07:20am »

Try this:

Code:
nomainwin
    graphicbox #main.gr,10,10,100,100
    loadbmp "card","bmp\SQUARTTT.bmp"
    open "graphics" for window as #main
    #main,"trapclose [quit]"
    #main.gr,"down; drawbmp card 0 0;flush"
    wait


[quit]
    unloadbmp ("card")
    close #main
    end
 


You have to put the pen down and draw at the upper left corner, not the lower right.
« Last Edit: Jun 10th, 2016, 1:19pm by MKnarr » User IP Logged

Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5216
xx Re: Graphicbox
« Reply #4 on: Jun 10th, 2016, 07:20am »

No graphics are drawn till the pen is DOWN. So you need a down command sent to the graphic box.
User IP Logged

johnatuna
Senior Member
ImageImageImageImage


member is offline

Avatar

Oh cool! My computer comes with a coffee cup holder!


PM

Gender: Male
Posts: 287
xx Re: Graphicbox
« Reply #5 on: Jun 10th, 2016, 07:35am »

Using this code:

Code:
nomainwin
    graphicbox #main.gr,10,10,100,100
    loadbmp "card","bmp\X.bmp"
    open "graphics" for graphics_nsb_nf as #main
    #main,"trapclose [quit]"
    #main.gr, "down; home"
    #main.gr,"drawbmp card 100 100"
    #main.gr, "flush"
    wait

[quit]
    unloadbmp ("card")
    close #main
    end
 


I do not understand why the bmp is not showing in the box.
User IP Logged

Johnatuna = John at UNA(University of North Alabama)
tenochtitlanuk
Moderator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 1138
xx Re: Graphicbox
« Reply #6 on: Jun 10th, 2016, 09:16am »

Change your line
Code:
#main.gr,"drawbmp card 100 100" 

to
Code:
#main.gr,"drawbmp card 10 10" 

and you'll see why!
« Last Edit: Jun 10th, 2016, 09:16am by tenochtitlanuk » User IP Logged

JohnnyD
Guru
ImageImageImageImageImage


member is offline

Avatar

"If something should, then it doesn't, isn't, can't, hasn't or won't"


Homepage PM

Gender: Male
Posts: 749
xx Re: Graphicbox
« Reply #7 on: Jun 10th, 2016, 10:59am »

I tried with "up" & "down" and no command and it still printed the bmp.

Hi Johnatuna, the co-ords are from top left as mentioned in the post above.

John.
User IP Logged

johnatuna
Senior Member
ImageImageImageImage


member is offline

Avatar

Oh cool! My computer comes with a coffee cup holder!


PM

Gender: Male
Posts: 287
xx Re: Graphicbox
« Reply #8 on: Jun 10th, 2016, 9:27pm »

Thank you all for the help. It is now working. cheesy
User IP Logged

Johnatuna = John at UNA(University of North Alabama)
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls