#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    8
    Rep Power
    0

    Importing graphics with Borland 5 compiler


    Hello, all.

    I am taking classes in C++, and am reaching the end of the year. However, the class does not cover graphics, and I basically taught myself that, through my prior knowledge of various other languages.

    While I have gotten the hang of graphics quite easily, I was wondering if there was a quick and easy way to load an external image from the disk, through use of libraries or an included function.

    On another topic, while using the Windows BGI library, is there any way to have the other output window open up, and just use the Windows BGI window? The other window has my project title as it's title, and all of the iostream functions are executed here. While using the DOS BGI library, iostream functions were done in the same window as the graphics.

    All help is greatly appreciated.
    SpacePirate
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,595
    Rep Power
    4207
    >> I was wondering if there was a quick and easy way to load an external image from the disk, through use of libraries or an included function

    You can use getimage() to get an area of the screen and put it in an array. You could then write this array to disk. Later, when you want to display the image, you can read it from file into an array and then use putimage to transfer the image on to the screen.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    8
    Rep Power
    0
    I don't believe we have done files quite yet, and so I don't know how to load from an external file...

    Is there any way I can use the putimage() function with an already existing bitmap?

    If anyone can just tell me the libraries to include, and the basics of what to do, I'm pretty sure I can figure out the rest for myself...

    Thanks!
  6. #4
  7. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,595
    Rep Power
    4207
    >> Is there any way I can use the putimage() function with an already existing bitmap?
    Yes, provided it is in the correct format.

    >> If anyone can just tell me the libraries to include,
    putimage() is a function of the BGI library. Since it appears that you're already using the BGI library, you don't need to include anything else.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    8
    Rep Power
    0
    The format for putimage is putimage(int __left, int __top, const void far *__bitmap, int __op), as I'm sure you know. However, the bitmap points to a bitmap already in memory. How would you go about loading a bitmap saved to a disk into memory, so I can use it with the putimage operation?

    Sorry for the lack of clarity.
  10. #6
  11. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,595
    Rep Power
    4207
    >> How would you go about loading a bitmap saved to a disk into memory.
    fread() or blockread(), I guess :)
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    8
    Rep Power
    0
    Allrighty!

    Thanks!

IMN logo majestic logo threadwatch logo seochat tools logo