|
Post by luis on Apr 10, 2006 17:57:54 GMT
hi how can i display image files in q basic?
|
|
|
Post by Mikrondel on Apr 11, 2006 7:21:27 GMT
It's not exceedingly hard, let's look at your situation and and then at your options. A) You have a file already in a popular format such as BMP, GIF or JPEG. You can: -1 Decode the file yourself. BMPs are a very large amount easier than JPEGs, say. -2 Use someone else's QB decoder. These are not exceedingly hard to come by, although some file types will be harder to decode than others and consequently there will be less decoders. -3 Covert the file to an easier format using another program. B) Your file is in a QB-friendly (e.g. GET+BSAVE), or very easy to understand, format. -1 Ask us for the details of how to read it. Notes: -If your image files are not in a QB-friendly format, turn them into one, e.g. with a separate QB program. (Unless you want to make, say, a BMP "paint" program or some kind of image viewer. If you're using the graphics in a game or a title screen then just use a QB-friendly format) -Pixel graphics in QB are most easily done using PSET (the pixel-set command). The highest resolution (640x480 , 16 colours) is SCREEN 12, and the highest colour depth (256 colours) is SCREEN 13. You PSET (X, Y), Pixelcolour and obviously if you're reading from an image file you'll get each pixel's colour from that. -Arrays can be saved as a file with the BSAVE command and then loaded again with the BLOAD command. You can either save an array containing the actual colour values, or you can save an array containing something that was GET from the screen. (GET will use up less memory). To put something previously GETed to the screen, you use PUT. So loading a GET+BSAVEd image is easy; just BLOAD a file into an array and then PUT the image from the array wherever you need it. -If you're feeling confident you can look up image file specifications on www.wotsit.orgIf you think that going through the creation of, say, a BMP loader would help you learn about programming, then I can help lead you through one if you wish (e.g. on MSN Messenger or by email.) If you want any more help please do not hesitate to ask.
|
|