Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Misc > Lazarus BitMap....
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 734 of 792
Post > Topic >>

Lazarus BitMap.LoadFromFile

by jfj <jf.jouvet@[EMAIL PROTECTED] > Apr 5, 2007 at 06:08 PM

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




 1 Posts in Topic:
Lazarus BitMap.LoadFromFile
jfj <jf.jouvet@[EMAIL   2007-04-05 18:08:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 22:34:53 CDT 2008.