[fpc-pascal] Re: AV: FCL-Image and XPM image

silvioprog silvioprog at gmail.com
Sat Jul 13 23:03:26 CEST 2013


2013/7/13 silvioprog <silvioprog at gmail.com>

> Hello,
>
> How do I load a XPM image using only FCL-Image?
>
> I'm trying it:
>
> program project1;
>
> {$mode objfpc}{$H+}
>
> uses
>   FPimage, FPReadXPM;
>
> var
>   r: TFPReaderXPM;
>   i: TFPMemoryImage;
> begin
>   r := TFPReaderXPM.Create;
>   i := TFPMemoryImage.Create(48, 48);
>   try
>     i.LoadFromFile('ide_icon48x48.xpm', r);
>   finally
>     r.Free;
>     i.Free;
>   end;
> end.
>
> But:
>
> C:\Users\Silvio\Desktop\xpm>project1.exe
> An unhandled exception occurred at $00412008:
> EAccessViolation: Access violation
>   $00412008
>   $00411D6F
>   $00410B81
>   $0040F9B1
>   $004015D5  main,  line 15 of project1.lpr
>
> In attached, I'm sending a small project and my XPM image to test it.
>
> Thank you!
>

IMG, it works now, I discovered:

i.UsePalette := True;

Thank you anyway! :)

-- 
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130713/66788e9d/attachment.html>


More information about the fpc-pascal mailing list