MCPcopy Create free account
hub / github.com/CruiserOne/Astrolog / DrawDash

Function DrawDash

xgeneral.cpp:603–776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

601// is a specified a skip factor, which allows drawing dashed lines.
602
603void DrawDash(int x1, int y1, int x2, int y2, int skip)
604{
605 int x, y, i, dx, dy, xInc, yInc, xInc2, yInc2, d, dInc, z, zMax;
606
607 if (skip < 0)
608 skip = 0;
609 else if (skip > 0 && gs.fThick)
610 skip++;
611#ifdef ISG
612 if (!gi.fFile) {
613 if (!skip) {
614#ifdef X11
615 // For non-dashed X window lines, have the Xlib do it.
616
617 XDrawLine(gi.disp, gi.pmap, gi.gc, x1, y1, x2, y2);
618 // Some XDrawLine implementations don't draw the last pixel.
619 XDrawPoint(gi.disp, gi.pmap, gi.gc, x2, y2);
620 if (gs.fThick) {
621 // Make the line thicker by drawing it four times.
622 XDrawLine(gi.disp, gi.pmap, gi.gc, x1+1, y1, x2+1, y2);
623 XDrawLine(gi.disp, gi.pmap, gi.gc, x1, y1+1, x2, y2+1);
624 XDrawLine(gi.disp, gi.pmap, gi.gc, x1+1, y1+1, x2+1, y2+1);
625 XDrawPoint(gi.disp, gi.pmap, gi.gc, x2+1, y2);
626 XDrawPoint(gi.disp, gi.pmap, gi.gc, x2, y2+1);
627 XDrawPoint(gi.disp, gi.pmap, gi.gc, x2+1, y2+1);
628 }
629#endif
630#ifdef WINANY
631 if (x1 == x2 && y1 == y2) {
632 DrawPoint(x1, y1);
633 return;
634 }
635 MoveTo(wi.hdc, x1, y1);
636 LineTo(wi.hdc, x2, y2);
637 if (wi.nScaleWin > 1)
638 return;
639 if (!gs.fThick) {
640 // For Windows lines, have to manually draw the last pixel.
641 SetPixel(wi.hdc, x2, y2, (COLORREF)gi.kvCur);
642 } else {
643 // Make the line thicker by drawing it four times.
644 i = gi.nScaleT;
645 LineTo(wi.hdc, x2+i, y2);
646 LineTo(wi.hdc, x1+i, y1);
647 LineTo(wi.hdc, x1, y1+i);
648 LineTo(wi.hdc, x2, y2+i);
649 LineTo(wi.hdc, x2+i, y2+i);
650 LineTo(wi.hdc, x1+i, y1+i);
651 LineTo(wi.hdc, x1, y1);
652 }
653#endif
654 return;
655 }
656#ifdef WIN
657 if (skip && wi.nScaleWin > 1)
658 skip = (skip + 2)*wi.nScaleWin + gs.nThickAdjust - 1;
659#endif
660 }

Callers 15

FDrawClipFunction · 0.85
DrawWheelFunction · 0.85
DrawSymbolRingFunction · 0.85
DrawRingFunction · 0.85
DrawAspectLineFunction · 0.85
XChartAstroGraphFunction · 0.85
XChartGridFunction · 0.85
XChartHorizonFunction · 0.85
XChartHorizonSkyFunction · 0.85
XChartSectorFunction · 0.85
XChartMidpointFunction · 0.85
XChartMoonsFunction · 0.85

Calls 8

DrawPointFunction · 0.85
PsLineCapFunction · 0.85
PsDashFunction · 0.85
PsStrokeFunction · 0.85
MetaSelectFunction · 0.85
MetaWordFunction · 0.85
SvgSetColorFunction · 0.85
WireLineFunction · 0.85

Tested by

no test coverage detected