Computer Science Canada

Pic.Draw is Making Me Angry

Author:  Zampano [ Fri Oct 19, 2007 8:24 am ]
Post subject:  Pic.Draw is Making Me Angry

I'm trying to venture into the realm of importing bmps and jpegs but the errors I keep getting are starting to annoy me.
I've seen and read Dan's tutorial thoroughly but I keep gettings this error; "Illegal picture ID number '0'. (Probable cause:picture was not successfully created.)."
Here's the code:
Turing:
var zerointro:int:=Pic.FileNew ("G:/pictures/zerointro.bmp")
Pic.Draw(zerointro,0,0,picCopy)

EDIT:I did set it into graphics mode.
I know that the directory is correct, and that the file should fit the screen, but this is what I get. The error is on the Pic.Draw line.
There was also an incident earlier wherein I was able to make it work by renaming the picture 'zero.bmp' but reverting the name to 'zerointro.bmp' made it fail.

Author:  Tony [ Fri Oct 19, 2007 11:38 am ]
Post subject:  RE:Pic.Draw is Making Me Angry

Turing's interpretation of paths is kind of silly

That should be G:\pictures\zerointro.bmp
or
G://pictures//zerointro.bmp

Author:  Mazer [ Fri Oct 19, 2007 1:03 pm ]
Post subject:  Re: RE:Pic.Draw is Making Me Angry

Tony @ Fri Oct 19, 2007 11:38 am wrote:
That should be G:\pictures\zerointro.bmp
or
G://pictures//zerointro.bmp


You've got that kind of backwards.
G:\\pictures\\zerointro.bmp (because '\' is the escape character -- you need it to escape the backslash that Windows likes to use in pathnames)
or
G:/pictures/zerointro.bmp (I'll never figure out why the fuck people insist on the former, Windows actually does let you use a forward slash)

Zampano, the filename thing seems really weird. Any chance you can show some sample code and the image in question?

Author:  Clayton [ Fri Oct 19, 2007 3:02 pm ]
Post subject:  RE:Pic.Draw is Making Me Angry

My bet is that when you renamed the image, it became "zerointro.bmp.bmp". Double check that one.

Author:  Zampano [ Fri Oct 19, 2007 3:41 pm ]
Post subject:  Re: Pic.Draw is Making Me Angry

I tried all the different variations of slashes shown above, to the same measure of success I have had so far. My teacher (I tried to do this at school, you see) told me that the code itself was fine, but that Turing was very limited to calling upon outside images . . . And that that might be the problem plaguing the program.
You can view the picture I was trying to put into the program by looking to your left until your eyes meet the edge of your computer screen.
It is quite possible that I gave the bmp a double-extension, which doesn't explain why the same program (with the photo location modified) does not work at home. The only difference is now I'm using Object-Oriented Turing. Nonetheless I'll check on that file on Monday.

Author:  Euphoracle [ Fri Oct 19, 2007 4:21 pm ]
Post subject:  RE:Pic.Draw is Making Me Angry

There's nothing wrong with Turing's graphics. I managed to write an animated sprite engine and if that can be done (using GIFs too) then I'm pretty sure it can get a bitmap on the screen. Try moving the picture into the directory with the .t file and just using Pic.FileNew("zerointro.bmp")

Author:  Latagore [ Mon Oct 22, 2007 5:19 pm ]
Post subject:  Re: Pic.Draw is Making Me Angry

I'm also having the same problem, except that I'm rotating. Try putting it in the same directory, or if your program is in G:/, type Pic.FileNew ("./Pictures/Whatever.bmp")

Have you created an image before this? I can only seem to have one picture as it probably assigns all of your pictures the same ID or something. O.o

Author:  Nick [ Mon Oct 22, 2007 5:37 pm ]
Post subject:  RE:Pic.Draw is Making Me Angry

ok heres something to try: make use of the %

if ur not sure where the file will be but you know what the folder's name is then use this example

Turing:
Pic.Draw("%foldername/pics/background pics/pic3.bmp")


the % will search the computer for the requested directory thus finding your picture wherever it may be!

Author:  Mazer [ Mon Oct 22, 2007 5:47 pm ]
Post subject:  RE:Pic.Draw is Making Me Angry

So what happens if there are multiple directories with the same name? Can you show me where you learned about that?

Author:  djordje [ Mon Oct 22, 2007 5:59 pm ]
Post subject:  Re: Pic.Draw is Making Me Angry

Ive had a problem like this before, sometimes when saving the file the file can get corrupted, use a picture editing software like paint or photoshop(i recommend photoshop, never failed me) and re save the file as a new name or different extension, then update in your program and run.

Author:  Latagore [ Mon Oct 22, 2007 5:59 pm ]
Post subject:  Re: Pic.Draw is Making Me Angry

I realised how stupid I was. Make sure you type Error.LastMsg or something and it will tell you what happened. I found out that I misspelled my directory and my file name. Make sure you check both.

And %... It will probably give you the first available.

Author:  Nick [ Mon Oct 22, 2007 6:09 pm ]
Post subject:  RE:Pic.Draw is Making Me Angry

MAZER im sorry i cant remember where i learned it however i think it was the turing documentation (aka turing help) i was just looking for the topic i saw it in but failed... sorry but im not 100% sure on this as it was a while ago i learned but im about 90% sure

Author:  Mazer [ Mon Oct 22, 2007 6:41 pm ]
Post subject:  RE:Pic.Draw is Making Me Angry

Maybe you should try it out.

Author:  Zampano [ Tue Oct 23, 2007 7:49 am ]
Post subject:  Re: Pic.Draw is Making Me Angry

Well somehow it started working again. I don't know how, but it must have had something to do with having the file in the same directory. I will adopt a 'don't knock it' attitude to this problem, as it was porbably caused by some error produced by me in the names of the directories.
Otherwise, I think I'm going to start using sprites instead of Pic.Draw except for general pictures like this one. Thank you for your aid.


: