cs161aey@sdcc18.ucsd.EDU (Joe Gervais) (10/04/87)
I'm programing in Megmax C (v. 2.0 (?)) and after defining a picture and closing it, I can draw it in the original srcrect but if I try to move it I don't get anything. I "believe" I'm doing it correctly, but I just don't get anything. Even just offsetting the srcrect (so as not to change size and need scaling) it doesn't work. pichandle pik; /* set two rects */ pik = openpicture(&pikrect2); . . closepicture(); drawpicture(pik,&pikrect2); /*<-- works*/ drawpicture(pik,&pikrect1); /* <-- nada.. */ Is there is some common error I'm missing in declaration (I've tried simple forms as well as my picture) or some problem in C or Megamax specifically or ANYTHING?!? Any advice except telling me to use lightspeed is GREATLY appreciatted!!! That's about all... I'm Tod but mail c/o Joe Gervais @ sdcc18 UC San Diego Computing Center... Thanks in advance... -tk Rebel w/o a clue..
singer@endor.harvard.edu (Richard Siegel) (10/05/87)
In article <773@sdcc18.ucsd.EDU> cs161aey@sdcc18.ucsd.EDU (Joe Gervais) writes: > > [problems doing a picture, some sample code] > I may be wrong (it's happened before :-)), but I think you may need to set the cliping region of the current grafport with ClipRect(); that may help. This is one case where using LightspeedC does you no good. :-) --Rich **The opinions stated herein are my own opinions and do not necessarily represent the policies or opinions of my employer (THINK Technologies, Inc). * Richard M. Siegel | {decvax, ucbvax, sun}!harvard!endor!singer * * Customer Support | singer@endor.harvard.edu * * THINK Technologies, Inc. (No snappy quote) *
lsr@apple.UUCP (Larry Rosenstein) (10/12/87)
In article <773@sdcc18.ucsd.EDU> cs161aey@sdcc18.ucsd.EDU (Joe Gervais) writes: > > I'm programing in Megmax C (v. 2.0 (?)) and after defining a picture >and closing it, I can draw it in the original srcrect but if I try to move >it I don't get anything. I "believe" I'm doing it correctly, but I just >don't get anything. Even just offsetting the srcrect (so as not to change >size and need scaling) it doesn't work. This is a common problem with using pictures. When you open a picture, Quickdraw records the current state ofthe clipping region in the picture. When you draw a picture in a rectangle that is offset from its creation rectangle, Quickdraw offsets the region as well. The problem occurs because the default clipping in a new grafPort is the largest possible rectangle. Offsetting this rectangle by any amount causes the coordinates to overflow, thus creating an empty region. The empty clipping region prevents anything from being drawn. The solution is to always set the clipping before or right after calling OpenPicture. The general rule of thumb is to call ClipRect with the same rectangle passed to OpenPicture. -- Larry Rosenstein Object Specialist Apple Computer AppleLink: Rosenstein1 UUCP: {sun, voder, nsc, mtxinu, dual}!apple!lsr CSNET: lsr@Apple.com