Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
bload -- is it working?
#1
alright i'm quite tired of all this, though i'm sure it's just me overlooking something.
Code:
function LoadImageData (filename$, ImageArray() as byte)

      ff = FREEFILE
      OPEN filename$ FOR BINARY AS #ff
         Byts& = (LOF(ff))
         get #ff,,numImages
      CLOSE #ff
      
      REDIM ImageArray(1 TO Byts&)
      bload filename$, VarPtr(ImageArray(1))
      
      print filename$
      print " imgs: "; numImages; " byts: "; Byts&
      print ImageArray(1), ImageArray(2), ImageArray(3)
   return numImages
end function

now the trouble is ImageArray is completely empty from index 1 onward. the filename i provide is correct, and numImages shows the correct number. ImageArray(1) should be the same as numImages, a header. ImageArray(2) should have the width of the image. but it's all zeros! blimey!

(this is the latest fbc.)

i have also tried changing the datatype from byte to ubyte to integer and adjusting my code. is it just way too late at night or what exactly is wrong with bload?

i should mention the way the data was outputted, in case bload chokes on multiple datatypes or something? the number of images header is a two-byte integer, followed by two more integers for image width *8, image height. then proceeds byte after byte of image data. two-byte integers should still bload as seperate bytes into the array... they used to in QB, anyway.
Reply
#2
What type of file are you trying to load?
.14159265358979323846264338327950288419716939937510582709445
Glarplesnarkleflibbertygibbertygarbethparkentalelelangathaffendoinkadonkeydingdonkaspamahedron.
Reply
#3
it is an image format i created by a sprite-editing program i designed. very similar to .PUT format (PP256 editor images) except the 7-byte header is 2 bytes-- number of images in file. the subsequent 4-byte headers are identical to PUT-- width*8 and height. then follows the byte-by-byte image body. i would like to bload it into an array.

apparently bload only takes certain filetypes. it's probably looking for either a bsv or bmp header which i obviously don't provide. i'm going to try GET instead. edit-- yuppa, it works fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)