DELPHI AREA
MESSAGE BOARD
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   FavoritesFavorites   Watched TopicsWatched Topics     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Splitting a Metafile

 
Post new topic   Reply to topic   printer-friendly view    DELPHI AREA Forum Index -> Delphi Programming
View previous topic :: View next topic  
Author Message
Feike
Member


Joined: 02 Aug 2006
Posts: 6
Location: Netherlands

PostPosted: 02/08/06 09:53    Post subject: Splitting a Metafile Reply with quote

Hello,

I need to split a metafile.
It has an a3 format and I want to split the file in two a4 metafiles so I can print it on two pages.(I use Printpreview) How can I do this?
I know how to do this with a bitmap, but not with a metafile.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Johnny_Bit
Moderator


Joined: 15 Jun 2003
Posts: 274

PostPosted: 02/08/06 15:07    Post subject: Reply with quote

it's scallable vector graphics, meaning that it would scale itself to proper width and height. but spit in in two pages? only some grahics programs came to my mind, eg corel or inkscape
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Feike
Member


Joined: 02 Aug 2006
Posts: 6
Location: Netherlands

PostPosted: 03/08/06 19:33    Post subject: Reply with quote

Quote:
but spit in in two pages? only some grahics programs came to my mind, eg corel or inkscape

So it can't be done in Delphi?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Johnny_Bit
Moderator


Joined: 15 Jun 2003
Posts: 274

PostPosted: 04/08/06 05:47    Post subject: Reply with quote

And you know how hard it's done? Sime way wouldbe draw metafile on bitmap then split bitmap, as I am no expert when it commes to metafiles i think that best wa to do it without bitmap wouldbe fixed-point scale and then place virtual ruller on middle, then cut objects along it. but how, I don't know
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1044
Location: Tehran, Iran

PostPosted: 04/08/06 12:39    Post subject: Reply with quote

There's no need to physically split the metafile.
  1. Devide the metafile to some logical sections. For example to print an A3 size metafile, you should consider two A4 size sections.
  2. For each section, offset origion of the destination canvas to top-left corner of the section.
  3. Stretch draw the metafile on the canvas, as you print on an A3 paper. However, your actual canvas size should be A4 size.
That's all.

_________________
Kambiz
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Feike
Member


Joined: 02 Aug 2006
Posts: 6
Location: Netherlands

PostPosted: 08/08/06 11:42    Post subject: Reply with quote

Quote:
There's no need to physically split the metafile.

1. Devide the metafile to some logical sections. For example to print an A3 size metafile, you should consider two A4 size sections.
2. For each section, offset origion of the destination canvas to top-left corner of the section.
3. Stretch draw the metafile on the canvas, as you print on an A3 paper. However, your actual canvas size should be A4 size.


How can I devide a canvas in sections?
Can you give some more info?
Thanks in advance
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1044
Location: Tehran, Iran

PostPosted: 11/08/06 16:02    Post subject: Reply with quote

Feike wrote:
How can I devide a canvas in sections?

In the same way you divide a paper; by measuring and locating the right coordinates.

_________________
Kambiz
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Feike
Member


Joined: 02 Aug 2006
Posts: 6
Location: Netherlands

PostPosted: 11/08/06 20:17    Post subject: Reply with quote

Is this what you mean?

Code:
procedure split metafile(Index:Integer);
var
 BWidth, BHeight : Integer;
 SrcRect, DestRect : TRect;
 BlzCanvas:TCanvas;
begin
 BWidth := Picture.Width div 2;
 BHeight := Picture.Height div 2;

 DestRect := pa4; // a4 papersize

 SrcRect.Left := (Index mod 2) * BWidth;
 SrcRect.Top := (Index div 2) * BHeight;
 SrcRect.Right := SrcRect.Left + BWidth;
 SrcRect.Bottom := SrcRect.Top + BHeight;

 try
   BlzCanvas := TMetafileCanvas.Create(FPicture.Metafile,0);
   BlzCanvas.Draw(0 - (SrcRect.Left ),0 - (SrcRect.Top ),Picture.Metafile);
 finally
   BlzCanvas.Free;
 end;
  PreviewPrinter1.Canvas.StretchDraw(pa4,BlzCanvas);
end;
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1044
Location: Tehran, Iran

PostPosted: 12/08/06 04:54    Post subject: Reply with quote

Yes!

You do not need BlzCanvas.

_________________
Kambiz
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Feike
Member


Joined: 02 Aug 2006
Posts: 6
Location: Netherlands

PostPosted: 12/08/06 07:39    Post subject: Reply with quote

I tried this and it works!

Thanks for your help!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    DELPHI AREA Forum Index -> Delphi Programming All times are GMT
Page 1 of 1

Add to favorites

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group