1. RE: Display Picture.

Hi Sam,

>From my poor memory I think read_bitmap only supports 256 (8 bit) 
colour images.

It's also "possible" that some of the more advanced compression 
techniques aren't handled by read_bitmap either. I'm not sure about
this but it would be worth reading the docs for read_bitmap.

Ray Smith

 Sam wrote:
> Hi ...
> 
>    Appreciate the answers I've gotten from you guys. Hope you can come 
> up with one more. I can't seem to get Euphoria to display a picture.
> 
>   include image.e
>   sequence Pic1
>   Pic1 = read_bitmap ("C:\\Euphoria\\MyPic.Bmp")
> 
>   Got message "type_check failure, MyPic is 1" 
> 
>    Tried a different picture. This time, for variety, I got, "type_check 
> failure, DiffPic is 3."
> 
>    Wasn't going to give up that easily though. Changed the program 
> slightly.
> 
>    include image.e
>    object Pic1
>    Pic1 = read_bitmap ("C:\\Euphoria\\MyPic.Bmp")
> 
>    Hey! No error msg. this time!
> 
>    So I added a line:
> 
>    display_image ({100, 20}, Pic1 [2])
> 
>    This time I got, "attempt to subscript an atom
>                      (reading from it)"
> 
>    So then I tried to run the `Bitmap.ex' program in the demo\dos32 
> directory. Tried three different pictures. One showed up on screen, but 
> only the bottom 20 percent. The other two get msg, `unsupported format.' 
> 
> 
>    Any idea??
> 
>    Thanks,
> 
>    Sam 
> 
> 



Ray Smith
http://rays-web.com

new topic     » topic index » view message » categorize

2. RE: Display Picture.

euman at bellsouth.net wrote:
> Hello Sam,
> 
> read_bitmap( ) can only read in 256 color images and cannot handle RLE 
> encoded images.
> 
> Personally I use 256 color images because there is a good chance that 
> later down the
> road in your development you will be pressed with having to have the 
> ability to to
> run or display your program on a computer that isnt equiped with 
> hardware to handle
> any higher resolution that 640 width - 480 height - 256 colors. You 
> should keep this in
> mind when you start a project by asking who your target audience will 
> be. If its an desktop
> application for business this is certain to be an issue. On the other 
> hand, if you're a gamer
> then high color sure makes for a nice look but there is a penalty that 
> must be paid for
> the higher color, in speed. If you can hone the talent of the DOS world 
> and there are some
> nice looking games written that only use 256 colors in DOS then you'll 
> be better off in future endevores.
> 
> Im saying this because I myself fell into this lazy way of graphics 
> handling and only recently
> did I discover how Windows handles palettes and this came after writing 
> thousands of lines
> in a nice GUI only to re-write code due to the very fact that my app 
> would not look or
> function properly on the lesser machines.
> 
> Hopefully words of wisdom and if I can help you with this I certainly 
> will..
> 

Thanks for the words of wisdom. I made a quick sketch in Paint and saved 
it in 256 format. Still get message `attempt to subscript an atom.' And 
the `Bitmap' demo displayed it with only the bottom portion showing.

   What do you think?? Is there a way to display other pictures (.jpg, 
.gif)??

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

3. RE: Display Picture.

Sam wrote:
> 
> euman at bellsouth.net wrote:
> > Hello Sam,
> > 
> > read_bitmap( ) can only read in 256 color images and cannot handle RLE 
> > encoded images.
> > 
> > Personally I use 256 color images because there is a good chance that 
> > later down the
> > road in your development you will be pressed with having to have the 
> > ability to to
> > run or display your program on a computer that isnt equiped with 
> > hardware to handle
> > any higher resolution that 640 width - 480 height - 256 colors. You 
> > should keep this in
> > mind when you start a project by asking who your target audience will 
> > be. If its an desktop
> > application for business this is certain to be an issue. On the other 
> > hand, if you're a gamer
> > then high color sure makes for a nice look but there is a penalty that 
> > must be paid for
> > the higher color, in speed. If you can hone the talent of the DOS world 
> > and there are some
> > nice looking games written that only use 256 colors in DOS then you'll 
> > be better off in future endevores.
> > 
> > Im saying this because I myself fell into this lazy way of graphics 
> > handling and only recently
> > did I discover how Windows handles palettes and this came after writing 
> > thousands of lines
> > in a nice GUI only to re-write code due to the very fact that my app 
> > would not look or
> > function properly on the lesser machines.
> > 
> > Hopefully words of wisdom and if I can help you with this I certainly 
> > will..
> > 
> 
> Thanks for the words of wisdom. I made a quick sketch in Paint and saved 
> 
> it in 256 format. Still get message `attempt to subscript an atom.' And 
> the `Bitmap' demo displayed it with only the bottom portion showing.
> 
>    What do you think?? Is there a way to display other pictures (.jpg, 
> .gif)??
> 

There are libraries in the RDS archives for handling jpg, gif, and pcx 
files that I know of. Probably others.

Chris

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

4. RE: Display Picture.

Sam wrote:
> Hi ...
> 
>    Appreciate the answers I've gotten from you guys. Hope you can come 
> up with one more. I can't seem to get Euphoria to display a picture.
> 
>   include image.e
>   sequence Pic1
>   Pic1 = read_bitmap ("C:\\Euphoria\\MyPic.Bmp")
> 
>   Got message "type_check failure, MyPic is 1" 
> 
>    Tried a different picture. This time, for variety, I got, "type_check 
> failure, DiffPic is 3."
> 
>    Wasn't going to give up that easily though. Changed the program 
> slightly.
> 
>    include image.e
>    object Pic1
>    Pic1 = read_bitmap ("C:\\Euphoria\\MyPic.Bmp")
> 
>    Hey! No error msg. this time!
> 
>    So I added a line:
> 
>    display_image ({100, 20}, Pic1 [2])
> 
>    This time I got, "attempt to subscript an atom
>                      (reading from it)"
> 
>    So then I tried to run the `Bitmap.ex' program in the demo\dos32 
> directory. Tried three different pictures. One showed up on screen, but 
> only the bottom 20 percent. The other two get msg, `unsupported format.' 
> 
> 
>    Any idea??
> 
>    Thanks,
> 
>    Sam 
> 

read_bitmap() returns a a 2-element sequence where the first element is 
a sequence that contains the bitmap palette, and the second is a 
sequence containing the bitmap data.

Bitmaps of 2, 4, 16 or 256 colors are supported. If the file is not in a 
good format, an error code (atom) is returned instead: 
 
     global constant BMP_OPEN_FAILED = 1,
                 BMP_UNEXPECTED_EOF = 2,
             BMP_UNSUPPORTED_FORMAT = 3


Your first attempt failed to open the specified bitmap. Your second 
attempt tried to open an unsupported bitmap. The third attempt also 
failed to read_bitmap(), but you didn't check to see if Pic1 was 
successful and passed an atom to display_image(), when it accepts a 
sequence.

This is what you should have, to be safe.
(untested code)

object Pic1
Pic1 = read_bitmap("C:\\Euphoria\\MyPic.Bmp")
if atom(Pic1) then
   puts(2,sprintf("read_bitmap() failed. Error code: %d\n",Pic1))
   abort(1)
end if

display_image({100,20},Pic1[2])


I can't explain why you would get unexpected images displayed, except 
that the bitmaps you are trying to use probably aren't supported.


Chris

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

5. RE: Display Picture.

Sam wrote:
> Hi ...
> 
>    Appreciate the answers I've gotten from you guys. Hope you can come 
> up with one more. I can't seem to get Euphoria to display a picture.
> 
>   include image.e
>   sequence Pic1
>   Pic1 = read_bitmap ("C:\\Euphoria\\MyPic.Bmp")
> 
>   Got message "type_check failure, MyPic is 1" 
> 
>    Tried a different picture. This time, for variety, I got, "type_check 
> failure, DiffPic is 3."
> 
>    Wasn't going to give up that easily though. Changed the program 
> slightly.
> 
>    include image.e
>    object Pic1
>    Pic1 = read_bitmap ("C:\\Euphoria\\MyPic.Bmp")
> 
>    Hey! No error msg. this time!
> 
>    So I added a line:
> 
>    display_image ({100, 20}, Pic1 [2])
> 
>    This time I got, "attempt to subscript an atom
>                      (reading from it)"
> 
>    So then I tried to run the `Bitmap.ex' program in the demo\dos32 
> directory. Tried three different pictures. One showed up on screen, but 
> only the bottom 20 percent. The other two get msg, `unsupported format.' 
> 
> 
>    Any idea??
> 
>    Thanks,
> 

Sam:

You could use my win32eru by using borlands free resource compiler
you can creating a windows resource file ( .RES ) and then converting
it using win32eru to a euphoria include file. As far as I know
windows resource compilers have no restrictions on colors. Maybe
someone could try using a high color bitmap to prove me wrong
because I don't have any access to a high color bitmap. win32eru
will write all the resource creation routines while its translating. 
The other advantage to using win32eru is that you can create
ALL your resources using a windows resource editor.
There is a demo and docs included to help you.

http://www.rapideuphoria.com/win32eru.zip

Bernie

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

6. RE: Display Picture.

jluethje at gmx.de wrote:
> Hi,
> 
> Bernie wrote:
> 
> > [...]
> > You could use my win32eru by using borlands free resource compiler
> > you can creating a windows resource file ( .RES ) and then converting
> > [...]
> 
> That sounds very interesting. Do you know, if there is a resource
> *editor* along with borlands free resource compiler?


Juergen:

You only need a resource editor if you want to do complex
resource designs and don't like to do a lot of typing. You
can always use any text editor. The resource compiler
MUST generate 32-BIT resource files.

If you want to use a resource editor then here is the manual
for Weditres resource editor which explains how to design
and compile resources.
 
http://www.q-software-solutions.com/lccwin32/manual/Weditres.htm

This is where you can download the Weditres resource editor.

http://www.objectcentral.com/downloads.htm

Bernie

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

Search



Quick Links

User menu

Not signed in.

Misc Menu