void CDX10Renderer::DrawEllipseFill(const TVector2& _rv2Position, const float _kfWidth, const float _kfHeight, const bool _kHasBorder) { m_pDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); //fill vertex buffer with vertices TVertex* pVerts = 0; // Set vertex buffer UINT stride = sizeof( TVertex ); UINT offset = 0; m_pDevice->IASetVertexBuffers( 0, 1, &m_pVertexBuffer, &stride, &offset ); m_pVertexBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, (void**) &pVerts); const int kiCirclePoints = 20; const int kiMaxInc = kiCirclePoints * 3; for(int i = 0; i < kiMaxInc; i += 3) { float fAngleA = (2.0f * 3.14159265359f / static_cast<float>(kiCirclePoints)) * i; float fAngleB = (2.0f * 3.14159265359f / static_cast<float>(kiCirclePoints)) * (i + 1); pVerts[i] = TVertex(TVector3(_rv2Position.x + _kfWidth * 0.5f * cos(fAngleA), _rv2Position.y + _kfHeight * 0.5f * sin(fAngleA), 0), m_uiBrushColour); pVerts[i + 1] = TVertex(TVector3(_rv2Position.x + _kfWidth * 0.5f * cos(fAngleB), _rv2Position.y + _kfHeight * 0.5f * sin(fAngleB), 0), m_uiBrushColour); pVerts[i + 2] = TVertex(TVector3(_rv2Position.x, _rv2Position.y, 0), m_uiBrushColour); } m_pVertexBuffer->Unmap(); m_pDevice->Draw(kiMaxInc, 0); if(_kHasBorder) DrawEllipse(_rv2Position, _kfWidth, _kfHeight); }
void DrawScene() { BeginScene(1); ImageToScreen(pimage_bg,0,0); //RenderQuad(pimage_box,0,0,0,0,70,185,1,1,0,maskbox); //RenderQuad(pimage_box,0,0,0,0,70,5,1,1,0,maskbox); //DrawImage(pimage_icon[0],0,0,0,0,-20,-37,128,128); //DrawImage(pimage_icon[1],0,0,0,0,-20,143,128,128); ImageToScreen(pimage_text,0,0); //DrawEllipse(50,50,11,21,0xff0000ff,DISPLAY_PIXEL_FORMAT_8888); DrawEllipse(50,50,10,20,0xff0000ff,DISPLAY_PIXEL_FORMAT_8888); DrawEllipse(50,50,9,19,0x3f0000ff,DISPLAY_PIXEL_FORMAT_8888); EndScene(); }
static bool HHVM_METHOD(ImagickDraw, ellipse, double ox, double oy, double rx, double ry, double start, double end) { auto wand = getDrawingWandResource(Object{this_}); DrawEllipse(wand->getWand(), ox, oy, rx, ry, start, end); return true; }
int draw(Display *display,int num, int mouseX, int mouseY) { double angle1, angle2; double dx,dy; double tx,ty; double cosa, sina; double x,y,x2,y2; x = pupils[num]; y = pupils[num+1]; x2 = eyes[num]; y2 = eyes[num+1]; DrawEllipse(display, (int)eyes[num], (int)eyes[num+1], EYE_W, EYE_H); PushStyle(display); Fill1i(display, 0); dx = (double)mouseX - x; dy = (double)mouseY - y; angle1 = atan2(dy,dx); cosa = cos(angle1); sina = sin(angle1); tx = mouseX - cosa * EYE_RAD; ty = mouseY - sina * EYE_RAD; dx = tx - x2; dy = ty - y2; angle2 = atan2(dy,dx); cosa = cos(angle2); sina = sin(angle2); x = x2 + cosa * EYE_RAD; y = y2 + sina * EYE_RAD; PushMatrix(display); Translate2f(display,x, y); Rotate(display, angle1); DrawEllipse(display, EYE_RAD, 0, PUPIL_W, PUPIL_W); PopMatrix(display); pupils[num] = x; pupils[num+1] = y; PopStyle(display); return 0; }
void RenderCallback() { // Clear buffers glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); ProcessCameraKeys(); SetupCamera(); UpdateEmitterPosition(); if (gScene && !bPause) { GetPhysicsResults(); ProcessInputs(); StartPhysics(); } // Display scene RenderActors(bShadows); RenderFluid(); if (bForceMode) DrawForce(gSelectedActor, gForceVec, NxVec3(1,1,0)); else DrawForce(gSelectedActor, gForceVec, NxVec3(0,1,1)); gForceVec = NxVec3(0,0,0); if (bEmitterWireframe) { NxMat34 fluidEmitterMat = fluidEmitter->getGlobalPose(); NxVec3 fluidEmitterPos, fluidEmitterDir; fluidEmitterPos = fluidEmitterMat.t; fluidEmitterMat.M.getColumn(2,fluidEmitterDir); DrawArrow(fluidEmitterPos, fluidEmitterPos + fluidEmitterDir, NxVec3(0,0,1)); DrawEllipse(20, fluidEmitter->getGlobalPose(), NxVec3(0.5,0,0.5), fluidEmitter->getDimensionX(), fluidEmitter->getDimensionY()); } if (!bPause) { if (gDeltaTime < 10) gTotalTime += gDeltaTime; } // Render HUD hud.Render(); glFlush(); glutSwapBuffers(); }
void RenderVector(int frameNumber) { CanvasT *canvas = R_("Canvas"); PointT *toDraw = R_("TriangleToDraw"); MatrixStack2D *ms = R_("ms2d"); float s = sin(frameNumber * 3.14159265f / 22.5f); float c = cos(frameNumber * 3.14159265f / 45.0f); StackReset(ms); PushTranslation2D(ms, -1.5f, -1.5f); PushScaling2D(ms, 20.0f + 10.0f * s, 20.0f + 10.0f * s); PushRotation2D(ms, (float)(frameNumber * -3)); PushTranslation2D(ms, (float)(WIDTH/2) + c * (WIDTH/4), (float)(HEIGHT/2)); Transform2D(R_("CrossToDraw"), R_("Cross"), 12, GetMatrix2D(ms, 0)); if (effect == 0) { CanvasFill(canvas, 0); DrawPolyLine(canvas, R_("CrossToDraw"), 12, TRUE); } StackReset(ms); PushTranslation2D(ms, 5.0f, 10.0f); PushScaling2D(ms, 2.5f, 2.5f); PushRotation2D(ms, (float)(frameNumber*5*c)); PushTranslation2D(ms, WIDTH/2 + c * 50, HEIGHT/2 + s * 20); Transform2D(R_("TriangleToDraw"), R_("Triangle"), 3, GetMatrix2D(ms, 0)); frameNumber &= 255; if (frameNumber < 128) canvas->fg_col = frameNumber * 2; else canvas->fg_col = (255 - frameNumber) * 2; if (effect == 1) { DrawTriangle(canvas, toDraw[0].x, toDraw[0].y, toDraw[1].x, toDraw[1].y, toDraw[2].x, toDraw[2].y); } if (effect == 2) { DrawEllipse(canvas, toDraw[1].x, toDraw[1].y, 30 + c * 15, 30 + s * 15); } }
static void Render(int frameNumber) { PointT *toDraw = triangleToDraw; float s = sin(frameNumber * 3.14159265f / 22.5f); float c = cos(frameNumber * 3.14159265f / 45.0f); StackReset(ms); PushTranslation2D(ms, -1.5f, -1.5f); PushScaling2D(ms, 20.0f + 10.0f * s, 20.0f + 10.0f * s); PushRotation2D(ms, (float)(frameNumber * -3)); PushTranslation2D(ms, (float)(WIDTH/2) + c * (WIDTH/4), (float)(HEIGHT/2)); Transform2D(crossToDraw, cross, 12, GetMatrix2D(ms, 0)); if (effect == 0) { PixBufClear(canvas); DrawPolyLine(canvas, crossToDraw, 12, TRUE); } StackReset(ms); PushTranslation2D(ms, 5.0f, 10.0f); PushScaling2D(ms, 2.5f, 2.5f); PushRotation2D(ms, (float)(frameNumber*5*c)); PushTranslation2D(ms, WIDTH/2 + c * 50, HEIGHT/2 + s * 20); Transform2D(triangleToDraw, triangle, 3, GetMatrix2D(ms, 0)); frameNumber &= 255; if (frameNumber < 128) canvas->fgColor = frameNumber * 2; else canvas->fgColor = (255 - frameNumber) * 2; if (effect == 1) { TriPoint p1 = { toDraw[0].x, toDraw[0].y }; TriPoint p2 = { toDraw[1].x, toDraw[1].y }; TriPoint p3 = { toDraw[2].x, toDraw[2].y }; DrawTriangle(canvas, &p1, &p2, &p3); } if (effect == 2) { DrawEllipse(canvas, toDraw[1].x, toDraw[1].y, 30 + c * 15, 30 + s * 15); } c2p1x1_8_c5_bm(canvas->data, GetCurrentBitMap(), WIDTH, HEIGHT, 0, 0); }
/* {{{ proto GmagickDraw GmagickDraw::ellipse(float ox, float oy, float rx, float ry, float start, float end) Draws an ellipse on the image. */ PHP_METHOD(gmagickdraw, ellipse) { double ox, oy, rx, ry, start, end; php_gmagickdraw_object *internd; /* Parse parameters given to function */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &ox, &oy, &rx, &ry, &start, &end) == FAILURE) { return; } internd = (php_gmagickdraw_object *)zend_object_store_get_object(getThis() TSRMLS_CC); DrawEllipse(internd->drawing_wand, ox, oy, rx, ry, start, end); GMAGICK_CHAIN_METHOD; }
void Particle::Draw(void) { RECT r; float drawRadius = max(2, fRadius); SetRect(&r, vPosition.x - drawRadius, _WINHEIGHT - (vPosition.y - drawRadius), vPosition.x + drawRadius, _WINHEIGHT - (vPosition.y + drawRadius)); DrawEllipse(&r, 2, RGB(0,0,255)); if(ShowVectors) { Vector v, u; double f = 0.025; DrawLine(vPosition.x, vPosition.y, vPosition.x + vVelocity.x, vPosition.y + vVelocity.y, 3, RGB(0,255,0)); } }
main() { int BaseRadius, Temp, Color; union REGS Regs; /* Select EGA's hi-res 640x350 graphics mode, mode 10h */ Regs.x.ax = 0x0010; int86(0x10, &Regs, &Regs); /* Draw concentric ellipses */ for ( BaseRadius = 2, Color = 7; BaseRadius < 58; BaseRadius++ ) { DrawEllipse(640/2, 350/2, BaseRadius*4, BaseRadius*3, Color); Color = (Color + 1) & 0x0F; /* cycle through 16 colors */ } /* Wait for a key, restore text mode, and done */ scanf("%c", &Temp); Regs.x.ax = 0x0003; int86(0x10, &Regs, &Regs); }
void CTrack::DrawHandle(HDC hDC, CRect* pRect, bool fCircle, bool bOn) { if (fCircle) { DrawEllipse(hDC, pRect, bOn); return; } if (m_bDrawBars) { DrawRect(hDC, pRect, bOn); return; } for (int y = pRect->top; y <= pRect->bottom; ++y) { DrawLine(hDC, pRect->left, y, pRect->right+1, y, bOn); } }
Mover () : Sketch () { width = 8.0; velocity = Vect (0, 0, 0); top_speed = 3.0; // store feld dimenions and orientation SpaceFeld *f = Feld (); loc = f -> Loc (); over = f -> Over (); up = f -> Up (); norm = f -> Norm (); wid = f -> Width (); hei = f -> Height (); SlapOnFeld (); // draw SetStroked (false); SetFillColor (Color (1, 1, 1)); DrawEllipse (Vect (0, 0, 0), width, width); }
VOID DrawEllipseProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { RECT windowRect; switch (message) { case WM_LBUTTONDOWN: { p1.x = GET_X_LPARAM(lParam); p1.y = GET_Y_LPARAM(lParam); //p2_ancien = p2 = p1; enTrainDessin = TRUE; break; } case WM_MOUSEMOVE: { if (wParam&MK_LBUTTON) { p2.x = GET_X_LPARAM(lParam); p2.y = GET_Y_LPARAM(lParam); GetWindowRect(hWnd, &windowRect); InvalidateRect(hWnd, &windowRect, FALSE); UpdateWindow(hWnd); } break; } case WM_LBUTTONUP: //Tiến hành cho vẽ lên bitmap HDC hdc = GetDC(hWnd); HDC memDC = CreateCompatibleDC(hdc); SelectObject(memDC, hBitmap); DrawEllipse(memDC); DeleteObject(memDC); ReleaseDC(hWnd, hdc); enTrainDessin = FALSE; break; } }
main() { int XRadius, YRadius, Temp, Color, i; union REGS Regs; /* Select VGA's hi-res 640x480 graphics mode, mode 12h */ Regs.x.ax = 0x0012; int86(0x10, &Regs, &Regs); /* Repeat 10 times */ for ( i = 0; i < 10; i++ ) { /* Draw nested ellipses */ for ( XRadius = 319, YRadius = 1, Color = 7; YRadius < 240; XRadius -= 1, YRadius += 2 ) { DrawEllipse(640/2, 480/2, XRadius, YRadius, Color); Color = (Color + 1) & 0x0F; /* cycle through 16 colors */ } } /* Wait for a key, restore text mode, and done */ scanf("%c", &Temp); Regs.x.ax = 0x0003; int86(0x10, &Regs, &Regs); }
void DrawEllipses(cOsd *Osd) { int xa = 0; int ya = 0; int xb = Osd->Width() - 1; int yb = Osd->Height() - 1; int x0 = xa; int x5 = xb; int x1 = x0 + (xb - xa) / 5; int x2 = x0 + (xb - xa) * 2 / 5; int x3 = x0 + (xb - xa) * 3 / 5; int x4 = x0 + (xb - xa) * 4 / 5; int y0 = ya; int y4 = yb; int y2 = (y0 + y4) / 2; int y1 = (y0 + y2) / 2; int y3 = (y2 + y4) / 2; Osd->DrawRectangle(xa, ya, xb, yb, clrGray50); DrawEllipse(Osd, x4, y0, x5, y4, 0); DrawEllipse(Osd, x2, y1, x3, y2, 1); DrawEllipse(Osd, x1, y1, x2, y2, 2); DrawEllipse(Osd, x1, y2, x2, y3, 3); DrawEllipse(Osd, x2, y2, x3, y3, 4); DrawEllipse(Osd, x3, y1, x4, y3, 5); DrawEllipse(Osd, x1, y0, x3, y1, 6); DrawEllipse(Osd, x0, y1, x1, y3, 7); DrawEllipse(Osd, x1, y3, x3, y4, 8); DrawEllipse(Osd, x3, y0, x4, y1, -1); DrawEllipse(Osd, x0, y0, x1, y1, -2); DrawEllipse(Osd, x0, y3, x1, y4, -3); DrawEllipse(Osd, x3, y3, x4, y4, -4); Osd->Flush(); }
LONG Blank( PrefObject *Prefs ) { LONG ToFrontCount = 0, Wid, Hei, Drops, x, y, r, i, incr, RetVal = OK; struct RastPort *Rast; struct Screen *Scr; struct Window *Wnd; Drops = Prefs[0].po_Level; Scr = OpenScreenTags( 0L, SA_Depth, Prefs[2].po_Depth, SA_Quiet, TRUE, SA_Overscan, OSCAN_STANDARD, SA_Behind, TRUE, SA_DisplayID, Prefs[2].po_ModeID, TAG_DONE ); if( Scr ) { Wid = Scr->Width; Hei = Scr->Height; Rast = &( Scr->RastPort ); SetRast( Rast, 0 ); for( i = 0; i < 4; i++ ) SetRGB4(&( Scr->ViewPort ), i, 4 * i, 4 * i, 4 * i ); Wnd = BlankMousePointer( Scr ); ScreenToFront( Scr ); while( RetVal == OK ) { if(!( ++ToFrontCount % 60 )) ScreenToFront( Scr ); if(!( ToFrontCount % Drops )) SetRast(&( Scr->RastPort ), 0 ); r = RangeRand( Wid/13 ) + Wid/25; x = RangeRand( Wid - 2*r ) + r; y = RangeRand( Hei - 2*r ) + r; incr = max( Wid/160, 1 ); for( i = 0; i < r; i += incr ) { WaitTOF(); SetAPen( &Scr->RastPort, ( ULONG )RangeRand(( 1L << Prefs[2].po_Depth ) - 1 ) + 1 ); DrawEllipse(&( Scr->RastPort ), x, y, i, i ); if( i ) { SetAPen(&( Scr->RastPort ), 0 ); DrawEllipse(&( Scr->RastPort ), x, y, i - incr, i - incr ); } } RetVal = ContinueBlanking(); } UnblankMousePointer( Wnd ); } else RetVal = FAILED; if( Scr ) CloseScreen( Scr ); return RetVal; }
void ocpnDC::DrawCircle( wxCoord x, wxCoord y, wxCoord radius ) { DrawEllipse( x - radius, y - radius, 2 * radius, 2 * radius ); }
static void ParseDrawFunction(DviWidget dw, char *buf) { int v[DRAW_ARGS_MAX]; int i, no_move = 0; char *ptr; v[0] = v[1] = v[2] = v[3] = 0; if (buf[0] == '\0') return; ptr = buf+1; for (i = 0; i < DRAW_ARGS_MAX; i++) { if (sscanf(ptr, "%d", v + i) != 1) break; while (*ptr == ' ') ptr++; while (*ptr != '\0' && *ptr != ' ') ptr++; } switch (buf[0]) { case 'l': /* draw a line */ DrawLine(dw, v[0], v[1]); break; case 'c': /* circle */ DrawCircle(dw, v[0]); break; case 'C': DrawFilledCircle(dw, v[0]); break; case 'e': /* ellipse */ DrawEllipse(dw, v[0], v[1]); break; case 'E': DrawFilledEllipse(dw, v[0], v[1]); break; case 'a': /* arc */ DrawArc(dw, v[0], v[1], v[2], v[3]); break; case 'p': DrawPolygon(dw, v, i); break; case 'P': DrawFilledPolygon(dw, v, i); break; case '~': /* wiggly line */ DrawSpline(dw, v, i); break; case 't': dw->dvi.line_thickness = v[0]; break; case 'f': if (i > 0 && v[0] >= 0 && v[0] <= DVI_FILL_MAX) dw->dvi.fill = v[0]; no_move = 1; break; default: #if 0 warning("unknown drawing function %s", buf); #endif no_move = 1; break; } if (!no_move) { if (buf[0] == 'e') { if (i > 0) dw->dvi.state->x += v[0]; } else { while (--i >= 0) { if (i & 1) dw->dvi.state->y += v[i]; else dw->dvi.state->x += v[i]; } } } }
NS_IMETHODIMP nsThebesRenderingContext::DrawEllipse(const nsRect& aRect) { return DrawEllipse(aRect.x, aRect.y, aRect.width, aRect.height); }
void ACanvasSkia::DrawEllipse(int x1,int y1,int x2,int y2) { DrawEllipse(ARect(x1,y1,x2,y2)); }
void hidd_demo(struct ExecBase * SysBase) { D(bug("graphics.hidd = %08.8lx\n",OpenLibrary("graphics.hidd",0))); D(bug("display.hidd = %08.8lx\n",OpenLibrary("display.hidd",0))); OpenLibrary("hidd.gfx.display",0); { struct GfxBase *GfxBase; BOOL success = FALSE; D(bug("init_gfx(hiddbase=%s)\n", "hidd.gfx.display")); GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 37); if (GfxBase) { /* Call private gfx.library call to init the HIDD. Gfx library is responsable for closing the HIDD library (although it will probably not be neccesary). */ D(bug("calling private gfx LateGfxInit()\n")); if (LateGfxInit("hidd.gfx.display")) { struct IntuitionBase *IntuitionBase; D(bug("lategfxinit okay\n")); /* Now that gfx. is guaranteed to be up & working, let intuition open WB screen */ IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 37); D(bug("ibase = %lx\n", IntuitionBase)); if (IntuitionBase) { if (LateIntuiInit(NULL)) { success = TRUE; } CloseLibrary((struct Library *)IntuitionBase); } } D(bug("Closing gfx\n")); CloseLibrary((struct Library *)GfxBase); if (success == FALSE) { D(bug("There is something wrong with hidd subsystem...")); while(1) {}; } } } #if 0 { struct IORequest *io; struct MsgPort *mp; mp=CreateMsgPort(); io=CreateIORequest(mp,sizeof(struct IOStdReq)); D(bug("Result of opening device %d\n", OpenDevice("gameport.device",0,io,0))); D(bug("Doing CMD_HIDDINIT...\n")); { UBYTE *data; data = AllocMem(100, MEMF_PUBLIC); strcpy(data, "hidd.bus.mouse"); ioStd(io)->io_Command=32000; ioStd(io)->io_Data=data; ioStd(io)->io_Length=strlen(data); DoIO(io); D(bug("Got io_ERROR=%d",io->io_Error)); } } #endif { struct IntuitionBase *IntuitionBase; struct GfxBase *GfxBase; struct Window * win = NULL; #define XSTART 50 #define YSTART 50 int x = XSTART; int y = YSTART; IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 37); GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 37); if (IntuitionBase) { struct TagItem tags[] = { {WA_Width, 100}, {WA_Height, 100}, {WA_Left, x}, {WA_Top, y}, {WA_MinWidth, 100}, {WA_MinHeight, 100}, {WA_MaxWidth, 120}, {WA_MaxHeight, 120}, {WA_Title, (ULONG)"AROS Dream :-)"}, {WA_Activate, 1}, {WA_SizeGadget, TRUE}, {WA_DepthGadget, TRUE}, {TAG_DONE, 0}}; win = OpenWindowTagList(0, tags); } DrawEllipse(win->RPort,160/2-35,120/2-4,80/2,80/2); DrawEllipse(win->RPort,185/2-35,90/2-4,15/2,15/2); DrawEllipse(win->RPort,135/2-35,90/2-4,15/2,15/2); Move(win->RPort,125/2-35,140/2-4); Draw(win->RPort,140/2-35,150/2-4); Draw(win->RPort,180/2-35,150/2-4); Draw(win->RPort,195/2-35,140/2-4); #if 0 if (win) { while (x < 100) { MoveWindow(win,1,0); x++; } while (y < 100) { MoveWindow(win,0,1); y++; } while (x > XSTART) { MoveWindow(win,-1,0); x--; } while (y > YSTART) { MoveWindow(win,0,-1); y--; } } #endif #if 0 if (IntuitionBase) { struct Screen *screen; struct Window *win2; struct IntuiMessage *msg; char ScreenInfo[40]; if ((screen = LockPubScreen(NULL))) { struct TagItem tags[] = { {WA_Width, 640}, {WA_Height, 100}, {WA_Left, 0}, {WA_Top, 79}, {WA_MinWidth, 200}, {WA_MinHeight, 100}, {WA_MaxWidth, 640}, {WA_MaxHeight, 480}, {WA_Title, (ULONG)"AROS !ext" }, {WA_Activate, 1}, {WA_CloseGadget, TRUE}, {WA_SizeGadget, TRUE}, {WA_DepthGadget, TRUE}, {WA_IDCMP, IDCMP_CLOSEWINDOW | IDCMP_MOUSEMOVE | IDCMP_RAWKEY}, {WA_ReportMouse, TRUE}, {TAG_DONE, 0}}; win2 = OpenWindowTagList(0, tags); sprintf(ScreenInfo,"ScreenWidth: %d, ScreenHeight: %d", screen->Width, screen->Height); if (win2) { BlackPrint(win2->RPort, ScreenInfo, 40, GfxBase); for(;;) { BOOL quitme = FALSE; WaitPort(win2->UserPort); while((msg = ((struct IntuiMessage *)GetMsg(win2->UserPort)))) { switch(msg->Class) { case IDCMP_RAWKEY: { static char hex[] = "0123456789ABCDEF"; char s[9]; s[0] = 'K'; s[1] = 'e'; s[2] = 'y'; s[3] = ' '; s[4] = hex[(msg->Code >> 12) & 0xF]; s[5] = hex[(msg->Code >> 8) & 0xF]; s[6] = hex[(msg->Code >> 4) & 0xF]; s[7] = hex[(msg->Code >> 0) & 0xF]; s[8] = '\0'; BlackPrint(win2->RPort, s, 60, GfxBase); if (msg->Code == 0x45) quitme = TRUE; } break; case IDCMP_MOUSEMOVE: { WORD mx = win2->WScreen->MouseX; WORD my = win2->WScreen->MouseY; char s[20]; sprintf(s, "Mouse: %4d, %4d", mx, my); WhitePrint(win2->RPort, s, 80, GfxBase); #if 0 mx &= 511; my &= 255; SetAPen(&win2->WScreen->RastPort, 1); SetDrMd(&win2->WScreen->RastPort, JAM2); WritePixel(&win2->WScreen->RastPort, mx, my); #endif } break; case IDCMP_CLOSEWINDOW: { quitme = TRUE; } break; } ReplyMsg((struct Message *)msg); } if (quitme) break; } CloseWindow(win2); } UnlockPubScreen(NULL,screen); } } #endif } }
virtual void _Draw() { DrawEllipse(x0, y0, rx, ry); }
void nsRenderingContext::DrawEllipse(const nsRect& aRect) { DrawEllipse(aRect.x, aRect.y, aRect.width, aRect.height); }
void SvgDeviceContext::DrawCircle(int x, int y, int radius) { DrawEllipse(x - radius, y - radius, 2*radius, 2*radius); }
Drawing drawEllipse( const QPen & pen, const QBrush & brush, const QRectF & rect ) { return DrawEllipse( pen, brush, rect ); }
static MagickBooleanType ScribbleImage (MagickWand *canvas) { DrawingWand *picasso; PixelWand *color; picasso=NewDrawingWand(); color=NewPixelWand(); (void) PushDrawingWand(picasso); { DrawSetViewbox(picasso,0,0,(ssize_t) MagickGetImageWidth(canvas), (ssize_t) MagickGetImageHeight(canvas)); DrawScale(picasso,1.101,1.08); DrawTranslate(picasso,-23.69,-22.97); DrawRotate(picasso,0); (void) PixelSetColor(color,"#ffffff"); DrawSetFillColor(picasso,color); DrawRectangle(picasso,23.69,22.97,564.6,802.2); DrawSetFillAlpha(picasso,1.0); (void) PixelSetColor(color,"none"); DrawSetFillColor(picasso,color); DrawSetStrokeColor(picasso,color); DrawSetStrokeAntialias(picasso,MagickTrue); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); DrawPushDefs(picasso); { DrawPushClipPath(picasso,"clip_1"); { (void) PushDrawingWand(picasso); { DrawRectangle(picasso,0,0,595.3,841.9); } (void) PopDrawingWand(picasso); } DrawPopClipPath(picasso); } DrawPopDefs(picasso); (void) PushDrawingWand(picasso); { (void) DrawSetClipPath(picasso, "url(#clip_1)"); (void) PushDrawingWand(picasso); { DrawSetStrokeAntialias(picasso,MagickTrue); DrawSetStrokeWidth(picasso,4.032); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); (void) PixelSetColor(color,"#ff0000"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); (void) PixelSetColor(color,"#ff00ff"); DrawSetFillColor(picasso,color); DrawRectangle(picasso,72,72,144,144); } (void) PopDrawingWand(picasso); (void) PushDrawingWand(picasso); { DrawSetStrokeAntialias(picasso,MagickTrue); DrawSetStrokeWidth(picasso,9); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); (void) PixelSetColor(color,"#00ff00"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); (void) PixelSetColor(color,"#0080ff"); DrawSetFillColor(picasso,color); DrawRoundRectangle(picasso,72,216,360,432,9,9); } (void) PopDrawingWand(picasso); (void) PushDrawingWand(picasso); { const PointInfo points[37] = { { 378.1,81.72 }, { 381.1,79.56 }, { 384.3,78.12 }, { 387.6,77.33 }, { 391.1,77.11 }, { 394.6,77.62 }, { 397.8,78.77 }, { 400.9,80.57 }, { 403.6,83.02 }, { 523.9,216.8 }, { 526.2,219.7 }, { 527.6,223 }, { 528.4,226.4 }, { 528.6,229.8 }, { 528,233.3 }, { 526.9,236.5 }, { 525.1,239.5 }, { 522.6,242.2 }, { 495.9,266.3 }, { 493,268.5 }, { 489.7,269.9 }, { 486.4,270.8 }, { 482.9,270.9 }, { 479.5,270.4 }, { 476.2,269.3 }, { 473.2,267.5 }, { 470.4,265 }, { 350,131.2 }, { 347.8,128.3 }, { 346.4,125.1 }, { 345.6,121.7 }, {345.4,118.2 }, { 346,114.8 }, { 347.1,111.5 }, { 348.9,108.5 }, { 351.4,105.8 }, { 378.1,81.72 } }; DrawSetStrokeAntialias(picasso,MagickTrue); DrawSetStrokeWidth(picasso,2.016); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); (void) PixelSetColor(color,"#000080"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); (void) PixelSetColor(color,"#c2c280"); DrawSetFillColor(picasso,color); DrawPolygon(picasso,37,points); } (void) PopDrawingWand(picasso); (void) PushDrawingWand(picasso); { DrawSetStrokeAntialias(picasso,MagickTrue); DrawSetStrokeWidth(picasso,3.024); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); (void) PixelSetColor(color,"#000080"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); (void) PixelSetColor(color,"#000080"); DrawSetFillColor(picasso,color); DrawEllipse(picasso,489.6,424.8,72,129.6,0,360); } (void) PopDrawingWand(picasso); (void) PushDrawingWand(picasso); { const PointInfo points[48] = { { 213.8,25.13}, { 216.7,24.48 }, {219.8,24.55 }, { 223.1,25.42 }, { 226.7,27 }, { 230.3,29.3 }, { 234.1,32.26 }, { 237.9,35.86 }, { 241.8,40.03 }, { 249.7,50.11 }, { 257.4,62.14 }, { 264.8,75.89 }, { 271.6,91.15 }, { 277.3,106.8 }, { 281.6,121.8 }, { 284.4,135.9 }, { 285.7,148.5 }, { 285.6,159.6 }, { 284.9,164.3 }, { 283.8,168.5 }, { 282.5,172.1 }, { 280.7,175 }, { 278.5,177.3 }, { 275.9,178.7 }, { 273,179.4 }, { 269.9,179.3 }, { 266.6,178.4 }, { 263.1,176.8 }, { 259.5,174.5}, { 255.7,171.6 }, { 251.9,168 }, { 248,163.8 }, { 244.1,159 }, { 240.1,153.7 }, { 232.3,141.7 }, { 225,127.9 }, { 218.2,112.7 }, { 212.5,97.06 }, { 208.2,82.01 }, { 205.4,67.97 }, { 204,55.3 }, { 204.3,44.35 }, { 204.9,39.6 }, { 205.9,35.42 }, { 207.4,31.82 }, { 209.2,28.87 }, { 211.3,26.64}, { 213.8,25.13 } }; DrawSetStrokeAntialias(picasso,MagickTrue); DrawSetStrokeWidth(picasso,3.024); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); (void) PixelSetColor(color,"#ff8000"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); (void) PixelSetColor(color,"#00ffff"); DrawSetFillColor(picasso,color); DrawPolygon(picasso,48,points); } (void) PopDrawingWand(picasso); (void) PushDrawingWand(picasso); { DrawSetStrokeAntialias(picasso,MagickTrue); DrawSetStrokeWidth(picasso,12.02); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); (void) PixelSetColor(color,"#4000c2"); DrawSetStrokeColor(picasso,color); (void) PixelSetColor(color,"none"); DrawSetFillColor(picasso,color); DrawArc(picasso,360,554.4,187.2,237.6,0,90); } (void) PopDrawingWand(picasso); (void) PushDrawingWand(picasso); { DrawSetStrokeAntialias(picasso,MagickTrue); DrawSetStrokeWidth(picasso,9); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); (void) PixelSetColor(color,"#4000c2"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); (void) PixelSetColor(color,"#4000c2"); DrawSetFillColor(picasso,color); DrawEllipse(picasso,388.8,626.4,100.8,122.4,0,90); } (void) PopDrawingWand(picasso); (void) PushDrawingWand(picasso); { const PointInfo points[6] = { { 180,504 }, { 282.7,578.6 }, { 243.5,699.4 }, { 116.5,699.4 }, { 77.26,578.6 }, { 180,504 } }; DrawSetStrokeAntialias(picasso,MagickTrue); DrawSetStrokeWidth(picasso,9); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); (void) PixelSetColor(color,"#4000c2"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); (void) PixelSetColor(color,"#800000"); DrawSetFillColor(picasso,color); DrawPolygon(picasso,6,points); } (void) PopDrawingWand(picasso); (void) PushDrawingWand(picasso); { const PointInfo points[11] = { { 180,504 }, { 211.8,568.3 }, { 282.7,578.6 }, { 231.3,628.7 }, { 243.5,699.4 }, { 180,666 }, { 116.5,699.4 }, { 128.7,628.7 }, { 77.26,578.6 }, { 148.2,568.3 }, { 180,504 } }; DrawSetStrokeAntialias(picasso,MagickTrue); DrawSetStrokeWidth(picasso,9); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); (void) PixelSetColor(color,"#4000c2"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); (void) PixelSetColor(color,"#800000"); DrawSetFillColor(picasso,color); DrawPolygon(picasso,11,points); } (void) PopDrawingWand(picasso); (void) PushDrawingWand(picasso); { const PointInfo points[15] = { { 540,288 }, { 561.6,216 }, { 547.2,43.2 }, { 280.8,36 }, { 302.4,194.4 }, { 331.2,64.8 }, { 504,64.8 }, { 475.2,115.2 }, { 525.6,93.6 }, { 496.8,158.4 }, { 532.8,136.8 }, { 518.4,180 }, { 540,172.8 }, { 540,223.2 }, { 540,288 } }; DrawSetStrokeAntialias(picasso,MagickTrue); DrawSetStrokeWidth(picasso,5.976); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); (void) PixelSetColor(color,"#4000c2"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); (void) PixelSetColor(color,"#ffff00"); DrawSetFillColor(picasso,color); DrawPolygon(picasso,15,points); } (void) PopDrawingWand(picasso); (void) PushDrawingWand(picasso); { const PointInfo points[7] = { { 57.6,640.8 }, { 57.6,784.8 }, { 194.4,799.2 }, { 259.2,777.6 }, { 151.2,756 }, { 86.4,748.8 }, { 57.6,640.8 } }; DrawSetStrokeAntialias(picasso,MagickTrue); DrawSetStrokeWidth(picasso,5.976); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); (void) PixelSetColor(color,"#4000c2"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); (void) PixelSetColor(color,"#ffff00"); DrawSetFillColor(picasso,color); DrawPolygon(picasso,7,points); } (void) PopDrawingWand(picasso); (void) PushDrawingWand(picasso); { const PointInfo points[193] = { { 27.86,565.3 }, { 29.66,550.8 }, { 31.97,538.1 }, { 34.85,527.1 }, { 38.09,517.7 }, { 41.83,509.8 }, { 45.86,503.1 }, { 50.33,497.6 }, { 55.08,493.2 }, { 60.19,489.8 }, { 65.45,487.3 }, { 70.92,485.4 }, { 76.61,484.2 }, { 88.42,483 }, { 100.4,482.9 }, { 108.4,482.2 }, { 119.8,480.3 }, { 150.8,474.1 }, { 189.4,466.6 }, { 210.3,463 }, { 231.5,459.9 }, { 252.4,457.8 }, { 272.7,456.6 }, { 291.8,456.9 }, { 300.7,457.7 }, { 309.1,458.9 }, { 316.9,460.6 }, { 324.1,462.8 }, { 330.7,465.6 }, { 336.4,469 }, { 341.3,473 }, { 345.3,477.7 }, { 348.4,483.1 }, { 350.4,489.2}, { 352.4,495.4 }, { 355.2,500.9 }, { 358.8,505.8 }, { 363,510 }, { 367.8,513.6 }, { 373,516.8 }, { 378.6,519.6 }, { 384.3,521.8 }, { 396.4,525.4 }, { 408.2,527.9 }, { 428,531.2 }, { 434.6,532.9 }, { 436.7,533.8 }, { 437.8,534.9 }, { 437.8,536.2 }, { 436.8,537.8 }, { 434.5,539.6 }, { 430.9,541.8 }, { 419.3,547.6 }, { 401.3,555.2 }, { 342.4,577.9 }, {325.2,584.9 }, { 311,591.3 }, { 300,597.3 }, { 291.6,602.8 }, { 285.8,607.8 }, { 282.3,612.3 }, { 281.4,614.4 }, { 280.9,616.2 }, { 281.2,619.6 }, { 282.1,621.2 }, { 283.3,622.6 }, { 286.8,624.9 }, { 291.5,626.6 }, { 297.1,627.8 }, { 303.6,628.3 }, { 310.5,628.3 }, { 317.9,627.6 }, { 325.2,626.3 }, { 332.6,624.3 }, { 339.5,621.7 }, { 345.9,618.4 }, { 351.4,614.4 }, { 353.9,612.2 }, { 356,609.8 }, { 357.9,607.1 }, { 359.4,604.3 }, { 360.6,601.3 }, { 361.4,598.2 }, { 361.7,594.9 }, { 361.7,591.3 }, { 361.2,587.7 }, { 360.1,583.7 }, { 358.6,579.7 }, { 356.4,575.4 }, { 353.7,570.9 }, { 350.4,566.2 }, { 346.4,561.3 }, { 341.8,556.2 }, { 336.5,550.9 }, { 330.6,545.5 }, { 323.8,539.8 }, { 316.2,533.9 }, { 298.7,521.5 }, { 277.8,508.2 }, { 256.1,495.5 }, { 236,484.5 }, { 217.7,475.1 }, { 200.8,467.1 }, { 185.6,460.7 }, { 171.9,455.5 }, { 159.6,451.6 }, { 148.6,448.8 }, { 139,447 }, { 130.5,446.2 }, { 123.3,446.2 }, { 117.1,446.9 }, { 112,448.3 }, { 107.9,450.2 }, { 104.8,452.5 }, { 102.5,455.2 }, { 101,458.1 }, { 100.2,461.2 }, { 100.2,464.3 }, { 100.7,467.4 }, { 101.8,470.3 }, { 103.4,473 }, { 105.4,475.3 }, { 107.8,477.1 }, { 110.5,478.4 }, { 113.4,479.1 }, { 116.5,478.9 }, { 119.7,478 }, { 123,476.2 }, { 126.4,473.3 }, { 129.6,469.2 }, { 132.7,463.9 }, { 135.2,458.4 }, { 136.6,453.7 }, { 137,449.9 }, { 136.6,446.8 }, { 135.4,444.5 }, { 133.3,442.9 }, { 130.8,441.9 }, { 127.5,441.4 }, { 123.9,441.6 }, { 119.8,442.3 }, { 110.7,445.1 }, { 101.1,449.5 }, { 91.37,455.2 }, { 82.37,461.9 }, { 74.66,469.2 }, { 71.57,473 }, { 68.98,476.8 }, { 67.03,480.7 }, { 65.81,484.4 }, { 65.45,488.2 }, { 65.95,491.7 }, { 67.46,495.1 }, { 69.98,498.3 }, { 73.66,501.3 }, { 78.55,503.9 }, { 84.82,506.3 }, { 92.38,508.2 }, { 107.1,511.6 }, { 118.2,514.8 }, { 125.9,517.8 }, { 130.7,520.4 }, { 132.1,521.7 }, { 132.8,522.9 }, { 133,524.2 }, { 132.6,525.3 }, { 131.8,526.5 }, { 130.5,527.5 }, { 126.6,529.6 }, { 121.5,531.7 }, { 115.3,533.7 }, { 101.4,537.6 }, { 87.55,541.8 }, { 81.36,544 }, { 76.25,546.3 }, { 71.64,549.5 }, { 66.89,554.1 }, { 62.14,559.8 }, { 57.38,566.1 }, { 48.17,579.6 }, { 39.96,591.4 }, { 36.43,595.9 }, { 34.78,597.6 }, { 33.26,598.8 }, { 31.9,599.6 }, { 30.67,599.9 }, { 29.59,599.7 }, { 28.66,598.8 }, { 27.86,597.4 }, { 27.29,595.2 }, { 26.64,588.7 }, { 26.86,578.8 }, { 27.86,565.3 } }; DrawSetStrokeAntialias(picasso,MagickTrue); DrawSetStrokeWidth(picasso,5.904); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); (void) PixelSetColor(color,"#4000c2"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); (void) PixelSetColor(color,"#ffff00"); DrawSetFillColor(picasso,color); DrawPolygon(picasso,193,points); } (void) PopDrawingWand(picasso); } (void) PopDrawingWand(picasso); } (void) PopDrawingWand(picasso); (void) MagickDrawImage(canvas,picasso); color=DestroyPixelWand(color); picasso=DestroyDrawingWand(picasso); return(MagickTrue); }
LONG Blank( PrefObject *Prefs ) { LONG ToFrontCount = 0, Wid, Hei, Drops, x, y, r, i, incr, RetVal = OK; struct RastPort *Rast; struct Screen *Scr; struct Window *Wnd; LONG d, xs, ys, rs; Drops = Prefs[0].po_Level; Scr = OpenScreenTags( 0L, SA_Depth, Prefs[2].po_Depth, SA_Quiet, TRUE, SA_Overscan, OSCAN_STANDARD, SA_Behind, TRUE, SA_DisplayID, Prefs[2].po_ModeID, SA_ShowTitle, FALSE, SA_Title, "Garshnescreen", TAG_DONE ); if( Scr ) { Wid = Scr->Width; Hei = Scr->Height; d = min( Wid, Hei ); xs = 3 * Wid; ys = 4 * Hei; Rast = &( Scr->RastPort ); SetRast( Rast, 0 ); for( i = 0; i < 4; i++ ) SetRGB4(&( Scr->ViewPort ), i, 4 * i, 4 * i, 4 * i ); Wnd = BlankMousePointer( Scr ); ScreenToFront( Scr ); while( RetVal == OK ) { if(!( ++ToFrontCount % 60 )) ScreenToFront( Scr ); if(!( ToFrontCount % Drops )) SetRast(&( Scr->RastPort ), 0 ); r = RangeRand( d/13 ) + d/25; if( Wid > Hei ) rs = r * xs / ys; else rs = r * ys / xs; x = RangeRand( Wid - 2*rs ) + rs; y = RangeRand( Hei - 2*rs ) + rs; incr = max( Wid/160, 1 ); for( i = 0; i < r; i += incr ) { WaitTOF(); SetAPen( &Scr->RastPort, ( ULONG )RangeRand(( 1L << Prefs[2].po_Depth ) - 1 ) + 1 ); if( Wid > Hei ) { DrawEllipse(&( Scr->RastPort ), x, y, i * xs / ys, i ); if( i ) { SetAPen(&( Scr->RastPort ), 0 ); DrawEllipse(&( Scr->RastPort ), x, y, xs * ( i - incr ) / ys, i - incr ); } } else { DrawEllipse(&( Scr->RastPort ), x, y, i, ys * i / xs ); if( i ) { SetAPen(&( Scr->RastPort ), 0 ); DrawEllipse(&( Scr->RastPort ), x, y, i - incr, ( i - incr ) * ys / xs ); } } } RetVal = ContinueBlanking(); } UnblankMousePointer( Wnd ); } else RetVal = FAILED; if( Scr ) CloseScreen( Scr ); return RetVal; }
void draw_rain(ModeInfo * mi) { dropstruct *drop; rainstruct *rp; if (rain == NULL) return; rp = &rain[MI_SCREEN(mi)]; /* Just in case */ if (rp->drops == NULL) return; if (NRAND(MI_WIDTH(mi) / 4) == 1) InitDropColors(mi, rp); for (drop = rp->drops; drop != NULL; drop = drop->next) { /* Show the drop or show the pool */ if (drop->drop.width < MI_WIDTH(mi) - drop->max_radius && drop->drop.width > drop->max_radius && drop->drop.y < drop->pool.y) { /* Erase the previous drop */ DrawLine(mi, drop->drop, MI_BLACK_PIXEL(mi)); /* Calculate the new position */ drop->drop.x = drop->drop.width; drop->drop.height = drop->drop.y; drop->drop.width += rp->direction * drop->offset.x; drop->drop.y += drop->offset.y; /* Draw the new drop */ DrawLine(mi, drop->drop, drop->color); } else { /* Erase the last drop */ if (drop->radius == 0) { DrawLine(mi, drop->drop, MI_BLACK_PIXEL(mi)); drop->pool.x = drop->drop.width; drop->pool.y = drop->drop.y; } /* Erase the previous pool ellipse */ DrawEllipse(mi, drop, MI_BLACK_PIXEL(mi)); /* Was last pool? Initialise again */ if (drop->radius > drop->max_radius) InitDrop(mi, rp, drop); else { /* Enlarge the pool ellipse */ drop->radius += drop->radius_step; /* Draw the new pool */ DrawEllipse(mi, drop, drop->color); } } } }
// ============================================================================================================================================== // void Orbit::GDIDrawSector(HDC hDC, DWORD color, double w, double h, double size, double start, double end, bool pe, bool ra) { double cx=w/2.0, cy=h/2.0; double x,y; double r=3.0; HPEN spen=CreatePen(PS_SOLID,1,color); HBRUSH brush=CreateSolidBrush(color); HBRUSH brushb=CreateSolidBrush(0); bool ap=pe; double ang = angular_distance(start,end); if (angular_distance(start,limit(trl-lpe))>ang) ra=false; if (angular_distance(start,0.0)>ang) pe=false; if (ecc<1.0) if (angular_distance(start,PI)>ang) ap=false; // HYPERBOLIC ORBIT if (ecc>1.0) { if (length(displacement)>0) { Point(displacement,cx,cy,size,&x,&y); cx=x, cy=y; } double ang = angular_distance(start,end); double mx = MaxTra(); double m = PI2-mx; double am = angular_distance(start,m); bool single=false; if (difference(start,PI)<(PI-mx)) single=true; if (difference(end,PI)<(PI-mx)) single=true; if (ang>am && single==false) { // Dual Sectors GDIDrawHyperbolaSector(hDC, color, cx, cy, w, h, size, start, mx); GDIDrawHyperbolaSector(hDC, color, cx, cy, w, h, size, m, end); } else { //Single Sector if (difference(start,PI)<(PI-mx)) start=m; if (difference(end,PI)<(PI-mx)) end=mx; GDIDrawHyperbolaSector(hDC, color, cx, cy, w, h, size, start, end); } SelectObject(hDC,spen); // Radius if (ra) { Point(Position(trl),cx,cy,size,&x,&y); DrawLine(hDC,x,y,cx,cy,w,h,false); } // Periapsis if (pe) { SelectObject(hDC,brush); Point(Position(lpe),cx,cy,size,&x,&y); DrawEllipse(hDC,x-r,y-r,x+r,y+r,w,h); } } // ELLIPTIC ORBIT if (ecc<1.0) { if (length(displacement)>0) { Point(displacement,cx,cy,size,&x,&y); cx=x, cy=y; } GDIDrawEllipseSector(hDC, color, cx, cy, w, h, size, start, end); SelectObject(hDC,spen); // Radius if (ra) { Point(Position(trl),cx,cy,size,&x,&y); DrawLine(hDC,x,y,cx,cy,w,h,false); } // Periapsis if (pe) { SelectObject(hDC,brush); Point(Position(lpe),cx,cy,size,&x,&y); DrawEllipse(hDC,x-r,y-r,x+r,y+r,w,h); } // Aopapsis if (ap) { SelectObject(hDC,brushb); Point(Position(lpe+PI),cx,cy,size,&x,&y); DrawEllipse(hDC,x-r,y-r,x+r,y+r,w,h); } } SelectObject(hDC,GetStockObject(NULL_BRUSH)); SelectObject(hDC,GetStockObject(WHITE_PEN)); DeleteObject(spen); DeleteObject(brush); DeleteObject(brushb); }
// ============================================================================================================================================== // void SyncMFD::Update(HDC hDC) { int pos; int ld=MFD->LineHeight; int fbp=MFD->FirstButton; char *Mnu = {"BaseSync v3.2\0"}; int width=MFD->width; int height=MFD->height; double w=(double) width; double h=(double) height; int i; VECTOR3 Rot,Off,opos; double obli,trans,per,offset,diff,p,op,t,time,lon,lat; double trl,heading; char name[32]; static const int MAXSOLN = 160; double times[MAXSOLN],diffs[MAXSOLN],heads[MAXSOLN]; int sol_found = 0; double max_diff=1000; bool draw_text=false; Orbit LEO,ShipOrbit,Ecliptic; SetTextColor(hDC,white); SetTextAlign(hDC,TA_LEFT); TextOut(hDC,5,1,Mnu, (int)strlen(Mnu)); if (mode.enc==0) Text(hDC,5,1+ld,"Latitude"); if (mode.enc==1) Text(hDC,5,1+ld,"Closest passage"); if (mode.enc==2) Text(hDC,5,1+ld,"Apoapsis"); if (mode.enc==3) Text(hDC,5,1+ld,"Periapsis"); if (sync_num<1) sync_num=1; if (sync_num>99) sync_num=99; OBJHANDLE ref = oapiGetObjectByName(trgt->ref); if (ref==NULL) { usingGS2 = false; trgt = &bstrgt; ref=ship->GetSurfaceRef(); } if (ref==NULL) return; ShipOrbit.Elements(ship->GetHandle(), ref); Ecliptic.Ecliptic(); oapiGetObjectName(ref, trgt->ref, 31); // Rotation elements obli = oapiGetPlanetObliquity(ref); trans = oapiGetPlanetTheta(ref); per = oapiGetPlanetPeriod(ref); offset = oapiGetPlanetCurrentRotation(ref); // LEO LEO.LEO(ref); if (!usingGS2) { OBJHANDLE tgt = oapiGetBaseByName(ref, trgt->name); if (tgt) { oapiGetObjectName(tgt,trgt->name,32); oapiGetBaseEquPos(tgt,&trgt->lon, &trgt->lat); } else strcpy(trgt->name,"Surface"); } double trle=ShipOrbit.TrlOfNode(&LEO); double EqI=angle(ShipOrbit.norv, LEO.norv); double ang=asin(sin(trgt->lat) / sin(EqI)); double apos=limit(trle+ang); double bpos=limit(trle+PI-ang); double atime=ShipOrbit.TimeTo(apos); double btime=ShipOrbit.TimeTo(bpos); double dist=ShipOrbit.PeriapsisDistance(); double apodist = dist=ShipOrbit.AopapsisDistance(); if (dist<oapiGetSize(ref)) dist=oapiGetSize(ref); double zoom=w/(2.55 * (apodist + apodist + dist) / 3.0); double r=oapiGetSize(ref)*zoom; double x=w/2,y=h/2; double intpos=0; if (display_texts&2) { SelectObject(hDC,solid_pen_dgrey); DrawEllipse(hDC,x-r,y-r,x+r,y+r,w,h); if (mode.enc==0) { // Latitude if ((sync_sel&1)==0) SelectObject(hDC,solid_pen_y), intpos=apos; else SelectObject(hDC,solid_pen_dgrey); r=ShipOrbit.Radius(apos)*zoom; DrawLine(hDC,x,y,x+r*cos(apos),x-r*sin(apos),w,h,false); if ((sync_sel&1)==1) SelectObject(hDC,solid_pen_y), intpos=bpos; else SelectObject(hDC,solid_pen_dgrey); r=ShipOrbit.Radius(bpos)*zoom; DrawLine(hDC,x,y,x+r*cos(bpos),x-r*sin(bpos),w,h,false); } if (mode.enc==1) { // Closest Passage r=ShipOrbit.Radius(sync_trl)*zoom; intpos=sync_trl; SelectObject(hDC,solid_pen_y); DrawLine(hDC,x,y,x+r*cos(sync_trl),x-r*sin(sync_trl),w,h,false); } if (mode.enc==2 || mode.enc==3) { // Aopapsis Periapsis SelectObject(hDC,solid_pen_y); r=ShipOrbit.Radius(sync_trl)*zoom; DrawLine(hDC,x,y,x+r*cos(sync_trl),x-r*sin(sync_trl),w,h,false); SelectObject(hDC,solid_pen_grey); r=ShipOrbit.Radius(sync_line)*zoom; DrawLine(hDC,x,y,x+r*cos(sync_line),x-r*sin(sync_line),w,h,false); } ShipOrbit.SetProjection(&ShipOrbit); ShipOrbit.GDIDraw(hDC,green,w,h,zoom,true,true); if (mode.deo) { r=ShipOrbit.Radius(deo.trlBurn)*zoom; SelectObject(hDC,solid_pen_white); DrawLine(hDC,x,y,x+r*cos(deo.trlBurn),x-r*sin(deo.trlBurn),w,h,false); } } if (EqI>=trgt->lat || mode.enc!=0) { // Usual case... target in range draw_text=true; SetTextColor(hDC,green); pos=(fbp+(ld*8)); if (display_texts&1 && !mode.deo) { if (mode.enc==0) { Text(hDC,5,pos," #: Time:"); Text(hDC,width/2,pos,"Lon Diff:"), pos+=ld; } else { Text(hDC,5,pos," #: Time:"); Text(hDC,5+width/3,pos," Dist:"); Text(hDC,5+width*2/3,pos," Heading:"), pos+=ld; } } if (atime<btime && atime>0) sync_sel=0; else if (btime>0) sync_sel=1; else sync_sel=0; for (i=0;i<MAXSOLN;i++) { times[i]=0; diffs[i]=0; } sync_min = -1; if (ShipOrbit.ecc<1 && mode.enc==0) { for (i=0;i<MAXSOLN;i++) { if (i&1) time=MAX(atime, btime); else time=MIN(atime, btime); if (time==atime) op=apos; else op=bpos; p=(double)i; if (i>1) time+=ShipOrbit.Period()*floor(p/2); t = time/86400; PlanetAxis(obli,trans,offset,per,t,&Rot,&Off); opos=ShipOrbit.Position(op); LonLat(opos,Rot,Off,&lon,&lat); diff=lon-trgt->lon; if (fabs(diff)<max_diff) { max_diff=fabs(diff), sync_time=time, sync_trl=op; sync_min=i; } times[i]=time; diffs[i]=diff; if (time > 0.0 && diff >0.0) { sol_found++; if (sol_found==sync_num) break; } } } max_diff=1e10; if (ShipOrbit.ecc<1 && mode.enc==1) { double posit=ShipOrbit.trl; for (i=0;i<MAXSOLN;i++) { InterpolateClosestPassage(ref,&ShipOrbit,trgt->lon,trgt->lat,posit,&diff,&time,&heading,&trl); posit=trl+PI05; if (diff<max_diff && diff>0) { max_diff=diff, sync_time=time, sync_trl=limit(trl); sync_min=i; } heads[i]=heading; times[i]=time; diffs[i]=diff; if (time > 0.0 && diff >0.0) { sol_found++; if (sol_found==sync_num) break; } } } if (ShipOrbit.ecc<1 && (mode.enc==2 || mode.enc==3)) { for (i=0;i<MAXSOLN;i++) { if (mode.enc==2) sync_line=limit(ShipOrbit.lpe+PI); else sync_line=limit(ShipOrbit.lpe); time=ShipOrbit.TimeTo(sync_line) + ShipOrbit.Period() * (double)i; t = time / 86400.0; PlanetAxis(obli,trans,offset,per,t,&Rot,&Off); VECTOR3 gpv=VectorByLonLat(Rot,Off,trgt->lon,trgt->lat); VECTOR3 pos=ShipOrbit.Position(sync_line); diff = angle(gpv,pos); heading = nangle(pos-gpv,Rot,gpv); ShipOrbit.Longitude(gpv,NULL,NULL,&trl); if (diff<max_diff && diff>0) { max_diff=diff, sync_time=time, sync_trl=limit(trl); sync_min=i; } if (time==0) time=0.1; heads[i]=heading; times[i]=time; diffs[i]=diff; if (time > 0.0 && diff >0.0) { sol_found++; if (sol_found==sync_num) break; } } } // Hyperbolic Orbit if (ShipOrbit.ecc>=1 && (atime>0 || btime>0)) { mode.enc=0; for (i=0;i<2;i++) { if (atime>0 && btime>0) { if (i&1) time=MAX(atime, btime); else time=MIN(atime, btime); } else time=(atime>0 ? atime : btime); op = (time==atime? apos : bpos); p=(double)i; if (i>1) time+=ShipOrbit.Period()*floor(p/2); t = time/86400; PlanetAxis(obli,trans,offset,per,t,&Rot,&Off); opos=ShipOrbit.Position(op); LonLat(opos,Rot,Off,&lon,&lat); diff=lon-trgt->lon; if (fabs(diff)<max_diff) { max_diff=fabs(diff), sync_time=time, sync_trl=op; sync_min=i; } times[i]=time; diffs[i]=diff; if (atime<0 || btime<0) break; } } if (sync_min > -1) { sol.num = sync_min+1; sol.tSol = times[sync_min]; sol.dist = diffs[sync_min]; sol.hdg = heads[sync_min]; sol.dataValid = true; } else { sol.dataValid = false; } double rad=oapiGetSize(ref); int no=0; int disp_i = 1; if (display_texts&1 && !mode.deo) { for (i=0;i<MAXSOLN;i++) { if (i==sync_min) SetTextColor(hDC,lyellow); else SetTextColor(hDC,lgreen); if (times[i]>0.0 && diffs[i]>=0.0) { if (disp_i >= sync_dispmin && disp_i <= sync_dispmin+7) { if (mode.enc==0) { sprintf(name,"%2d: ",disp_i); Text(hDC,5,pos,name,times[i]); TextA(hDC,width/2,pos,"",diffs[i]*DEG), pos+=ld; } else { // enc_mode 1,2,3 no++; sprintf(name,"%2d: ",disp_i); Text(hDC,5,pos,name,times[i]); Text(hDC,5+width/3,pos," ",diffs[i]*rad); TextA(hDC,5+width*2/3,pos," ",heads[i]*DEG), pos+=ld; } } disp_i++; if (disp_i > sync_num) break; } } } sync_sel+=sync_min; } else { // We are in Latitude mode, and the target is outside of our inclination - i.e. no solution sol.dataValid = false; SetTextAlign(hDC,TA_CENTER); SetTextColor(hDC,yellow); pos=(fbp+(ld*8)); Text(hDC,width/2,pos,"Target Out of Range"); pos+=ld; } if (mode.dir) { // Calculate burn for plane change correction in DIRECT mode if (EqI<trgt->lat && mode.enc==0) { double trl; PlanetAxis(obli,trans,offset,per,0,&Rot,&Off); VECTOR3 gpv = VectorByLonLat(Rot,Off,trgt->lon,trgt->lat); ShipOrbit.Longitude(gpv,NULL,NULL,&trl); sync_time=ShipOrbit.TimeTo(trl); sync_trl=trl; } time_to_int=sync_time; double trl=sync_trl; PlanetAxis(obli,trans,offset,per,time_to_int/86400.0,&Rot,&Off); VECTOR3 pos = ShipOrbit.Position(trl); VECTOR3 gpv = VectorByLonLat(Rot,Off,trgt->lon,trgt->lat); VECTOR3 lan = crossp(gpv, pos); VECTOR3 nor = ShipOrbit.norv; ShipOrbit.Longitude(lan,NULL,NULL,&sol.trlBurn); sol.rIn = fabs(asin(dotp(gpv,nor))); double a = ShipOrbit.TimeToPoint(sol.trlBurn); double b = ShipOrbit.TimeToPoint(limit(sol.trlBurn+PI)); if (fabs(a)<fabs(b)) sol.tToBurn =a, sol.nmlBurn=true; else sol.tToBurn =b, sol.nmlBurn=false; sol.dV = sol.rIn*ShipOrbit.ang/ShipOrbit.Radius(sol.trlBurn); sol.tBurn =BurnTimeBydV(sol.dV,ship); } else { // Calculate burn for plane change correction in EQUATORIAL mode sol.trlBurn=ShipOrbit.TrlOfNode(&LEO); sol.rIn=MAX(trgt->lat-EqI,0); double a=ShipOrbit.TimeToPoint(sol.trlBurn); double b=ShipOrbit.TimeToPoint(limit(sol.trlBurn+PI)); if (fabs(a)<fabs(b)) sol.tToBurn =a, sol.nmlBurn=true; else sol.tToBurn =b, sol.nmlBurn=false; sol.dV = sol.rIn*ShipOrbit.ang/ShipOrbit.Radius(sol.trlBurn); sol.tBurn =BurnTimeBydV(sol.dV,ship); } if (display_texts&2) { ShipOrbit.DrawPlaneIntersection(hDC,sol.trlBurn,w/2,h/2,zoom,grey); } SetTextAlign(hDC,TA_LEFT); pos=1; SetTextColor(hDC,grey); if (usingGS2) { Text(hDC,width*1/2,pos,"Linked ","to GS"); pos+=ld; // Check if GS2 changed target if (bstrgt.lat != gs2trgt->lat || bstrgt.lon != gs2trgt->lon) { strcpy(bstrgt.ref, gs2trgt->ref); strcpy(bstrgt.name, gs2trgt->name); bstrgt.lat = gs2trgt->lat; bstrgt.lon = gs2trgt->lon; bstrgt.alt = gs2trgt->alt; bstrgt.ang = gs2trgt->ang; bstrgt.ant = gs2trgt->ant; } } else { Text(hDC,width*1/2,pos,"Ref ",trgt->ref); pos+=ld; } Text(hDC,width*1/2,pos,"Tgt ",trgt->name); pos+=ld; if (display_texts&1) { if (!mode.deo) { // Display the burn solution for plane change deo.dataValid = false; pos=fbp; SetTextColor(hDC,lgreen); if (trgt->lat<0) TextA(hDC,5,pos,"Lat ",fabs(DEG*trgt->lat),"S"), pos+=ld; else TextA(hDC,5,pos,"Lat ",DEG*trgt->lat,"N"), pos+=ld; if (trgt->lon<0) TextA(hDC,5,pos,"Lon ",fabs(DEG*trgt->lon),"W"), pos+=ld; else TextA(hDC,5,pos,"Lon ",DEG*trgt->lon,"E"), pos+=ld; TextA(hDC,5,pos,"EqI ",EqI*DEG), pos+=ld; PlanetAxis(ref,0,&Rot,&Off); VECTOR3 base_pos = VectorByLonLat(Rot,Off,trgt->lon,trgt->lat); VECTOR3 ship_pos; ship->GetRelativePos(ref,ship_pos); VECTOR3 ship_vel; ship->GetRelativeVel(ref,ship_vel); VECTOR3 gsp=GroundSpeedVector(ref,ship); VECTOR3 zero=crossp(ship_pos,ship_vel); double head = nangle(gsp,zero,ship_pos); double baseHeight = oapiGetSize(ref); #if ORBITER_VERSION == 2016 ELEVHANDLE eh = oapiElevationManager(ref); if (eh) { baseHeight += oapiSurfaceElevation(ref, trgt->lon, trgt->lat); } #endif TextA(hDC,5,pos,"Hed ",head*DEG), pos+=ld; Text(hDC,5,pos, "GSp ",length(gsp)), pos+=ld; Text(hDC,5,pos, "Dst ",angle(ship_pos,base_pos)*baseHeight), pos+=ld; if (sol.dataValid) { double altitude = length(ShipOrbit.Position(intpos)); altitude -= baseHeight; Text(hDC,5,pos, "Alt ",altitude); } pos+=ld; pos=fbp; int xx=width/2; SetTextColor(hDC,green); if (mode.dir) Text(hDC,xx,pos,"Direct:"), pos+=ld; else Text(hDC,xx,pos,"Equator:"), pos+=ld; SetTextColor(hDC,lgreen); TextA(hDC,xx,pos,"RIn ",sol.rIn*DEG), pos+=ld; TextA(hDC,xx,pos,"LAN ",sol.trlBurn*DEG), pos+=ld; Text(hDC,xx,pos," Tn ",sol.tToBurn), pos+=ld; if (abs(sol.tBurn) > 0.1) { if (sol.nmlBurn) Text(hDC,xx,pos,"PlC ",sol.tBurn,"s (+)"), pos+=ld; else Text(hDC,xx,pos,"PlC ",sol.tBurn,"s (-)"), pos+=ld; Text(hDC,xx,pos," dV ",sol.dV,"m/s"), pos+=ld; } else { Text(hDC,xx,pos,"PlC 0.000s"), pos+=ld; Text(hDC,xx,pos," dV 0.000m/s"), pos+=ld; } if (sol.dataValid) { burn.dV = sol.dV; burn.orientation = sol.nmlBurn ? 1 : -1; burn.tToInstBurn = sol.tToBurn; burn.dataValid = true; } else { burn.dataValid = false; } } else { // Display the deorbit parameters and burn solution pos=fbp; SetTextColor(hDC,white); Text(hDC,5,pos,"De-Orbit Program"), pos+=2*ld; SetTextColor(hDC,lgreen); if (usingGS2) { Text(hDC,5,pos, "Ang, Ant, Alt from GS"), pos+=ld; TextA(hDC,5,pos,"GS Ang ",trgt->ang*DEG), pos+=ld; TextA(hDC,5,pos,"GS Ant ",trgt->ant*DEG), pos+=ld; Text(hDC,5,pos, "GS Alt ",trgt->alt,"km"), pos+=2*ld; } else { TextA(hDC,5,pos,"Ang ",bstrgt.ang*DEG), pos+=ld; TextA(hDC,5,pos,"Ant ",bstrgt.ant*DEG), pos+=ld; Text(hDC,5,pos, "Alt ",bstrgt.alt,"km"), pos+=2*ld; } double pre; ComputeDeOrbit(ShipOrbit.myy,ShipOrbit.rad,trgt->alt*1000+oapiGetSize(ref),trgt->ang,&pre,&deo.dV); deo.dV=ShipOrbit.vel-deo.dV; deo.trlBurn = limit(sync_trl - trgt->ant - pre); deo.tInstBurn = ShipOrbit.TimeToPoint(deo.trlBurn); deo.tBurn = BurnTimeBydV(deo.dV,ship); deo.tToBurn = deo.tInstBurn - 0.5 * deo.tBurn; Text(hDC,5,pos, "TBn ",deo.tToBurn,"s"), pos+=ld; TextA(hDC,5,pos,"TrL ",deo.trlBurn*DEG), pos+=ld; Text(hDC,5,pos, " dV ",deo.dV,"m/s"), pos+=ld; Text(hDC,5,pos, " BT ",deo.tBurn,"s"), pos+=2*ld; if (ShipOrbit.ecc>0.015) { SetTextColor(hDC,lgreen); Text(hDC,5,pos,"De-orbit burn data only accurate"); pos+=ld; Text(hDC,5,pos,"if your Ecc is 0.015 or less."); pos+=ld; Text(hDC,5,pos,"(If burn complete, please ignore.)"); pos+=ld;pos+=ld; } if (!mode.dir) { SetTextColor(hDC,lgreen); Text(hDC,5,pos,"Use \"Direct\" mode to re-synchronize"); pos+=ld; Text(hDC,5,pos,"the approach after the de-orbit"); } deo.dataValid = true; burn.dV = -deo.dV; burn.orientation = 0; burn.tToInstBurn = deo.tToBurn; burn.dataValid = true; } } if (!MMPut_done) { mma.PutMMStruct("BaseSyncTarget", &bstrgt); mma.PutMMStruct("BaseSyncMode", &mode); mma.PutMMStruct("BaseSyncSolution", &sol); mma.PutMMStruct("BaseSyncDeorbit", &deo); mma.PutMMStruct("BaseSyncBurn", &burn); // To be removed after BTC synchronization if (burn.dataValid) { mma.Put("dv", burn.dV); mma.Put("InstantaneousBurnTime", burn.tToInstBurn); mma.Put("Orientation", burn.orientation); } else { mma.Delete("dv"); mma.Delete("InstantaneousBurnTime"); mma.Delete("Orientation"); } MMPut_done = true; } }