bgrabitmap icon indicating copy to clipboard operation
bgrabitmap copied to clipboard

Assign a Bitmap after a Large Resample

Open maxm74 opened this issue 5 months ago • 2 comments

If, after a larger resample, you assign the new resized image to an existing Bitmap, only part of the content is copied (exactly the old unscaled bitmap size).

Open the test and load wia_take.bmp attached image using the ... button next to 'Picture to Open'. Click 'Resize 200%'. The test creates two new bitmap files, 'resized.bmp' and 'resized_assigned.bmp'. If you open resized_assigned.bmp, you'll see the problem.

After a debugging session, I realized the problem lies in TCustomUniversalBitmap.CopyPropertiesTo (unibitmap.inc Line 2644), which is the ClipRect copy.

Basically, Assign only copies the contents of ClipRect when it does PutImage. In my opinion, CopyPropertiesTo should be done after PutImage.

bgraBitTest.zip

mypatch.patch

maxm74 avatar Jul 29 '25 10:07 maxm74

After further testing, the ClipRect copy in TCustomUniversalBitmap.CopyPropertiesTo (unibitmap.inc Line 2644) should also be deleted.

maxm74 avatar Jul 29 '25 11:07 maxm74

Pull Request #310 solve this bug

maxm74 avatar Nov 20 '25 11:11 maxm74