void apply_unseen_mask() { Rect base_rect = {9,9,53,45},to_rect,big_to = {13,13,337,265}; GrafPtr old_port; short i,j,k,l; ConstPatternParam c; bool need_bother = false; if (PSD[SDF_NO_FRILLS] > 0) return; if ((is_combat()) && (which_combat_type == 0)) return; if (!(is_out()) && (univ.town->lighting_type > 0)) return; for (i = 0; i < 11; i++) for (j = 0; j < 11; j++) if (unexplored_area[i + 1][j + 1] == 1) need_bother = true; if (need_bother == false) return; GetPort(&old_port); SetPort(terrain_screen_gworld); //p = *bw_pats[3]; //c = p; c = *bw_pats[3]; PenPat(c); PenMode(notPatOr); for (i = 0; i < 11; i++) for (j = 0; j < 11; j++) if (unexplored_area[i + 1][j + 1] == 1) { to_rect = base_rect; OffsetRect(&to_rect,-28 + i * 28,-36 + 36 * j); SectRect(&to_rect,&big_to,&to_rect); PaintRect(&to_rect); //PaintRoundRect(&to_rect,4,4); for (k = i - 2; k < i + 1; k++) for (l = j - 2; l < j + 1; l++) if ((k >= 0) && (l >= 0) && (k < 9) && (l < 9) && ((k != i - 1) || (l != j - 1))) terrain_there[k][l] = -1; } //p = *bw_pats[6]; //c = p; c = *bw_pats[6]; PenPat(c); PenMode(patCopy); SetPort(old_port); }
void _HYPlatformGraphicPane::_DrawHatchedLine (_HYRect lineDesc) { PenState savePen; GetPenState (&savePen); if (abs(lineDesc.left-lineDesc.right)>5) PenPat (&penHatchPattern); else PenPat (&vertPenHatchPattern); PenSize (lineDesc.width, lineDesc.width); MoveTo (lineDesc.left, lineDesc.top); LineTo (lineDesc.right,lineDesc.bottom); SetPenState (&savePen); }
static void MyDrawUserItem(DialogRef theDialog, DialogItemIndex itemNo) { DialogItemType itemType; Handle itemHandle; Rect itemBox; GetDialogItem(theDialog, itemNo, &itemType, &itemHandle, &itemBox); CGrafPtr savePort; GetPort(&savePort); SetPortDialogPort(theDialog); PenState penState; GetPenState(&penState); PenSize(3, 3); if (itemType & itemDisable) { Pattern gray; PenPat(GetQDGlobalsGray(&gray)); } FrameRect(&itemBox); Rect userRect = {gUserV-4, gUserH-4, gUserV+4, gUserH+4}; PaintRect(&userRect); SetPenState(&penState); SetPort(savePort); }
static void MacInversePolyline (SHORT_POINT *points, INT n) { int i; if (n<2) return; PenMode(patXor); PenPat(qdgray); MoveTo (points[0].x, points[0].y); for (i=1; i<n; i++) LineTo (points[i].x, points[i].y); PenNormal(); }
static void Marker (short n, short s, short x, short y) { Rect r; PolyHandle myPoly; s = s/2; r.top = y-s; r.bottom = y+s; r.left = x-s; r.right = x+s; n = n%11; switch (n) { case 0 : FrameRect(&r); break; case 1 : PenPat(&qd.gray); PaintRect(&r); PenNormal(); break; case 2 : PaintRect(&r); break; case 3 : FrameOval(&r); break; case 4 : PenPat(&qd.gray); PaintOval(&r); PenNormal(); break; case 5 : PaintOval(&r); break; case 6 : MoveTo(x,y+s); LineTo(x+s,y); LineTo(x,y-s); LineTo(x-s,y); LineTo(x,y+s); break; case 7 : PenPat(&qd.gray); myPoly = OpenPoly(); MoveTo(x,y+s); LineTo(x+s,y); LineTo(x,y-s); LineTo(x-s,y); LineTo(x,y+s); ClosePoly(); PaintPoly(myPoly); KillPoly(myPoly); PenNormal(); break; case 8 : myPoly = OpenPoly(); MoveTo(x,y+s); LineTo(x+s,y); LineTo(x,y-s); LineTo(x-s,y); LineTo(x,y+s); ClosePoly(); PaintPoly(myPoly); KillPoly(myPoly); PenNormal(); break; case 9 : MoveTo(x,y+s); LineTo(x,y-s); MoveTo(x-s,y); LineTo(x+s,y-s); break; case 10 : MoveTo(x-s,y+s); LineTo(x+s,y-s); MoveTo(x-s,y-s); LineTo(x+s,y+s); break; } }
Boolean ThermDialog::DisplayTherm(int k,int maxk,unsigned char *st) { Rect r; int maxr; Handle h; short itemType; long temp; GrafPtr tdp; WindowPtr window; short thePart; Rect screenRect, updateRect; Point aPoint = {100, 100}; Boolean QuitFlag = FALSE; short item = 0; EventRecord event; short the_part; DialogPtr hitdp; GetPort(&tdp); SetPort(dp); if (st != NULL) { GetDItem (dp,ids[THERM_TEXT], &itemType, &h, &r); SetIText(h,st); } GetDItem (dp, ids[THERM_BOX], &itemType, &h, &r); if (k == -1) k = old_k; if (maxk == -1) maxk = old_maxk; maxr = r.right; temp = ((long)k*((long)r.right - (long)r.left))/(long)maxk; r.right = r.left + temp; if (r.right>maxr) r.right=maxr; old_k = k; old_maxk = maxk; PenNormal (); PenPat(&qd.gray); PaintRect(&r); PenNormal (); SetPort(tdp); if (GetNextEvent(0xFFFF,&event)) { if (event.what == mouseDown) { the_part = FindWindow(event.where, &window); if (IsDialogEvent(&event)) { DialogSelect(&event,&hitdp,&item); if ((hitdp == dp) && (item == ids[THERM_CANCEL])) { Quit = TRUE; return FALSE; } } else switch (the_part) { case inSysWindow: SystemClick (&event, window); break; case inDrag: screenRect = (**GetGrayRgn()).rgnBBox; DragWindow( window, event.where, &screenRect ); break; } } else if (event.what == keyDown) { if ((event.modifiers & 0x0100) && ( (event.message) & charCodeMask == 0x02E)) { Quit = TRUE; return FALSE; } } else if (event.what == updateEvt) { window = (WindowPtr)event.message; updateRect = (**(window->visRgn)).rgnBBox; SetPort( window ) ; BeginUpdate( window ); DrawDialog( window ); if (dp == window) box_d_item(dp,ids[THERM_BOX]); EndUpdate( window ); } } if (Quit) return FALSE; return TRUE; }
void DrawNoSectPolyRecursive (CMap *theMap, PolyObjectHdl MapPolyHdl, DrawSpecRecPtr drawSettings,Rect subRect) { long PointCount, PlotCount = 0, PointIndex; LongPoint MatrixPt; Point LastScrPt, ThisScrPt, FirstScrPt; LongPoint **RgnPtsHdl; PolyHandle PolyHdl = nil; //////////// Boolean alwaysIn123 = true; Boolean alwaysIn174 = true; Boolean alwaysIn456 = true; Boolean alwaysIn386 = true; Boolean canSkipDrawingPolygon = false; // 1 7 4 // 2 0 5 // 3 8 6 //////////////// PointCount = GetPolyPointCount (MapPolyHdl); RgnPtsHdl = GetPolyPointsHdl (MapPolyHdl); Boolean bDrawBlackAndWhite = (sharedPrinting && settings.printMode != COLORMODE); #define MAXNUMSEGMENTS 8000 // JLM, It seems the limit is 32K not 64K at the documentation says short thisSectionOfPlane,prevSectionOfPlane; Boolean canSkipThisPt,skippedAPt,offQuickDrawPlane=false; Point lastSkippedPt; Rect fuzzyRect = subRect; long lineWidth = 1, esiCode; long outsetPixels = 2*lineWidth+2; // needs to be wider that the line width //long penWidth = 3; long penWidth = 2; long halfPenWidth = 0; InsetRect(&fuzzyRect,-outsetPixels,-outsetPixels); if (RgnPtsHdl != nil) { // must clip to this rect in addtion to the original clip Rect clippingRect = subRect; RgnHandle saveClip = NewRgn(), addition = NewRgn() , newClip = NewRgn(); GetClip(saveClip); GetClip(newClip); RectRgn(addition, &clippingRect); SectRgn(newClip, addition, newClip); SetClip(newClip); if(newClip) DisposeRgn(newClip); if(addition) DisposeRgn(addition); if (drawSettings -> fillCode != kNoFillCode) PolyHdl = OpenPoly (); else { PolyHdl = OpenPoly (); //Our_PmForeColor (gDrawBitmapInBlackAndWhite ? kBlackColorInd : drawSettings -> foreColorInd); Our_PmForeColor (drawSettings -> foreColorInd); } GetObjectESICode ((ObjectRecHdl) MapPolyHdl,&esiCode); if (esiCode>0) // -500 is the default { //halfPenWidth = penWidth/2; #ifdef MAC PenSize(penWidth,penWidth); #else PenStyle(BLACK,penWidth); #endif } for (PointIndex = 0,skippedAPt = false,prevSectionOfPlane = -1; PointIndex < PointCount; ++PointIndex) { MatrixPt = (*RgnPtsHdl) [PointIndex]; // theMap -> GetScrPoint (&MatrixPt, &ThisScrPt); //ThisScrPt.h = SameDifferenceX(MatrixPt.h); //ThisScrPt.v = (gRect.bottom + gRect.top) - SameDifferenceY(MatrixPt.v); ThisScrPt = GetQuickDrawPt(MatrixPt.h, MatrixPt.v, &gRect, &offQuickDrawPlane); // code goes here, what to do when point is off quickdraw plane? //if (offQuickDrawPlane) break; ThisScrPt.h += drawSettings -> offsetDx; ThisScrPt.v += drawSettings -> offsetDy; if(PolyHdl) { //// JLM 2/18/99 // for points outside the drawing area, it is not necessary to move to the correct point, // as long as we preserve the winding. This allows us to ignore many of the points outside // the drawing rectangle gRect thisSectionOfPlane = SectionOfPlane(&fuzzyRect,ThisScrPt); if( thisSectionOfPlane > 0 // outside of the rectangle && thisSectionOfPlane == prevSectionOfPlane // we have not changed sections of the plane && PointIndex < PointCount -1) // not the last point canSkipThisPt = true; else canSkipThisPt = false; prevSectionOfPlane = thisSectionOfPlane; if(canSkipThisPt) { skippedAPt = true; lastSkippedPt =ThisScrPt; continue; } /// JLM 3/6/01 switch(thisSectionOfPlane) { case 1: alwaysIn456 = false; alwaysIn386 = false; break; case 2: alwaysIn174 = false; alwaysIn456 = false; alwaysIn386 = false; break; case 3: alwaysIn174 = false; alwaysIn456 = false; break; case 4: alwaysIn123 = false; alwaysIn386 = false; break; case 5: alwaysIn123 = false; alwaysIn174 = false; alwaysIn386 = false; break; case 6: alwaysIn123 = false; alwaysIn174 = false; break; case 7: alwaysIn123 = false; alwaysIn456 = false; alwaysIn386 = false; break; case 8: alwaysIn123 = false; alwaysIn174 = false; alwaysIn456 = false; break; default: alwaysIn123 = false; alwaysIn174 = false; alwaysIn456 = false; alwaysIn386 = false; break; } ////// if(skippedAPt) { // then we have to draw to the previous point // before we draw to the current point PointIndex--; //so we do the previous point below ThisScrPt = lastSkippedPt; // restore the coordinates of the previous point prevSectionOfPlane = -1; // force the next point to not be skipped } skippedAPt = false; if(PlotCount > MAXNUMSEGMENTS) { // there is a bug on the max when the number of points gets too large // try recusion ClosePoly(); KillPoly(PolyHdl); SetClip(saveClip);// JLM 8/4/99 goto recursion; } ////////////// } if (PointIndex == 0) { MyMoveTo (ThisScrPt.h-halfPenWidth, ThisScrPt.v-halfPenWidth); FirstScrPt = ThisScrPt; LastScrPt = ThisScrPt; PlotCount = 0; } else { if (LastScrPt.h != ThisScrPt.h || LastScrPt.v != ThisScrPt.v) { MyLineTo (ThisScrPt.h-halfPenWidth, ThisScrPt.v-halfPenWidth); LastScrPt = ThisScrPt; ++PlotCount; } } } if (drawSettings -> bClosed) /* draw a line from last point to first point if requested */ { MyLineTo (FirstScrPt.h-halfPenWidth, FirstScrPt.v-halfPenWidth); ++PlotCount; } if (PolyHdl != nil) { ClosePoly (); ////////////// JLM 3/6/01 if(alwaysIn123 || alwaysIn174 || alwaysIn456 || alwaysIn386) canSkipDrawingPolygon = true; if(canSkipDrawingPolygon) PlotCount = 0; // so that we skip the code below //////////// if (PlotCount > 0) { if (PlotCount > 2) /* polygon must contain more than 2 line-to points */ { if (drawSettings -> bErase || (drawSettings -> fillCode == kNoFillCode && drawSettings -> backColorInd == kWaterColorInd)) ErasePoly (PolyHdl); if (drawSettings -> fillCode == kPaintFillCode) { // this is the usual drawing code Our_PmForeColor (bDrawBlackAndWhite || gDrawBitmapInBlackAndWhite ? kBlackColorInd : drawSettings -> foreColorInd);//JLM if(bDrawBlackAndWhite) SetPenPat(UPSTRIPES); PaintPoly(PolyHdl);//JLM if(bDrawBlackAndWhite) SetPenPat(BLACK); } else if (drawSettings -> fillCode == kPatFillCode) FillPoly (PolyHdl, &(drawSettings -> backPattern)); } if (drawSettings -> frameCode == kPaintFrameCode) { Our_PmForeColor (bDrawBlackAndWhite || gDrawBitmapInBlackAndWhite ? kBlackColorInd : drawSettings -> foreColorInd); FramePoly (PolyHdl); } else if (drawSettings -> frameCode == kPatFrameCode) { PenPat (&(drawSettings -> forePattern)); FramePoly (PolyHdl); } } KillPoly (PolyHdl); } SetClip(saveClip); if(saveClip) DisposeRgn(saveClip); } #ifdef MAC PenSize(1,1); #else PenStyle(BLACK,1); #endif return; //////////////////////////////// recursion: //////////////////////////////// { #define MAXRECURSION 20 static short sRecursionValue = 0; if(sRecursionValue >= MAXRECURSION) { printError("max recusion exceeded"); } else { // use recursion Rect subBoundingRect; long middleH = (subRect.left+subRect.right)/2; long middleV = (subRect.top+subRect.bottom)/2; long index; sRecursionValue++; // divide the points up and Draw again for(index = 0; index < 4; index++) { subBoundingRect = subRect; switch(index) { case 0: subBoundingRect.top = middleV; subBoundingRect.left = middleH; break; case 1: subBoundingRect.top = middleV; subBoundingRect.right = middleH; break; case 2: subBoundingRect.bottom = middleV; subBoundingRect.left = middleH; break; default: subBoundingRect.bottom = middleV; subBoundingRect.right = middleH; break; } // the recursive call DrawNoSectPolyRecursive (theMap,MapPolyHdl,drawSettings,subBoundingRect); } // all done sRecursionValue--; return; } } }
OSErr DrawSectPoly (CMap* theMap, PolyObjectHdl MapPolyHdl, DrawSpecRecPtr drawSettings) { long SegCount, SegIndex, SegIndexPlus, PlotCount; LongPoint MatrixPt; Point ThisScrPt; OSErr ErrCode = 0; Boolean DrawFromSegFlag; PolyHandle PolyHdl = nil; SegmentsHdl SectSegHdl = nil; LongRect sectLRect; Rect ScrPolyRect; theMap -> GetMapDrawRect (&ScrPolyRect); InsetRect (&ScrPolyRect, -1, -1); theMap -> GetMatrixLRect (&ScrPolyRect, §LRect); SectSegHdl = MakeSectPoly (§LRect, MapPolyHdl); if (SectSegHdl != nil) { SegCount = _GetHandleSize ((Handle) SectSegHdl) / sizeof (Segment); PolyHdl = OpenPoly (); DrawFromSegFlag = true; PlotCount = 0; Boolean bDrawBlackAndWhite = (sharedPrinting && settings.printMode != COLORMODE); for (SegIndex = 0; SegIndex < SegCount; ++SegIndex) { if (DrawFromSegFlag) /* start of new poly */ { MatrixPt.h = (*SectSegHdl) [SegIndex].fromLong; MatrixPt.v = (*SectSegHdl) [SegIndex].fromLat; theMap -> GetScrPoint (&MatrixPt, &ThisScrPt); MyMoveTo (ThisScrPt.h, ThisScrPt.v); DrawFromSegFlag = false; PlotCount = 0; } MatrixPt.h = (*SectSegHdl) [SegIndex].toLong; MatrixPt.v = (*SectSegHdl) [SegIndex].toLat; theMap -> GetScrPoint (&MatrixPt, &ThisScrPt); MyLineTo (ThisScrPt.h, ThisScrPt.v); ++PlotCount; SegIndexPlus = SegIndex + 1; if (SegIndexPlus == SegCount) SegIndexPlus = 0; /* check for end of current poly */ if (((*SectSegHdl) [SegIndex].toLat != (*SectSegHdl) [SegIndexPlus].fromLat || (*SectSegHdl) [SegIndex].toLong != (*SectSegHdl) [SegIndexPlus].fromLong)) { ClosePoly (); if (PlotCount > 0) { if (PlotCount > 2) { if (drawSettings -> bErase) ErasePoly (PolyHdl); if (drawSettings -> fillCode == kPaintFillCode) { // this is the usual drawing code Our_PmForeColor (bDrawBlackAndWhite || gDrawBitmapInBlackAndWhite ? kBlackColorInd : drawSettings -> foreColorInd);//JLM if(bDrawBlackAndWhite) SetPenPat(UPSTRIPES); PaintPoly(PolyHdl);//JLM if(bDrawBlackAndWhite) SetPenPat(BLACK); } else if (drawSettings -> fillCode == kPatFillCode) FillPoly (PolyHdl, &(drawSettings -> backPattern)); } if (drawSettings -> frameCode == kPaintFrameCode) { Our_PmForeColor (bDrawBlackAndWhite || gDrawBitmapInBlackAndWhite ? kBlackColorInd : drawSettings -> foreColorInd); FramePoly (PolyHdl); } else if (drawSettings -> frameCode == kPatFrameCode) { PenPat (&(drawSettings -> forePattern)); FramePoly (PolyHdl); } } KillPoly (PolyHdl); /* now open a new poly for the next set of segments */ PolyHdl = OpenPoly (); DrawFromSegFlag = true; } } ClosePoly (); if (PlotCount > 0) { if (PlotCount > 2) /* must have at least 3 segments to fill-poly */ { if (drawSettings -> bErase) ErasePoly (PolyHdl); if (drawSettings -> fillCode == kPaintFillCode) { Our_PmForeColor (drawSettings -> backColorInd); FillPoly (PolyHdl, &(drawSettings -> backPattern)); } else if (drawSettings -> fillCode == kPatFillCode) FillPoly (PolyHdl, &(drawSettings -> backPattern)); } if (drawSettings -> frameCode == kPaintFrameCode) { Our_PmForeColor (drawSettings -> foreColorInd); FramePoly (PolyHdl); } else if (drawSettings -> frameCode == kPatFrameCode) { PenPat (&(drawSettings -> forePattern)); FramePoly (PolyHdl); } } KillPoly (PolyHdl); DisposeHandle ((Handle) SectSegHdl); } return (ErrCode); }
void ZoomRect (Rect *smallrect, Rect *bigrect, Boolean zoomup) { #if USE_DRAG_MANAGER_FOR_ZOOMS if (gZoomOn) { if (zoomup) ZoomRects(smallrect,bigrect,10,kZoomNoAcceleration); else ZoomRects(bigrect,smallrect,10,kZoomNoAcceleration); } #else Fixed factor; Rect rect1, rect2, rect3, rect4; GrafPtr savePort, deskPort; int i; long tm; if (gZoomOn) { GetPort (&savePort); OpenPort (deskPort = (GrafPtr) NewPtr (sizeof (GrafPort))); InitPort (deskPort); SetPort (deskPort); PenPat (&qd.gray); //¥ Original, comment for black zoom. // PenPat (&qd.black); //¥ Uncomment for black zoom. PenMode (notPatXor); //¥ Original, comment for black zoom. // PenMode (patXor); //¥ Uncomment for black zoom. if (zoomup) { rect1 = *smallrect; factor = FixRatio (6, 5); fract = FixRatio (541, 10000); } else { rect1 = *bigrect; factor = FixRatio (5, 6); fract = ONE; } rect2 = rect1; rect3 = rect1; FrameRect (&rect1); for (i = 1; i <= ZOOMSTEPS; i++) { rect4.left = Blend (smallrect->left, bigrect->left); rect4.right = Blend (smallrect->right, bigrect->right); rect4.top = Blend (smallrect->top, bigrect->top); rect4.bottom = Blend (smallrect->bottom, bigrect->bottom); FrameRect (&rect4); FrameRect (&rect1); rect1 = rect2; rect2 = rect3; rect3 = rect4; fract = FixMul (fract, factor); tm = TickCount (); // These two lines are a crude waitvbl while (tm == TickCount ()); } FrameRect (&rect1); FrameRect (&rect2); FrameRect (&rect3); ClosePort (deskPort); DisposePtr ((Ptr) deskPort); PenNormal (); SetPort (savePort); } #endif }
void ZoomRect(Boolean zoomLarger,Rect *smallRect, Rect *bigRect) { double firstStep,stepValue,trailer,zoomRatio; short i,step; Rect curRect; unsigned long ticks; Pattern grayPattern; //used in carbonization RgnHandle rgnHandle = NewRgn(); GrafPtr oldPort; Rect tempRect1; GetPort(&oldPort); SetPort(GetWindowPort(gWindow)); //PenPat(&qd.gray); PenPat(GetQDGlobalsGray(&grayPattern)); PenMode(patXor); firstStep=kZoomRatio; for (i=0; i<kNumSteps; i++) { firstStep *= kZoomRatio; } if (!zoomLarger) { zoomRatio = 1.0/kZoomRatio; firstStep = 1.0-firstStep; } else zoomRatio = kZoomRatio; trailer = firstStep; stepValue = firstStep; for (step=0; step<(kNumSteps+kRectsVisible); step++) { // draw new frame if (step<kNumSteps) { stepValue /= zoomRatio; CalcRect(&curRect,smallRect,bigRect,stepValue); FrameRect(&curRect); } // erase old frame if (step>=kRectsVisible) { trailer /= zoomRatio; CalcRect(&curRect,smallRect,bigRect,trailer); FrameRect(&curRect); } QDFlushPortBuffer(GetWindowPort(gWindow), GetPortVisibleRegion(GetWindowPort(gWindow), rgnHandle)); Delay(kDelayTicks,&ticks); } PenNormal(); DisposeRgn(rgnHandle); smallRect->top = bigRect->top = -1; EraseRect(GetPortBounds(GetWindowPort(gWindow), &tempRect1)); SetPort(oldPort); }
static void InvMarker (SHORT_POINT point) { Rect r; PolyHandle myPoly; short n,s,S,x,y; s = currgw->marker_size/2; S = 1.41*s; n = currgw->marker_id; x = point.x; y = point.y; r.top = y-s; r.bottom = y+s; r.left = x-s; r.right = x+s; switch (n) { case EMPTY_SQUARE_MARKER : PenMode(patXor); FrameRect(&r); break; case GRAY_SQUARE_MARKER : PenMode(patXor); PenPat(qdgray); PaintRect(&r); PenNormal(); break; case FILLED_SQUARE_MARKER : PenMode(patXor); PenPat(qdgray); PaintRect(&r); break; case EMPTY_CIRCLE_MARKER : PenMode(patXor); FrameOval(&r); break; case GRAY_CIRCLE_MARKER : PenMode(patXor); PenPat(qdgray); PaintOval(&r); PenNormal(); break; case FILLED_CIRCLE_MARKER : PenMode(patXor); PenPat(qdgray); PaintOval(&r); break; case EMPTY_RHOMBUS_MARKER : PenMode(patXor); PenPat(qdgray); MoveTo(x,y+S); LineTo(x+S,y); LineTo(x,y-S); LineTo(x-S,y); LineTo(x,y+S); break; case GRAY_RHOMBUS_MARKER : PenMode(patXor); PenPat(qdgray); myPoly = OpenPoly(); MoveTo(x,y+S); LineTo(x+S,y); LineTo(x,y-s); LineTo(x-S,y); LineTo(x,y+S); ClosePoly(); InvertPoly(myPoly); KillPoly(myPoly); PenNormal(); break; case FILLED_RHOMBUS_MARKER : myPoly = OpenPoly(); MoveTo(x,y+S); LineTo(x+S,y); LineTo(x,y-S); LineTo(x-S,y); LineTo(x,y+S); ClosePoly(); InvertPoly(myPoly); KillPoly(myPoly); PenNormal(); break; case PLUS_MARKER : PenMode(patXor); PenPat(qdgray); MoveTo(x,y+s); LineTo(x,y-s); MoveTo(x-s,y); LineTo(x+s,y); break; case CROSS_MARKER : PenMode(patXor); PenPat(qdgray); MoveTo(x-s,y+s); LineTo(x+s,y-s); MoveTo(x-s,y-s); LineTo(x+s,y+s); break; default : break; } PenNormal(); }
void DrawObject (ObjectRecHdl theObjectHdl, CMap *Map, LongRect *UpdateLRectPtr, DrawSpecRecPtr drawSettings) { OSType thisObjectType; RGBColor SaveColor; GetForeColor (&SaveColor); // save original forecolor GetObjectType (theObjectHdl, &thisObjectType); switch (thisObjectType) { case kPolyType: DrawMapPoly (Map, (PolyObjectHdl) theObjectHdl, drawSettings); break; case kBeachedLEType: DrawBeachLEs (Map, (PolyObjectHdl) theObjectHdl, drawSettings); break; case kRectType: { Rect ObjectRect; GetObjectScrRect (Map, theObjectHdl, &ObjectRect); MyOffsetRect (&ObjectRect, drawSettings -> offsetDx, drawSettings -> offsetDy); if (drawSettings -> fillCode == kPaintFillCode) { if (drawSettings -> backColorInd > 0) { Our_PmForeColor (drawSettings -> backColorInd); PaintRect (&ObjectRect); } } else if (drawSettings -> fillCode == kPatFillCode) { #ifdef MAC PenPat (&drawSettings -> backPattern); #else SetPenPat (drawSettings -> backPattern); #endif PaintRect (&ObjectRect); } if (drawSettings -> frameCode == kPatFrameCode) #ifdef MAC PenPat (&drawSettings -> forePattern); #else SetPenPat (drawSettings -> forePattern); #endif Our_PmForeColor (drawSettings -> foreColorInd); MyFrameRect (&ObjectRect); } break; case kTextType: { Rect ObjectRect; GetObjectScrRect (Map, theObjectHdl, &ObjectRect); MyOffsetRect (&ObjectRect, drawSettings -> offsetDx, drawSettings -> offsetDy); if (drawSettings -> fillCode == kPaintFillCode) { if (drawSettings -> backColorInd > 0) { Our_PmForeColor (drawSettings -> backColorInd); PaintRect (&ObjectRect); } } else if (drawSettings -> fillCode == kPatFillCode) { #ifdef MAC PenPat (&drawSettings -> backPattern); #else SetPenPat (drawSettings -> backPattern); #endif PaintRect (&ObjectRect); } if (drawSettings -> frameCode == kPatFrameCode) #ifdef MAC PenPat (&drawSettings -> forePattern); #else SetPenPat (drawSettings -> forePattern); #endif Our_PmForeColor (drawSettings -> foreColorInd); // DrawTextObject ((TextObjectRecHdl) theObjectHdl, Map, UpdateLRectPtr, drawSettings); } break; case kLineType: { LongRect ObjectLRect; Rect ObjectRect; LongPoint LineStartLPoint, LineEndLPoint; Point LineStartPoint, LineEndPoint; LineObjectRecHdl lineObjectHdl; lineObjectHdl = (LineObjectRecHdl) theObjectHdl; LineStartLPoint = (**lineObjectHdl).lineStartLPoint; LineEndLPoint = (**lineObjectHdl).lineEndLPoint; Map -> GetScrPoint (&LineStartLPoint, &LineStartPoint); Map -> GetScrPoint (&LineEndLPoint, &LineEndPoint); LineStartPoint.h += drawSettings -> offsetDx; LineStartPoint.v += drawSettings -> offsetDy; LineEndPoint.h += drawSettings -> offsetDx; LineEndPoint.v += drawSettings -> offsetDy; if (drawSettings -> fillCode == kPatFillCode) #ifdef MAC PenPat (&drawSettings -> backPattern); #else SetPenPat (drawSettings -> backPattern); #endif else if (drawSettings -> frameCode == kPatFrameCode) #ifdef MAC PenPat (&drawSettings -> forePattern); #else SetPenPat (drawSettings -> forePattern); #endif Our_PmForeColor (drawSettings -> foreColorInd); MyMoveTo (LineStartPoint.h, LineStartPoint.v); MyLineTo (LineEndPoint.h, LineEndPoint.v); } break; }
void PenPatQDGlobalsWhite(void) { Pattern pat = MyGetQDGlobalsWhite(); PenPat(&pat); }
void PenPatQDGlobalsBlack(void) { Pattern pat = MyGetQDGlobalsBlack(); PenPat(&pat); }
void PenPatQDGlobalsDarkGray(void) { Pattern pat = MyGetQDGlobalsDarkGray(); PenPat(&pat); }