trichview.com

trichview.support




Re: How to display Richview as thumbnails?


Return to index


Author

Message

Sergey Tkachenko

Posted: 02/26/2002 11:35:25


> hi..

>

> i'm new with TRichview... and my question is, can Richview display as a

thumbnails..

> if can, how i'm going to do that?


The examples how to draw RichView onto the specified canvas are here:

http://www.trichview.com/support/files/toimage.zip


If you want to make scaled thumbnails, you have the following possibilities:

1) To draw an image in the larger bitmap, then StretchDraw to the smaller

one. Quality will be quite low because of low quality of stretch drawing.

2) In the latest registered version, TRVReportHelper can draw smaller image

with DrawPreview method. In the public version, you can play with

SetWindowExtEx("original size") and SetViewportExtEx("thumbnail size").

Quality will not be very high because of another problem - it's usually

impossible to scale fonts exactly by the given ratio.

3) The best results can be achieved by rendering image in original scale,

and then scaling bitmap using advanced algorithms.

For example (although it would be an overkill) you can use free Graphics32

(www.g32.org):


In the demo project mentioned above, create an additional page, place

Button3 and Image3 there.

In Button3's OnClick write:


uses Gr32;


..


const scale = 0.5;

var bmp32, resbmp32: TBitmap32;

    Canvas: TCanvas;

begin


  RVReportHelper1.Init(Self.Canvas, 200 {width});

  while RVReportHelper1.FormatNextPage(VERYLARGEVALUE) do;


  bmp32 := TBitmap32.Create;

  bmp32.SetSize(200,RVReportHelper1.EndAt);


  Canvas := TCanvas.Create;

  Canvas.Handle := bmp32.Handle;

  RVReportHelper1.DrawPage(1,Canvas,True,RVReportHelper1.EndAt);

  Canvas.Free;


  resbmp32 := TBitmap32.Create;

  resbmp32.SetSize(Round(200*scale), Round(RVReportHelper1.EndAt*scale));

  bmp32.StretchFilter := sfLinear2; // you can try other filters

  resbmp32.Draw(Rect(0,0,resbmp32.Width, resbmp32.Height),

Rect(0,0,bmp32.Width, bmp32.Height), bmp32);

  bmp32.Free;

  Image3.Picture.Bitmap.Assign(resbmp32);


  resbmp32.Free;


This code will create a highquality thumbnail with antialiasing.


Searching www.torry.net for "antialiasing", you can (pribably) find a

simpler code for

highquality stretch drawing, without so large overheads as with using

Graphics32.


With RVReportHelper, you can create a set thumbnals of the given size (a

thumbnal for each page)














Powered by ABC Amber Outlook Express Converter