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

Function DrawStar

xgeneral.cpp:1739–1798  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1737// works with more than a 16 color palette.
1738
1739void DrawStar(int x, int y, CONST ES *pes)
1740{
1741 KV kv;
1742 int n;
1743
1744 // Determine star color.
1745 if (!gs.fColor)
1746 kv = KvFromKi(gi.kiCur);
1747 else if (pes->ki != kDefault)
1748 kv = KvFromKi(pes->ki);
1749 else {
1750 n = 255 - (int)((pes->mag - rStarLite) / rStarSpan * 224.0);
1751 n = Min(n, 255); n = Max(n, 32);
1752 if (gs.fInverse)
1753 n = 255 - n;
1754 kv = Rgb(n, n, n);
1755 }
1756
1757 // Draw star point.
1758#ifdef WINANY
1759 if (!gi.fFile && wi.nScaleWin <= 1) {
1760 SetPixel(wi.hdc, x, y, (COLORREF)kv);
1761 if (FOdd(gs.nAllStar)) {
1762 SetPixel(wi.hdc, x, y-1, (COLORREF)kv);
1763 SetPixel(wi.hdc, x-1, y, (COLORREF)kv);
1764 SetPixel(wi.hdc, x+1, y, (COLORREF)kv);
1765 SetPixel(wi.hdc, x, y+1, (COLORREF)kv);
1766 }
1767 goto LAfter;
1768 }
1769#endif
1770 if (gi.fFile && gs.ft == ftBmp && gi.fBmp) {
1771 BmpSetXY(&gi.bmp, x, y, kv);
1772 if (FOdd(gs.nAllStar)) {
1773 BmpSetXY(&gi.bmp, x, y-1, kv);
1774 BmpSetXY(&gi.bmp, x-1, y, kv);
1775 BmpSetXY(&gi.bmp, x+1, y, kv);
1776 BmpSetXY(&gi.bmp, x, y+1, kv);
1777 }
1778 goto LAfter;
1779 }
1780 if (pes->ki != kDefault)
1781 DrawColor(pes->ki);
1782 else
1783 DrawColor(KStarB(pes->mag));
1784 if (!FOdd(gs.nAllStar))
1785 DrawPoint(x, y);
1786 else
1787 DrawSpot(x, y);
1788
1789 // Draw star's name label.
1790LAfter:
1791 if (!gs.fLabel || gs.nAllStar < 2)
1792 return;
1793 if (pes->ki != kDefault)
1794 DrawColor(pes->ki);
1795 else
1796 DrawColor(KStarB(pes->mag));

Callers 6

xcharts0.cppFile · 0.85
XChartHorizonFunction · 0.85
XChartHorizonSkyFunction · 0.85
XChartTelescopeFunction · 0.85
XChartOrbitFunction · 0.85
XChartSphereFunction · 0.85

Calls 5

BmpSetXYFunction · 0.85
DrawColorFunction · 0.85
DrawPointFunction · 0.85
DrawSpotFunction · 0.85
DrawSzFunction · 0.85

Tested by

no test coverage detected