优化后的灰界查看器+aoi

function WidthOfRect(r: TRect): Integer; begin Result := Abs(r.Right - r.Left); end; function HeightOfRect(r: TRect): Integer; begin Result := Abs(r.Bottom - r.Top); end; procedure GetColorFromRGB(var color: TColor; r, g, b: Integer); begin color := ((b shl 16) and $00FF0000) + ((g shl 8) and $0000FF00) + (r and $000FF); end; procedure DrawGrayLevelMap(c: TCanvas; r: TRect; const count: Integer = 16); var i, w, h, cl_d, n: Integer; cl: TColor; begin w := WidthOfRect(r); h := HeightOfRect(r); cl_d := 256 div count; with c do begin Brush.Style := bsSolid; Brush.Color := clWhite; Pen.Color := clWhite; FillRect(r); for i := 0 to count - 2 do begin n := i * cl_d; GetColorFromRGB(cl, n); Brush.Color := cl; Pen.Color := cl; FillRect(i * w div count + r.Left, r.Top, (i + 1) * w div count + r.Left, r.Top + h)); end;

rar 文件大小:182.78KB