So, you want to have everything darkened except for a specific rectangular area, is that correct?
I'd just fetch the pixel pointer of the top left pixel and then iterate over all the pixels, checking if they are in the rectangle and darken them where applicable.
The following was supposed to be pseudo code but turned out to be actual code... it's untested as I just wrote it here in the browser, so it most likely won't compile without a few adjustments.
Delphi-Quellcode:
procedure HighlightCropRect(Bmp32: TBitmap32; CropRect: TRect);
var
Ptr: PColor32;
LastPtr: PColor32;
X,Y: Integer;
begin
// Get pointers of first and last pixel
Ptr := Bmp32.PixelPtr[0,0];
LastPtr := Bmp32.PixelPtr[Bmp32.Width-1, Bmp32.Height-1];
// Init Pixel coordinates
X := 0;
Y := 0;
// Iterate over all pixels
// (We need to do a typecast here because we can't compare pointers in Delphi)
while Integer(Ptr) < Integer(LastPtr) do
begin
// Check if pixel is outside of crop rect
if (X < CropRect.Left) or (X > CropRect.Right) or
(Y < CropRect.Top) or (Y > CropRect.Bottom) then
begin
// Darken pixel by 50%
Ptr^ := Lighten(Ptr^, -127);
end;
// Move to next pixel
inc(Ptr);
inc(X);
// Reached end of scanline?
if X >= Bmp32.Width then
begin
X := 0;
inc(Y);
end;
end;
end;