[comp.sys.mac.programmer] Summary of "Does anyone know how to concatenate PICTs together?"

monching@quiche.cs.mcgill.ca (Patrick WONG) (11/05/90)

Thanks to everyone how responded to my question.  It came in really handy.
To those out there in net-land, who might benefit from it.  Here is the
original post and the thread that followed.

Remember each article is copyrighted by the author who wrote it.  Plus it
would be nice if they are given credit whenever possible if any of the code
is used.  Enjoy!

In article  monching@quiche.cs.mcgill.ca (Patrick WONG) writes:
> I need to concatenate two PICTs together.  I wish to program a unit in either
> in pascal or c.  There would be two PicHandles.  The routine would have to
> return a PicHandle with the first PICT in the background and the second PICT
> in the foreground.  I was considering using copybits.


=====================================================================
From: dowdy@apple.com (Tom Dowdy)
Subject: Re: Does anyone know how to concatenate PICTs together?

Using CopyBits will reduce all of the pictures to bitmaps, which probably
isn't what you want.  (Or are your picts both bitmaps, in which case
the following code wouldn't work?)

Off of the top of my head:

concatPic = OpenPicture(aRect); // arect would be union of two pictures
DrawPicture(pict1, pic1Rect);
DrawPicture(pict2, pic2Rect);
ClosePicture();

I leave it up to you to add: error checking, calculating the rectangles
for each picture from (**pict).picFrame, and unioning the two rectangles
together to find the total bounding box.


=====================================================================
From: francis%zaphod@gargoyle.uchicago.edu (Francis Stracke)
Subject: Re: Does anyone know how to concatenate PICTs together?

Try doing OpenPicture, DrawPicture(the first one), DrawPicture(the second
one),ClosePicture.  This may work.


=====================================================================
From: woody%CITIAGO.BITNET@vm1.mcgill.ca
Subject: Re: Does anyone know how to concatenate PICTs together?

Why use CopyBits when you can do the following:

        result = OpenPicture();
        DrawPicture(background,...);    /* Got to get the rect right */
        DrawPicture(foreground,...);
        ClosePicture();
        return result;

(Now as I'm away from my manuals I don't remember the arguments, but this
is the general idea.)


=====================================================================
From: "Phil Shapiro" <phils@chaos.cs.brandeis.edu>
Subject: Does anyone know how to concatenate PICTs together?

I've never done this, but why not just do (psuedo-Pascal):

procedure ConcatPICT(pict1, pict2:PicHandle; var outpict : PicHandle)
 var
   r : Rect;
begin
{ You figure out how to set up the rect }
  outpict := OpenPicture(r);
  DrawPicture(pict1);
  DrawPicture(pict2);
  ClosePicture;
end;


=====================================================================
From: francis%zaphod@gargoyle.uchicago.edu  (Francis Stracke)
Subject: white rectangle

Take a look at the 2nd picture.  Is it a bitmap? Might be drawing the
white pixels with the black.  Did you create these 2 pictures?


=====================================================================
From: schorsch@oxy.edu (Brent William Schorsch)
Subject: Re: Does anyone know how to concatenate PICTs together?

you could create an offscreen Gworld/pixmap/bitmap, draw the picts
into them, open a picture, copybits to from the map to the map, close
the picture... viola...

-- 
patrick wong                   | McGill University           
monching@quiche.cs.mcgill.ca   | School of Computer Science                                | Montreal, Quebec