Skip to content

Commit

Permalink
TSimbaImage.SetPixel should set alpha to 255
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Mar 16, 2024
1 parent f7a560c commit c1e06f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 2 additions & 7 deletions Source/codetools/simba.ide_codetools_insight.pas
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ procedure TCodeinsight.Run;
I: Integer;
begin
FScriptParser.Run();
WriteLn(FScriptParser.DebugTree());

for I := 0 to FScriptParser.Locals.Count - 1 do
if (FScriptParser.Locals[I] is TDeclaration_WithVariable) then
FScriptParser.Locals.Extend(GetMembersOfType(ParseExpression(FScriptParser.Locals[I].Text, [EParseExpressionFlag.WantMethodResult])));
Expand Down Expand Up @@ -303,11 +303,7 @@ function TCodeinsight.GetMembersOfType(Decl: TDeclaration): TDeclarationArray;

function CheckEnum(Decl: TDeclaration): TDeclarationArray;
begin
if (Decl is TDeclaration_TypeSet) then
begin
//TDeclaration_TypeSet(Decl).Dump;
Result := Decl.Items.GetByClass(TDeclaration_EnumElement, False, True)
end
if (Decl is TDeclaration_TypeSet) then Result := Decl.Items.GetByClass(TDeclaration_EnumElement, False, True)
else
if (Decl is TDeclaration_TypeEnum) then
Result := Decl.Items.GetByClass(TDeclaration_EnumElement)
Expand Down Expand Up @@ -358,7 +354,6 @@ function TCodeinsight.GetMembersOfType(Decl: TDeclaration): TDeclarationArray;

for Depth := 1 to MAX_DEPTH do
begin
Writeln(Decl.ClassName);
Result := Result + CheckEnum(Decl);
Result := Result + CheckRecord(Decl);
Result := Result + CheckMethods(Decl, Depth > 1);
Expand Down
8 changes: 7 additions & 1 deletion Source/image/simba.image.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2842,7 +2842,13 @@ procedure TSimbaImage.SetPixel(X, Y: Integer; Color: TColor);
if (X < 0) or (Y < 0) or (X >= FWidth) or (Y >= FHeight) then
RaiseOutOfImageException(X, Y);

FData[Y * FWidth + X] := Color.ToBGRA();
with FData[Y * FWidth + X] do
begin
B := Color shr B_BIT and $FF;
G := Color shr G_BIT and $FF;
R := Color shr R_BIT and $FF;
A := ALPHA_OPAQUE;
end;
end;

function TSimbaImage.InImage(const X, Y: Integer): Boolean;
Expand Down

0 comments on commit c1e06f5

Please sign in to comment.