Hello,
1°
Translating a program from Delphi7, i got an error with a
tBitmap.LoadFromFile
System give me back fellowing error:
Project raise exception 'External SIGSEGV'
Here is my Lazarus defective code:
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes
{ add your units here }
, SysUtils
, Graphics
;
var bm: tBitMap;
FileName: String;
begin
bm := TBitMap.Create;
FileName := 'c:\temp\test.bmp';
if FileExists(FileName) then
begin
WriteLn('Before LoadFromFile'); ReadLn;
bm.LoadFromFile(FileName);
WriteLn('After LoadFromFile'); ReadLn;
end
else
WriteLn('File not found'); ReadLn;
end.
In Console output I get 'Before LoadFromFile' but never 'After
LoadFromFile'
2°
I precise that I don t want to have a graphical output of BitMap, but
just read pixel data, so after how can I access to pixels
In Delphi I use Ptr to access to pixel with:
var Ptr: Pointer;
function GetImagePointer(ABitmap: TBitMap): Pointer;
var
Info: Windows.TBitMap;
begin // converts bitmaps to pointers ect.
Result := nil;
if Assigned(ABitmap) then
begin
GetObject(ABitmap.Handle, SizeOf(Info), @[EMAIL PROTECTED]
);
Result := Info.bmBits;
end;
end;
Ptr := GetImagePointer(Bitmap);
Thanks in advance for any help


|