No announcement yet.

Multiple displaying of JPGs/GIFs?

  • Filter
  • Time
  • Show
Clear All
new posts

    Multiple displaying of JPGs/GIFs?

    I am trying to write a program that will allow a child to
    work a scrambled picture. (Let's use a picture of his mother
    for clarity here.)

    I have used graphics program to "cut" the picture into a
    four by four picture grid, with a corner missing. I have saved
    each piece as a JPG file.

    My program will generate a random order, which works. Now my
    problem: Assume the random order to be:


    That order calls for displaying 05.jpg in the top left corner,
    display 01.jpg to the left of it, 09.jpg to the left of it, and
    14.jpg in the top right corner. And so on for 15 pieces. One
    piece must be "missing" to make room to move around. Of course,
    it also means that my JPGs must be deliberately presized so as to
    fit in the space properly.

    Now my question:
    I can display one gif/jpg in Powerbasic, but how do I display
    multiple images and how do I control where they are displayed
    on the screen? When I display one gif/jpg from Powerbasic, it
    attempts to fill the screen with that image, something I need
    to get control over.

    Or is it impossible?



    [This message has been edited by Robert Carneal (edited October 26, 2001).]

    Why would it be impossible? Question is, can you do it directly with
    whatever display routines you're using for the JPG/GIF support. If so,
    you're already there. If not, at worst, you'll need to read the image
    data off the screen and store it in your own format, so you can put it
    on the screen where you want. If you're using a screen mode that
    PB/DOS understands, the graphics GET and PUT statements are designed
    for just that sort of work.

    Tom Hanlin
    PowerBASIC Staff


      And I thought I was proficient in Basic programming than most!!

      GET and PUT? May I download an example using those
      functions/commands? They sound like commands to put one pixel
      at a time wherever the programmer wants.

      Thank you.




        The BALL.BAS example that comes with PowerBASIC uses GET and PUT. The process isn't terribly complicated, though-- you might just start with the manual or help file. GET allows you to read an area of a graphics screen, and store it in an array. PUT allows you to put the image back, wherever you want it.

        Tom Hanlin
        PowerBASIC Staff


          GET and PUT graphics functions? I know of POINT and PSET, but GET and PUT?

          I will have to check out this BALL demo....maybe it will help with some things
          I am having trouble with...



          mailto:[email protected][email protected]</A>


            Yes, GET and PUT each have two modes of operation: disk file I/O <U>and</U> graphics.

            Please refer to the PB3.5 Reference Guide. Thanks!

            PowerBASIC Support
            mailto:[email protected][email protected]</A>
            mailto:[email protected]


              It's an excellent idea to read through the manuals at least once. Even if you've been using PowerBASIC for years, odds are you'll pick up a few new tricks. There's a lot to the language!

              Tom Hanlin
              PowerBASIC Staff



                This is OFF topic, but Tom will enjoy the heck out of this!

                It IS a good idea to read everything at least once, I
                wholeheartedly agree. In college, I had a professor who used to
                be Chancellor at another college and didn't believe in doing
                the teaching himself. We (us, the students in class) were
                assigned to teach the class by giving lectures and showing
                examples. The professor would play the role of "student" asking
                questions to see how well you knew the material. It was part
                of your grade- do you know it well enough to teach it?

                He would assign Chapter 1 to person A, Chap 2 to another student
                and so on until every student had two chapters to teach. I had
                Chapter 2 which was the second week, and covered static arrays.

                I made up a handout synophisizing what my lecture was about. By
                accident, I asked if there were any questions. Professor "didn't"
                understand, and wanted more examples. I asked if he understood
                the ones in the book? Then it HIT me, most of the students' books
                in that class were still in the shrink wrap!! I had not realized
                just how many of us avoid reading the manuals/textbooks. Wow. I
                swore to myself NEVER to be guilty of that, and you caught me.

                For other readers, sorry to be off topic.



                [This message has been edited by Robert Carneal (edited October 29, 2001).]