1. Bitmap

Hi,

      How can I incorporate a bitmap image to a Euphoria program without
having to read in an external file?

   Thanks in advance

  Norm

------------------------------------------------------------------------
Normand M. Blais
Sr geophysicist                                Geco-Prakla NSA
Data Analysis Support Group                    1325 S. Dairy-Ashford Rd.
blais at houston.geco-prakla.slb.com              Houston, TX   77077
Voice 281-588-1260  Fax 281-596-1550           USA
 =======================================================================
 _   _   _
| |_| |_| |
|         |
\         /
 =========
   |   |
   |   |
   |   |
  /     \
 /       \
===========
|         |
===========

 =======================================================================

new topic     » topic index » view message » categorize

2. Re: Bitmap

>Hi,
>
>      How can I incorporate a bitmap image to a Euphoria program without
>having to read in an external file?
>
>   Thanks in advance
>
>  Norm

Try reading the bitmap and then saving the sequence into an external file.
Then copy the contents of the external file into your main ex.

for example, say the file you want to read is c:\windows\arcade.bmp
--
sequence image
  image=read_bitmap("c:\\windows\\arcade.bmp")
atom file_
  file_=open("image.txt","w")
     print(file_,image[2])
  close(file_)
--
This would save image[2] into file "image.txt"
copy whatever there is in image.txt into your program....
constant image =
{{6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6},...,
 {6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6}}

after this the constant image can be used in display_image()
display_image({0,0}, image)

l8r,
/.ViC./
 ______________________________________________________________________
|     http://www.geocities.com/SiliconValley/Heights/8858/home.htm     |
|                     Veni vidi, vici. Fiat lux.                       |
|______________________________________________________________________|

new topic     » goto parent     » topic index » view message » categorize

3. Re: Bitmap

>       How can I incorporate a bitmap image to a Euphoria program
without
> having to read in an external file?
>
>    Thanks in advance
>
>   Norm

(Cheer-ing): Nooooooooooorm!
Woody: Jack Frost nippin' at your nose, Mr Peterson?
Norm : Yeah, now let's get Jack Beer nippin' at my liver, Woody

sorry...had to do that.

The only other way of having a bitmap being displayed from inside the
program as opposed to accessing it as an external file is to convert it to
Euphoria source statements:

1) open a file named addon.ex in text mode using open()

2) use read_bitmap() to access the external bitmap file, and then write
the second element of the retrieved sequence value to file addon.ex by
using print()

3) load addon.ex into an editor. Add the following in front of the
sequence value written in step 2):

     picture =

You may have to do a little extra editing to format the data.

What you should have at this point is

picture = {long sequence value}

3) Merge addon.ex into a program that will use the converted bitmap
data and use display_image() to display the content of variable picture.
Don't forget to declare picture or whatever variable you want to create
in the program.

This way, your bitmap data is now a part of the program, and not something
you have to access the hard drive to get.

David Gay
http://www.interlog.com/~moggie/Euphoria
"A Beginner's Guide to Euphoria"

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu