...
BTW also note this recent thread (there were many others in the past) that has some similarities wrt differences between platforms.
Thanks for that link. I checked this article 'Broken example "Creating and drawing a transparent bitmap for a TImage" in Linux' but did not find something which dealt with image- or screenshot-sizes. Do you mean a certain reply number?
a) because you changed the logic, RD is the screen dimension including taskbar where you set the bitmap size wrong since later you use boundsrect -> the desktop without taskbar.
Thanks for your help. As far as I can see I did not change the logic. 'boundsrect' contains 1280x1024 which is my desktop including taskbar which are the same values as in Result.SetSize().
b) idk, i suggest that you use my last posted code without modify beside to log both, the screen dimension and the boundsrect of screen.
I tested your unmodified code and got the same problem: the screenshots show not the complete monitor, both on the right side and the bottom side a part is missing (both on Linux and Windows). I assume, the 2x 2000 in 'Result.Canvas.ClipRect' are the reason for this.
Meanwhile I tested my code from reply #15 on 4 more Windows computers (3x Win10, 1x Win7) with 4 different screen resulutions and always line 28 returned 'X1=0 Y1=0 X2=2000 Y2=2000', where the 2x 2000 obviously are wrong. That means, in sum I have 5x Windows and 1x Linux computers with this wrong values.
In the sources I found in line 55 in <installdir>/lazarus/lcl/include/canvas.inc:
function TCanvas.GetClipRect: TRect;
begin
// return actual clipping rectangle
if GetClipBox(FHandle, @Result) = ERROR then
Result := Rect(0, 0, 2000, 2000);{Just in Case}
end;
which seems to be the reason for that.
Questions: has somebody an idea,
- why returns GetClipBox() this ERROR?
- can it be, that some initialization of the 'TBitmap' (or its Canvas) in my code is wrong or incomplete?
I attached a compilable project with the code from reply #15, if somebody wants to run own tests. Thanks in advance.