Page 1 of 1

PicShow and huge images

PostPosted: December 20th, 2007, 5:21 pm
by mhieta
Hi,

1. I will use this for putting images in to PicShow:

Code: Select all
procedure CopyGraphicToBitmap(Graphic: TGraphic; Bitmap: TBitmap;
  MaxWidth, MaxHeight: Integer; ShrinkOnly: Boolean);
var
  Width, Height: Integer;
begin
  Width := Graphic.Width;
  Height := Graphic.Height;
  if not ShrinkOnly or (Width > MaxWidth) or (Height > MaxHeight) then
  begin
    if (MaxWidth / Width) < (MaxHeight / Height) then
    begin
      Height := MulDiv(Height, MaxWidth, Width);
      Width := MaxWidth;
    end
    else
    begin
      Width := MulDiv(Width, MaxHeight, Height);
      Height := MaxHeight;
    end;
  end;
  Bitmap.Width := Width;
  Bitmap.Height := Height;
  with Bitmap.Canvas do StretchDraw(ClipRect, Graphic);
end;


But there is one issue. When image is loaded with this and window is small:
Code: Select all
          CopyGraphicToBitmap(P.Graphic, PicShow.Picture.Bitmap,
            PicShow.Width, PicShow.Height, True);

Problem is when user maximizes the window then user gets that small image what is resized with this CopyGraphic...
If I change that to this:
Code: Select all
          CopyGraphicToBitmap(P.Graphic, PicShow.Picture.Bitmap,
            Screen.Width, Screen.Height, True);

Same problem occurs if user has multiple monitors and resolutions are different.

2. Without that CopyGraphicToBitmap PicShow cannot handly huge images ex. 3800 x 2500. This size is problem ex. in Win98, XP can handle bigger images, but still problem is there.

So is there any way to load and display huge images so that they are fitted to screen?

- Marko

PostPosted: December 20th, 2007, 8:45 pm
by Kambiz
Suggestion: Resize the image to screen size of the monitor with the largest screen size.

PostPosted: December 21st, 2007, 6:44 pm
by mhieta
Yes that might be solution for this problem at least for now.
Cause display resolutions are still small.
Except if the user has ex. this:
http://www.eizo.com/products/lcd/SX3031W/index.asp
2560 × 1600 native resolution
Then its a problem for older OS ex. Win98. Sooner or later I have to drop supporting those older OS.

Anyway thanks and Merry Christmas.

- Marko