On Mon, 17 Sep 2007 18:17:43 +0200
Marc Weustink <[EMAIL PROTECTED]> wrote:
> Lord Satan wrote:
> > To me this looks like Marcs new image code is responsible for my troubles.
>
> As far as I can tell from the code you gave not. But the given code and
> probelmdescription is a bit limited.
This assumption was only based on revision number. What other information do
you need?
> > Btw I am using a TFPCustomImage descendant and the ImagesForLazarus package.
> > Here is the output of one of my programs trying to load an iamge:
> >
> >
> > and here is my code:
> >
> > class defintion:
>
> Nothing wrong here unless you forget to call some inherited method.
Hopefully not, but as stated it worked before. And 'hand created' images work
AFAICT without problems. Only the file loading code is broken.
> > loading code:
> >
> > function TAsmTexture2D.LoadFromFile(Filename: string): boolean;
> > var
> > FileStream: TFileStream;
> > MemStream: TMemoryStream;
> > ReaderClass: TFPCustomImageReaderClass;
> > Reader: TFPCustomImageReader;
> > begin
> > // open file
> > try
> > ReaderClass:=GetFPImageReaderForFileExtension(ExtractFileExt(Filename));
> > FileStream:=TFileStream.Create(Filename, fmOpenRead);
> > except
> > ShowMessage('Error opening file');
> > Result:=false;
> > end;
> > MemStream:=nil;
> > try
> > // read file into mem
> > MemStream:=TMemoryStream.Create;
> > MemStream.CopyFrom(FileStream,FileStream.Size);
> > // convert stream to texture
> > MemStream.Position:=0;
> > if ReaderClass<>nil then begin
> > Reader:=ReaderClass.Create;
> > try
> > LoadFromStream(MemStream, Reader); << This fails
>
> What error ? (*)
>
> > Result:=true;
> > except
> > Result:=false;
> > Free;
> > ShowMessage('Error reading file'); << because this I get in an
> > endless loop
>
> This wonders me, why do you get here an endless loop ? Where is the loop ?
If I only knew. I am just loading 6 or 7 pics (some bmp, and a png). Perhaps it
is not an endless loop but it at least spams the terminal with the above shown
output and throws exception message dialogs until I kill it.
> (*) thy using:
> except
> on E: exception do
> begin
> Result:=false;
> Free;
> ShowMessage('Error reading file: ' + E.Message);
> end;
The error is an 'invalid type cast'.
Belial
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives