When i try to draw raster images on canvas using TRVReportHelper, some images don`t appeare on target canvas, but the image bounds are saved. Current problem does not exists in TRVPrint. Also, if the images are in vector format there is no problem in TRVReportHelper.
I use TRichView 1.9.40.2. If it`s necessary i can send you RVF.
Help me, please.
Problem with drawing raster images using TRVReportHelper
-
- Posts: 46
- Joined: Fri Jul 21, 2006 9:16 am
- Contact:
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 46
- Joined: Fri Jul 21, 2006 9:16 am
- Contact:
It`s a metafile canvas.Sergey Tkachenko wrote:Is this a screen canvas?
Code: Select all
const
VERYLARGEVALUE = $FFFFFFF;
var
m : TmetaFile;
mc : TmetaFileCanvas;
S: TMemoryStream;
RVHeight : Integer;
begin
S:= TMemoryStream.Create;
try
rvEdit.SaveRVFToStream(S, False);
S.Position := 0;
RVReport.RichView.Clear();
RVReport.RichView.LoadRVFFromStream(S);
finally
S.Free;
end;
m := TMetafile.Create;
try
RVHeight := Trunc(rvEdit.ClientWidth * 0.724);
m.Width := rvEdit.ClientWidth;
m.Height := RVHeight;
mc := TMetafileCanvas.Create(m, 0);
try
RVReport.Init(mc, rvEdit.ClientWidth);
while RVReport.FormatNextPage(VERYLARGEVALUE) do
;
RVReport.DrawPage(1, mc, True, RVHeight);
finally
mc.Free;
end;
finally
m.Free;
end;
end;
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 46
- Joined: Fri Jul 21, 2006 9:16 am
- Contact:
It is the same with false-param.Sergey Tkachenko wrote:If Preview parameter of RVReport.DrawPage is True, graphic.StretchDraw is used for drawing images. Try to pass False instead. Images will be drawn differently, in a printer-compatible way.
Try to use my code. Make RVF wich contains several raster images.
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 46
- Joined: Fri Jul 21, 2006 9:16 am
- Contact:
It`s my mistake.Sergey Tkachenko wrote:It always worked before. Please send me your RVF file
After drawing on metafile canvas using TRVReportHelper, I try to scale this metafile to other metafile with lower aspect-ratio.
This operation breaks some raster images, but text has correct output.
Sorry for offtopic, may be you know the solve of this problem?
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
I am not sure that you mean by "scale this metafile to other metafile with lower aspect-ratio".
If you play metafile to canvas of different device (for example, playing metafile on printer canvas), many commands for drawing raster images may fail. But if Preview=False in RVReportHelper.DrawPage, images must be drawn in a safe way...
If you play metafile to canvas of different device (for example, playing metafile on printer canvas), many commands for drawing raster images may fail. But if Preview=False in RVReportHelper.DrawPage, images must be drawn in a safe way...