Problem is on your end..
Does not work (must be ran multiple times first.. before it works..):
Procedure Show(Bmp: Integer);
var
W, H: Integer;
Begin
ClearDebugImg;
GetBitmapSize(Bmp, W, H);
DrawBitmapDebugImg(Bmp);
DisplayDebugImgWindow(W, H);
End;
var
Bmp, GreyBmp: Integer;
begin
Bmp := BitmapFromString(100, 100, 'meJzt1sEJg0AQBdByth+ryc0q' +
'cksH6SGQJrymgBQxETao7BqIh4hL3vBO47LCZ0ZMfSQAAAAAAAAAA' +
'AAAAIC/1/URz3hEpPO7cznHWLeYny6r6KdreVXRLB7lWr6uITtklS' +
'+sq4704L7Jqh6D77Oampfn3IxhfkVDfp3V8rbJqW9yE+stW921qbr' +
'7tqxu13KoPp08PlltzWrnHczNRnfwd1nlT9NYp6E8Vgzb8W39Z8gn' +
'6/4YxWpzvORxX9nx5oZqn6xS9YvV3EQBAAAAAAAAAAAAAAAAAA15A' +
'UG7Uxs=');
GreyBmp := GreyScaleBitmap(Bmp);
FreeBitmap(Bmp);
Show(GreyBmp);
FreeBitmap(GreyBmp);
end.
Works (Everytime..):
Procedure Show(Bmp: Integer);
var
W, H: Integer;
Begin
ClearDebugImg;
GetBitmapSize(Bmp, W, H);
DisplayDebugImgWindow(W, H);
DrawBitmapDebugImg(Bmp);
End;
var
Bmp, GreyBmp: Integer;
begin
Bmp := BitmapFromString(100, 100, 'meJzt1sEJg0AQBdByth+ryc0q' +
'cksH6SGQJrymgBQxETao7BqIh4hL3vBO47LCZ0ZMfSQAAAAAAAAAA' +
'AAAAIC/1/URz3hEpPO7cznHWLeYny6r6KdreVXRLB7lWr6uITtklS' +
'+sq4704L7Jqh6D77Oampfn3IxhfkVDfp3V8rbJqW9yE+stW921qbr' +
'7tqxu13KoPp08PlltzWrnHczNRnfwd1nlT9NYp6E8Vgzb8W39Z8gn' +
'6/4YxWpzvORxX9nx5oZqn6xS9YvV3EQBAAAAAAAAAAAAAAAAAA15A' +
'UG7Uxs=');
GreyBmp := GreyScaleBitmap(Bmp);
FreeBitmap(Bmp);
Show(GreyBmp);
FreeBitmap(GreyBmp);
end.
WHY? Well.. it's simple. The first example draws BEFORE the window is displayed.. The second example draws AFTER the window is displayed.
In WinAPI, WM_PAINT is NOT processed until the window is on the screen at least once. After that, all subsequent messages are processed..
Simba's Debug Window uses WinAPI under the hood for Windows and X-Windows for Linux. These rules apply to both.
If it's happening for processing as well and not DRAWING, then there's an internal state delay going on somewhere..
I tested processing (and drawing).. both work fine:
Procedure Show(Bmp: Integer);
var
W, H: Integer;
Begin
ClearDebugImg;
GetBitmapSize(Bmp, W, H);
DisplayDebugImgWindow(W, H);
DrawBitmapDebugImg(Bmp);
End;
var
I, J: Integer;
Bmp, GreyBmp: Integer;
begin
Bmp := BitmapFromString(100, 100, 'meJzt1sEJg0AQBdByth+ryc0q' +
'cksH6SGQJrymgBQxETao7BqIh4hL3vBO47LCZ0ZMfSQAAAAAAAAAA' +
'AAAAIC/1/URz3hEpPO7cznHWLeYny6r6KdreVXRLB7lWr6uITtklS' +
'+sq4704L7Jqh6D77Oampfn3IxhfkVDfp3V8rbJqW9yE+stW921qbr' +
'7tqxu13KoPp08PlltzWrnHczNRnfwd1nlT9NYp6E8Vgzb8W39Z8gn' +
'6/4YxWpzvORxX9nx5oZqn6xS9YvV3EQBAAAAAAAAAAAAAAAAAA15A' +
'UG7Uxs=');
GreyBmp := GreyScaleBitmap(Bmp);
FreeBitmap(Bmp);
For I := 0 To 99 do
For J := 0 To 99 do
begin
if (FastGetPixel(GreyBmp, J, I) <> 10263708) then //that's the grey colour.. I'll just print the white text..
writeln(FastGetPixel(GreyBmp, J, I));
end;
Show(GreyBmp);
FreeBitmap(GreyBmp);
end.
So.. I guess you made the mistake in the first example? Or is there a specific case where this isn't working for you?
If you prefer speed over convenience, write your own greyscale that modifies the given bitmap rather than copying and then greying like Simba's internal GreyScaleBitmap function. You'll have to do testing though because the internal one is a native function and the lape one could possibly be slower if you write it yourself within a script and not a plugin..
I'd say it'll probably be faster though.