Skip to content

Commit 581430b

Browse files
committed
faster palette display
1 parent d8b8486 commit 581430b

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

Main.pas

+16-2
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@
161161
{ PNG is now handled by PngImage instead of PngUnit }
162162

163163

164-
165164
interface
166165

167166
uses
@@ -1380,6 +1379,7 @@ procedure TMainForm.PalettePaint(Sender: TObject);
13801379
Wd, Ht: Integer;
13811380
i, j, l, m, n, p: Integer;
13821381
OldShowCurPal: Boolean;
1382+
Bmp: TBitmap;
13831383

13841384
function GetColorCircle (i, j: Integer): Integer;
13851385
var
@@ -1558,9 +1558,23 @@ procedure TMainForm.PalettePaint(Sender: TObject);
15581558
end
15591559
else
15601560
begin // smooth palette
1561+
1562+
//for j := 0 to Ht - 1 do
1563+
// for i := 0 to Wd - 1 do
1564+
// Pixels[i, j] := GetColorCircle (i, j); // very slow for some reason
1565+
1566+
Bmp := TBitmap.Create();
1567+
Bmp.Width := Wd;
1568+
Bmp.Height := Ht;
1569+
15611570
for j := 0 to Ht - 1 do
15621571
for i := 0 to Wd - 1 do
1563-
Pixels[i, j] := GetColorCircle (i, j);
1572+
Bmp.Canvas.Pixels[i, j] := GetColorCircle (i, j);
1573+
1574+
Draw(0, 0, Bmp);
1575+
1576+
Bmp.FreeImage();
1577+
15641578
end;
15651579
end;
15661580

rgbconv.txt

+4
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ R=255-R
88
G=255-G
99
B=255-B
1010

11+
[Swap Blue and Green]
12+
G=B
13+
B=G
14+

0 commit comments

Comments
 (0)