Menu

Using ilLoadL from Delphi

Help
Ilan Simon
2009-07-04
2013-05-02
  • Ilan Simon

    Ilan Simon - 2009-07-04

    Hi,
    I'm trying to manipulate an image that I receive to a function as TStream.
    I want to load it from memory and avoid writing to files.

    // input variable declared as:
    inImage: TStream;

    // "lump" variable declared as:
      imgLump: Array of TILubyte;

    // in the function I do as follows:
      // setting input image into a "lump"
      SetLength(imgLump, inImage.Size);
      // rewind stream to beginning
      inImage.Seek(0, soBeginning);
      // read stream and write into array
      inImage.Read(imgLump[0], inImage.Size);
      loaded := ilLoadL(IL_JPG, imgLump, Length(imgLump));

    // ------------------------
    at this stage, loaded gets the value 0 (IL_FALSE) and the call to ilGetError() returns 1298 (IL_FILE_READ_ERROR).

    why?! what did I miss?

    Thanks,
    Ilan

     
    • Denton Woods

      Denton Woods - 2009-07-10

      Have you called ilInit?

       
    • Ilan Simon

      Ilan Simon - 2009-07-23

      Obviously. It's the first thing being done at the top of the function.
      If I use ilLoadImage instead, it works. I still wish to use a stream as the data source.
      Assume the data copied into the array is a valid image data.

      Any other ideas? can somebody use the latest version and verify this as a bug?

      Thanks

       

Log in to post a comment.