Good time of day,
So I needed to use the
TBitMap class to create/edit a picture (it is supposed to be passed to
tAgg2d.Attach). I used roughly the following code:
uses Graphics;
var
img: tbitmap;
a: tAgg2d;
begin
a:= tAgg2d.Create;
img:= tbitmap.Create;
//img.LoadFromFile('pic.bmp'); {if you call this, everything works fine}
img.SetSize(500,500); {SIGSEGV in RawImage_QueryDescription}
img.BeginUpdate;
Agg2D.Attach(img);
//draw stuff with agg2d
img.EndUpdate;
img.SaveToFile('pic2.bmp');
end.
But it when I call
Setsize, which calls several more functions, I get a SIGSEGV in iclude/lclintf.inc at line 177 which is:
Result := WidgetSet.RawImage_QueryDescription(AFlags, ADesc);
The
WidgetSet variable appears to be nil, which is understandable, since I don't use LCL for anything else. What is interesting is that if I call
img.LoadFromFile before
img.SetSize everything works fine: no SIGSEGV, stuff gets drawn.
So my question is: can I avoid this SIGSEGV without calling
LoadFromFile? I don't want to have to include the whole LCL into my project either.
For the record, I tried to recreate this situation in a separate project, but failed due to 'graphics.pp(20,2) Fatal: Cannot open include file "lcl_defines.inc" ' even though Lazarus opens it fine and it compiles without problems in my main project.
My apologies for this potentially being a really dumb/involved question.