TRVStyle.GetAsPixelsEx(MaxImageSize, rvstuPixels) simple returned MaxImageSize (this is a "conversion" from pixels to pixels).
So you can simply write:
Code: Select all
function IsImageTooLarge(gr: TGraphic): Boolean;
begin
Result := (MaxImageSize>0) and
((gr.Width > MaxImageSize) or
(gr.Height> MaxImageSize));
end;
In the original code (TrvActionInsertPicture.IsImageTooLarge from RichViewActions), GetAsPixelsEx made sense because MaxImageSize is measured not necessary in pixels; it is measured in RVAControlPanel.UnitsProgram (pixels or twips).
Please note that in the new version of TRichView, gr.Width, gr.Height, and rvActionInsertPicture.MaxImageSize are measured in logical pixels, i.e. pixels at 96 DPI. When displaying, image will be scaled proportionally to the screen DPI.