LazarusBrasil
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Erro "Projeto teste elevou classe exceção 'External: SIGSEGV"

Ir para baixo

Erro "Projeto teste elevou classe exceção 'External: SIGSEGV" Empty Erro "Projeto teste elevou classe exceção 'External: SIGSEGV"

Mensagem  Andre Lexa Ter Jul 23, 2013 1:05 pm

Olá, eu sou novo aqui e também como usuário Lazarus e estou tendo um grande problema, toda vez que eu chamo uma procedure que tenta desenhar um grid numa TImagem retorna uma mensagem de erro: "Projeto teste elevou classe exceção 'External: SIGSEGV'. No endereço 40A6AC".
O código da procedure é o seguinte:

procedure DrawAStarGrid(var Map: TAStarMap; Img: TImage);
var i,x,y: integer;
pnt: TGridCoord;
P : pTRGB32;
data, zerodata, whiteData: TRGB32;
colorfuz:integer;
TempBitmap: TImage;
TempIntf: TLazIntfImage;
ImgHandle,ImgMaskHandle: HBitmap;

begin
zeromemory(@zerodata, sizeof(zerodata));
whiteData.r:=0;
whiteData.g:=205;
whiteData.b:=0;

with map do begin
TempBitmap.Picture.Bitmap.Create;
TempBitmap.Picture.Bitmap.PixelFormat:=pf32bit;
TempBitmap.Picture.Bitmap:= Img.Picture.Bitmap;
TempIntf.Create(0,0);
TempIntf.LoadFromBitmap(TempBitmap.Picture.Bitmap.Handle,TempBitmap.Picture.Bitmap.MaskHandle);

for i:=0 to TempIntf.Height-1 do begin

P:= TempIntf.GetDataLineStart(i);

y:= i div 4;
if (i mod 4) = 0 then begin
zeromemory(P,4*TempIntf.Width);
end else begin
for x:=0 to (TempIntf.Width div 4)-1 do begin
p^:=zerodata;
inc(p);

if (Gridfuzzy[x,y]>1) and (GridState[x,y]<>AStarObstacle) then begin
data:=zerodata;
colorfuz:=220-round((Gridfuzzy[x,y]-1)*300);
data.g:=colorfuz;
data.r:=colorfuz;
data.b:=colorfuz;
end

else
case GridState[x,y] of
AStarVirgin: begin data:=whiteData;
end;

AStarClosed: begin
data:=zerodata;
data.r:=255;
end;

AStarOpen: begin
data:=zerodata;
data.g:=255;
data.r:=100;
data.b:=100;

end;

AStarObstacle: data:=zerodata;
end;

p^:=data;
inc(p);
p^:=data;
inc(p);
p^:=data;
inc(p);
end;
end;
end;

TempIntf.CreateBitmaps(ImgHandle,ImgMaskHandle,false);
TempBitmap.Picture.Bitmap.Handle:=ImgHandle;
TempBitmap.Picture.Bitmap.MaskHandle:=ImgMaskHandle;
Img.Picture.Bitmap.Assign(TempBitmap.Picture.Bitmap);
end;

Img.Canvas.Brush.Color:=clwhite;
x:=Map.InitialPoint.x * 4 + 1;
y:=Map.InitialPoint.y * 4 + 1;
Img.Canvas.FillRect(x, y, x+3, y+3);
for i:=trajaux.count - 1 downto 0 do begin
AStarWorldToGrid(trajaux.pts[i].x,trajaux.pts[i].y,pnt);
x:=pnt.x*4+1;
y:=pnt.y*4+1;
Img.Canvas.FillRect(x, y, x+3, y+3);
end;
Img.Canvas.Brush.Color:=clyellow;
x:=Map.InitialPoint.x * 4 + 1;
y:=Map.InitialPoint.y * 4 + 1;
Img.Canvas.FillRect(x, y, x+3, y+3);

Img.Canvas.Brush.Color:=clblue;
x:=Map.TargetPoint.x * 4 + 1;
y:=Map.TargetPoint.y * 4 + 1;
Img.Canvas.FillRect(x, y, x+3, y+3);


// TempBitmap.Free;
// TempIntf.Free;
// Img.refresh;
Img.Repaint;
end;


Tenho quase certeza que o problema está em "P:= TempIntf.GetDataLineStart(i);", mas não sei pelo que substitui, o que fazer (afinal tanto o lazarus quanto a linguagem, são novos pra mim)
Agradeceria se alguem pudesse me ajudar ...

Abraço

Andre Lexa

Mensagens : 1
Data de inscrição : 23/07/2013

Ir para o topo Ir para baixo

Ir para o topo

- Tópicos semelhantes

 
Permissões neste sub-fórum
Não podes responder a tópicos