• Print

Author Topic: A Tutorial on _PUTIMAGE 1  (Read 204 times)

Billbo

  • Sr. Member
  • ****
  • Posts: 286
    • Email
A Tutorial on _PUTIMAGE 1
« on: February 24, 2013, 08:38:03 AM »
OlDosLover,

I like your tutorial. Pretty thorough.

Bill

OlDosLover

  • Hero Member
  • *****
  • Posts: 3859
  • OlDosLover
    • Email
Re: A Tutorial on _PUTIMAGE 1
« Reply #1 on: February 24, 2013, 08:41:14 AM »
Hi all,
    Thank you Bill. Its spose to be educational.
OlDosLover.

LINUXQB64gltester

  • Full Member
  • ***
  • Posts: 240
    • Anyone that likes Art
Re: A Tutorial on _PUTIMAGE 1
« Reply #2 on: February 24, 2013, 09:19:17 AM »
Glad to see that get in there,..combined with the print tutorial,..
   Some things more that at least I find interesting, and usefull, I suspect ,especially begginers,
but can not speak for everyone,
 Anyway, as well or additionally, after we learn about PRINT, and then with _PUTIMAGE,
 LOCATE,  is a important command, combine these, one can create a program with Images, and captions,.. I may edit this later, or perhaps better start another topic, in the beginners area,---
anyway glad to see the tutorial.
For off topic discussions :
Non-QB64 Related Discussion Forum
Also
My Experimenting Forum
"QB64 has a great future!"

Mrwhy

  • Hero Member
  • *****
  • Posts: 2890
  • My Dad called me Mr Why when I was 5.
    • Email
Re: A Tutorial on _PUTIMAGE 1
« Reply #3 on: February 24, 2013, 09:25:35 AM »
And perhaps the very clever coding scheme mentioned here this month that puts the caption INSIDE the picture (as colour variation)

Amaysim

  • Newbie
  • *
  • Posts: 34
    • Email
Re: A Tutorial on _PUTIMAGE 1
« Reply #4 on: February 25, 2013, 11:13:22 AM »
Great tutorial OlDos , my son and me learned so much we can actually use the command now and not always get errors. Do you have any video tutorials?

OlDosLover

  • Hero Member
  • *****
  • Posts: 3859
  • OlDosLover
    • Email
Re: A Tutorial on _PUTIMAGE 1
« Reply #5 on: February 25, 2013, 10:05:02 PM »
Hi all,
    Thanks Amaysim.
Quote
And perhaps the very clever coding scheme mentioned here this month that puts the caption INSIDE the picture (as colour variation)
Then do it MrWhy , more tut's are a good thing and if you think it should be added then go ahead and add it. Just give credit to the other author's if you feel they need or deserve it.
OlDosLover.

Amaysim

  • Newbie
  • *
  • Posts: 34
    • Email
Re: A Tutorial on _PUTIMAGE 1
« Reply #6 on: March 03, 2013, 09:22:04 AM »
I guess not  thats ok.

OlDosLover

  • Hero Member
  • *****
  • Posts: 3859
  • OlDosLover
    • Email
Re: A Tutorial on _PUTIMAGE 1
« Reply #7 on: March 03, 2013, 09:31:01 AM »
Hi all,
    Sorry for not answering this earlier i seem to have missed it. I dont have any video tutorials as yet but i do plan them for the future , so keep an eye out.
OlDosLover.

codeguy

  • Hero Member
  • *****
  • Posts: 3552
  • what the h3ll did i name that code?
    • stuff at dkm
    • Email
Re: A Tutorial on _PUTIMAGE 1
« Reply #8 on: March 03, 2013, 12:50:21 PM »
you're welcome to make a tutorial on _printstring and _printwidth using:
Code: [Select]
'* fontmovedemo.bas by codeguy
oscreenh& = _SCREENIMAGE
oscreenw% = _WIDTH(oscreenh&)
oscreenh% = _HEIGHT(oscreenh&)
DemoScreenh& = _NEWIMAGE(oscreenw%, oscreenh%, 256)
SCREEN DemoScreenh&
DIM SHARED demo$(4), xi%(4), yi%(4), x%(4), y%(4), wqb64%(4), fntheight%
fntheight% = 30
fontLoad& = _LOADFONT("C:\windows\fonts\lucon.ttf", fntheight%)
_FONT fontLoad&
demo$(0) = "* QB64 *"
demo$(1) = "It's"
demo$(3) = "More Powerful"
demo$(4) = "Than Ever!"
FOR i = 0 TO 4
    wqb64%(i) = _PRINTWIDTH(demo$(i))
    xi%(i) = 3 + INT(5 - RND * 5) OR 1
    yi%(i) = 3 + INT(5 - RND * 5) OR 1
    x%(i) = INT(RND * (oscreenw% - wqb64%(i)))
    y%(i) = INT(RND * (oscreenh% - fntheight%))
NEXT
DO
    CLS
    FOR i = 0 TO 4
        IF x%(i) < 0 THEN
            xi%(i) = -xi%(i)
            'COLOR INT(RND * 15) + 1
        ELSEIF x%(i) > oscreenw% - wqb64%(i) THEN
            xi%(i) = -xi%(i)
            'COLOR INT(RND * 15) + 1
        END IF
        x%(i) = x%(i) + xi%(i)

        IF y%(i) < 0 THEN
            yi%(i) = -yi%(i)
            'COLOR INT(RND * 15) + 1
        ELSEIF y%(i) > oscreenh% - fntheight% THEN
            yi%(i) = -yi%(i)
            'COLOR INT(RND * 15) + 1
        END IF
        y%(i) = y%(i) + yi%(i)
        centerx% = (oscreenw% - wqb64%(i)) / 2
        centery% = (oscreenh% - fntheight%) / 2
        _PRINTSTRING (x%(i), y%(i)), demo$(i), DemoScreenh&
        '_PRINTSTRING (centerx%, y%(i)), demo$(i), DemoScreenh&
        '_PRINTSTRING (x%(i), centery%), demo$(i), DemoScreenh&
        '_PRINTSTRING (centerx%, centery%), demo$(i), DemoScreenh&
        FOR j% = 0 TO 4
            IF j% <> i THEN
                Detect i, j%
            END IF
        NEXT
    NEXT
    '_LIMIT 100
    _DISPLAY
LOOP UNTIL INKEY$ > ""
SCREEN 0
_FREEIMAGE oscreenh&
_FREEIMAGE DemoScreenh&
SYSTEM
SUB Detect (i%, j%)
IF x%(i%) >= x%(j%) THEN
    x1i% = x%(i%)
    x2i% = x%(i%) + wqb64%(i%)
    y1i% = y%(i%)
    y2i% = y%(i%) + fntheight%
    x1j% = x%(j%)
    x2j% = x%(j%) + wqb64%(j%)
    y1j% = y%(j%)
    y2j% = y%(j%) + fntheight%
ELSE
    x1i% = x%(j%)
    x2i% = x%(j%) + wqb64%(j%)
    y1i% = y%(j%)
    y2i% = y%(j%) + fntheight%
    x1j% = x%(i%)
    x2j% = x%(i%) + wqb64%(i%)
    y1j% = y%(i%)
    y2j% = y%(i%) + fntheight%
END IF
IF x1i% >= x1j% AND x1i% <= x2j% THEN
    IF y1i% >= y1j% AND y1i% <= y2j% THEN
        xi%(i%) = -xi%(i%)
        xi%(j%) = -xi%(j%)
        yi%(i%) = -yi%(i%)
        yi%(j%) = -yi%(j%)
    END IF
END IF
END SUB
from original post: http://www.qb64.net/forum/index.php?topic=1587.msg13757#msg13757
http://denteddisk.forums-free.com/make-an-appointment-with-the-resident-code-guru-f34.html

OlDosLover

  • Hero Member
  • *****
  • Posts: 3859
  • OlDosLover
    • Email
Re: A Tutorial on _PUTIMAGE 1
« Reply #9 on: March 03, 2013, 09:03:38 PM »
Hi all,
    Thanks codeguy i will look into it. I still got PUTIMAGE 3 coming yet.
OlDosLover.

  • Print