void _HYPlatformGraphicPane::_DrawOval (_HYRect rectDesc) { PenSize (rectDesc.width, rectDesc.width); Rect r= HYRect2Rect (rectDesc); FrameOval (&r); }
void drawItem(int left, int top, Str255 *label, Boolean listEnabled, Boolean itemEnabled ) { Rect rect; RGBColor color, markColor; if (listEnabled) color.red = color.green = color.blue = 0xffff; else color.red = color.green = color.blue = 0xffff / 2; SetRect( &rect, left, top + 2, left + 12, top + 14 ); ForeColor( blackColor ); FrameOval( &rect ); OffsetRect( &rect, -1, -1 ); RGBForeColor( &color ); FrameOval( &rect ); if (listEnabled && itemEnabled) markColor.red = markColor.green = markColor.blue = 0xffff; else if (itemEnabled) markColor.red = markColor.green = markColor.blue = 0xffff / 2; else markColor.red = markColor.green = markColor.blue = 8700; InsetRect( &rect, 3, 3 ); RGBForeColor( &markColor ); PaintOval( &rect ); ForeColor( blackColor ); MoveTo( left + 16, top + 11 ); DrawString( (unsigned char*)label ); RGBForeColor( &color ); MoveTo( left + 15, top + 10 ); DrawString( (unsigned char*)label ); }
void LCD_doframeOval(Lcd *x, Symbol *s, short argc, Atom *argv) { long left, top, right, bottom, color; PaletteHandle pH; RGBColor fColor; GrafPort *gp; RgnHandle cur; Rect b,r; EnterCallback(); // I'm suspicious of (argv++)->thing in Code Warrior left = argv->a_w.w_long; top = (argv+1)->a_w.w_long; right = (argv+2)->a_w.w_long; bottom = (argv+3)->a_w.w_long; color = (argv+4)->a_w.w_long; #ifdef debug post("frameOval"); #endif gp = patcher_setport(x->lcd_box.b_patcher); if (gp) { if (!box_nodraw((void *)x)) { if (color) // sde 11/1 x->lcd_pIndex = (short)color & (numPaletteColors-1); cur = NewRgn(); GetClip(cur); SetClip(x->lcd_region); setUpPalette(x,&fColor,&pH); r = x->lcd_box.b_rect; b.left = r.left + (short)left; b.top = r.top + (short)top; b.right = r.left + (short)right; b.bottom = r.top + (short)bottom; FrameOval(&b); restorePalette(x,&fColor,&pH); SetClip(cur); DisposeRgn(cur); } SetPort(gp); } ExitCallback(); }
void onMouseUp(int x, int y, unsigned long flags) { // Demonstrate doing some native drawing outside of the paint loop pxSurfaceNative s; if (PX_OK == beginNativeDrawing(s)) { #if defined(PX_PLATFORM_WIN) HGDIOBJ oldBrush = SelectObject(s, ::GetStockObject(NULL_BRUSH)); Ellipse(s, x-50, y-50, x+50, y+50); SelectObject(s, oldBrush); #elif defined(PX_PLATFORM_MAC) SetPort(s); Rect r; MacSetRect(&r, x-50, y-50, x+50, y+50); FrameOval(&r); #elif defined(PX_PLATFORM_X11) XDrawArc(s->display, s->drawable, s->gc, x-50, y-50, 100, 100, 0, 360*64); #endif endNativeDrawing(s); } }
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; } }
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 apply_light_mask() { GrafPtr old_port; Rect temp = {0,0,108,84},paint_rect,base_rect = {0,0,36,28}; Rect big_to = {13,13,337,265}; short i,j; bool is_dark = false,same_mask = true; if (PSD[SDF_NO_FRILLS] > 0) return; if (is_out()) return; if (univ.town->lighting_type == 0) return; if (oval_region == NULL) { temp_rect_rgn = NewRgn(); dark_mask_region = NewRgn(); oval_region = NewRgn(); OpenRgn(); FrameOval(&temp); CloseRgn(oval_region); } // Process the light array for (i = 2; i < 11; i++) for (j = 2; j < 11; j++) if (light_area[i][j] == 0) is_dark = true; if (is_dark == false) { for (i = 2; i < 11; i++) for (j = 2; j < 11; j++) last_light_mask[i][j] = 0; return; } for (i = 1; i < 12; i++) for (j = 1; j < 12; j++) if ((light_area[i - 1][j - 1] >= 1) && (light_area[i + 1][j - 1] >= 1) && (light_area[i - 1][j] >= 1) && (light_area[i + 1][j] >= 1) && (light_area[i - 1][j + 1] >= 1) && (light_area[i + 1][j + 1] >= 1) && (light_area[i][j - 1] >= 1) && (light_area[i][j + 1] >= 1)) { light_area[i][j] = 2; } for (i = 1; i < 12; i++) for (j = 1; j < 12; j++) if ((light_area[i - 1][j - 1] >= 2) && (light_area[i + 1][j - 1] >= 2) && (light_area[i - 1][j] >= 2) && (light_area[i + 1][j] >= 2) && (light_area[i - 1][j + 1] >= 2) && (light_area[i + 1][j + 1] >= 2) && (light_area[i][j - 1] >= 2) && (light_area[i][j + 1] >= 2)) { light_area[i][j] = 3; } GetPort(&old_port); SetPort(terrain_screen_gworld); for (i = 2; i < 11; i++) for (j = 2; j < 11; j++) { if (light_area[i][j] == 1) terrain_there[i - 2][j - 2] = -1; } for (i = 0; i < 13; i++) for (j = 0; j < 13; j++) if (last_light_mask[i][j] != light_area[i][j]) same_mask = false; if (same_mask == true) { PaintRgn(dark_mask_region); SetPort(old_port); return; } SetRectRgn(dark_mask_region,big_to.left,big_to.top,big_to.right,big_to.bottom); for (i = 0; i < 13; i++) for (j = 0; j < 13; j++) last_light_mask[i][j] = light_area[i][j]; for (i = 1; i < 12; i++) for (j = 1; j < 12; j++) { if (light_area[i][j] == 2) { OffsetRgn(oval_region,13 + 28 * (i - 3), 13 + 36 * (j - 3)); DiffRgn(dark_mask_region,oval_region,dark_mask_region); OffsetRgn(oval_region,-13 + -1 * (28 * (i - 3)),-13 + -1 * (36 * (j - 3))); //PaintRect(&paint_rect); } if (light_area[i][j] == 3) { paint_rect = base_rect; OffsetRect(&paint_rect,13 + 28 * (i - 2),13 + 36 * (j - 2)); SetRectRgn(temp_rect_rgn,paint_rect.left,paint_rect.top, paint_rect.right + 28,paint_rect.bottom + 36); DiffRgn(dark_mask_region,temp_rect_rgn,dark_mask_region); if (light_area[i + 1][j] == 3) light_area[i + 1][j] = 0; if (light_area[i + 1][j + 1] == 3) light_area[i + 1][j + 1] = 0; if (light_area[i][j + 1] == 3) light_area[i][j + 1] = 0; } } //rect_draw_some_item(light_mask_gworld,big_from,terrain_screen_gworld,big_to,0,0); PaintRgn(dark_mask_region); SetPort(old_port); }