Computer Science Canada

I'm new to GUI's, need some help.

Author:  gayden [ Wed Mar 25, 2015 9:47 am ]
Post subject:  I'm new to GUI's, need some help.

So I made a very simple, 3 lined program which is just supposed to open a picture, and I can't figure out why it's not working.
code:
var pic : int := 0
pic := Pic.FileNew ("turing.jpg")
Pic.Draw (pic, 10, 30, picCopy)

The picture file and the program file are in the same folder, this is the right name, I have also tried using the .bmp file extension and I keep receiving an error that says "Illegal picture ID number '0'. (Probable cause: picture was not successfully created.)."

Author:  Dreadnought [ Wed Mar 25, 2015 12:40 pm ]
Post subject:  Re: I'm new to GUI's, need some help.

Turing has various mysterious issues with some pictures (possibly because of updated file formats).

You might be able to get a slightly more descriptive error message with this, but I can't guarantee it will be any more informative.

Turing:
var pic : int := 0
pic := Pic.FileNew ("turing.jpg")
if (pic = 0) then
    put "Error Number: ", Error.Last
    put "Error Message: ", Error.LastMsg
    Error.Halt("Failed to load picture, see output window for details")
end if
Pic.Draw (pic, 10, 30, picCopy)

Author:  gayden [ Fri Mar 27, 2015 8:46 am ]
Post subject:  Re: I'm new to GUI's, need some help.

Dreadnought @ Wed Mar 25, 2015 12:40 pm wrote:
Turing has various mysterious issues with some pictures (possibly because of updated file formats).

You might be able to get a slightly more descriptive error message with this, but I can't guarantee it will be any more informative.

Turing:
var pic : int := 0
pic := Pic.FileNew ("turing.jpg")
if (pic = 0) then
    put "Error Number: ", Error.Last
    put "Error Message: ", Error.LastMsg
    Error.Halt("Failed to load picture, see output window for details")
end if
Pic.Draw (pic, 10, 30, picCopy)


Error 617, 'not a jpeg file: starts with 0x89 0x50'

Changed 'turing.jpg' to .bmp because that was the original file format, error 607, 'That is not a pic file'

I have discovered it works for other pictures, so this isn't really a significant problem (it was just a picture I made in a second in paint to test the program), thank you though

edit: Alright I'm wrong, it only works for about 50% of the pictures I try, I get the same errors

Author:  Dreadnought [ Sat Mar 28, 2015 8:10 am ]
Post subject:  Re: I'm new to GUI's, need some help.

Well it seems that your jpeg file is actually a png file that was renamed (files that start with 0x89 0x50 are png files).

As to why it won't recognise a bitmap file, I can't say. perhaps there is a new version of the bmp file format that Turing can't read.

Sorry I can't really be of much more help...

Author:  Insectoid [ Sat Mar 28, 2015 2:31 pm ]
Post subject:  RE:I\'m new to GUI\'s, need some help.

I know Turing can't read bitmaps with negative height values, but I'm not sure if it throws an error or just draws it wrong.


: