Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-07

AV: FCL-Image and XPM image

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

silvioprog

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!

Silvio Clécio My public projects - github.com/silvioprog

Reply by email

silvioprog
to silvioprog

2013/7/13 silvioprog

Show quoted text 42 lines
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

Reply by email

waldo kitty
to silvioprog
silvioprog wrote 20 lines
2013/7/13 silvioprog < > 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! :)

shouldn't that AV still be handled properly? in the library or??

NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted.

Reply by email

silvioprog
to waldo kitty

2013/7/13 waldo kitty

Show quoted text 31 lines
On 7/13/2013 17:03, silvioprog wrote: > 2013/7/13 silvioprog < > > > 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! :) > shouldn't that AV still be handled properly? in the library or?? -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted.

I saw it:

procedure TFPCustomImage.SetUsePalette(Value:boolean);
begin
  if Value  assigned(FPalette)
  then
    if Value
    then
      begin
        FPalette := TFPPalette.Create (0);
        // FPalette.Add (colTransparent);
      end
    else
      begin
        FPalette.Free;
        FPalette := nil;
      end;
end;
Silvio Clécio My public projects - github.com/silvioprog

Reply by email