void TaskLook::Initialise() { // Magenta ICAO color is 0x65,0x23,0x1c const Color task_color = Color(0x62,0x4e,0x90); const Color bearing_color = Color(0x3e,0x30,0x5f); const Color isoline_color = bearing_color; oz_current_pen.set(Pen::SOLID, Layout::SmallScale(2), task_color); oz_active_pen.set(Pen::SOLID, Layout::SmallScale(1), task_color); oz_inactive_pen.set(Pen::SOLID, Layout::SmallScale(1), dark_color(task_color)); leg_active_pen.set(Pen::DASH, Layout::Scale(2), task_color); leg_inactive_pen.set(Pen::DASH, Layout::Scale(1), task_color); arrow_pen.set(Layout::Scale(1), task_color); isoline_pen.set(Pen::DASH, Layout::Scale(1), isoline_color); bearing_pen.set(Layout::Scale(2), bearing_color); best_cruise_track_brush.set(bearing_color); best_cruise_track_pen.set(Layout::Scale(1), dark_color(bearing_color)); target_icon.load_big(IDB_TARGET, IDB_TARGET_HD); }
void HorizonRenderer::Draw(Canvas &canvas, const PixelRect &rc, const NMEAInfo &Basic) { /* This feature of having a backup artificial horizon based on inferred orientation from GPS and vario data is useful, and reasonably well tested, but has the issue of potentially invalidating use of XCSoar in FAI contests due to rule ref Annex A to Section 3 (2010 Edition) 4.1.2 "No instruments permitting pilots to fly without visual reference to the ground may be carried on board, even if made unserviceable." The quality of XCSoar's pseudo-AH is arguably good enough that this violates the rule. We need to seek clarification as to whether this is the case or not. */ RasterPoint center; center.y = (rc.top + rc.bottom) / 2; center.x = (rc.left + rc.right) / 2; const int radius = min(rc.right - rc.left, rc.bottom - rc.top) / 2 - Layout::Scale(1); Pen hpHorizonSky(Layout::Scale(1), dark_color(Graphics::skyColor)); Brush hbHorizonSky(Graphics::skyColor); Pen hpHorizonGround(Layout::Scale(1), dark_color(Graphics::GroundColor)); #define fixed_div fixed(1.0 / 50.0) #define fixed_89 fixed_int_constant(89) fixed phi = max(-fixed_89, min(fixed_89, Basic.acceleration.bank_angle.value_degrees())); fixed alpha = fixed_rad_to_deg * acos(max(-fixed_one,min(fixed_one, Basic.acceleration.pitch_angle.value_degrees() * fixed_div))); fixed sphi = fixed_180 - phi; Angle alpha1 = Angle::degrees(sphi - alpha); Angle alpha2 = Angle::degrees(sphi + alpha); // draw sky part canvas.select(hpHorizonSky); canvas.select(hbHorizonSky); canvas.segment(center.x, center.y, radius, alpha2, alpha1, true); // draw ground part canvas.select(hpHorizonGround); canvas.select(Graphics::hbGround); canvas.segment(center.x, center.y, radius, alpha1, alpha2, true); // draw aircraft symbol Pen aircraft_pen(Layout::Scale(2), COLOR_BLACK); canvas.select(aircraft_pen); canvas.line(center.x + radius / 2, center.y, center.x - radius / 2, center.y); canvas.line(center.x, center.y - radius / 4, center.x, center.y); // draw 45 degree dash marks const unsigned rr2p = uround(radius * fixed_sqrt_half) + Layout::Scale(1); const unsigned rr2n = rr2p - Layout::Scale(2); canvas.line(center.x + rr2p, center.y - rr2p, center.x + rr2n, center.y - rr2n); canvas.line(center.x - rr2p, center.y - rr2p, center.x - rr2n, center.y - rr2n); }
RenderObservationZone::RenderObservationZone() :layer(LAYER_SHADE), pen_boundary_current(Pen::SOLID, Layout::SmallScale(2), Graphics::TaskColor), pen_boundary_active(Pen::SOLID, Layout::SmallScale(1), Graphics::TaskColor), pen_boundary_inactive(Pen::SOLID, Layout::SmallScale(1), dark_color(Graphics::TaskColor)) { }
#include "Screen/Layout.hpp" #include "Renderer/AirspaceRendererSettings.hpp" #include "resource.h" #ifdef USE_GDI #include "Screen/GDI/AlphaBlend.hpp" #endif const Color AirspaceLook::colors[] = { COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_YELLOW, COLOR_MAGENTA, COLOR_CYAN, dark_color(COLOR_RED), dark_color(COLOR_GREEN), dark_color(COLOR_BLUE), dark_color(COLOR_YELLOW), dark_color(COLOR_MAGENTA), dark_color(COLOR_CYAN), COLOR_WHITE, COLOR_LIGHT_GRAY, COLOR_GRAY, COLOR_BLACK, }; void AirspaceLook::Initialise(const AirspaceRendererSettings &settings) { for (unsigned i = 0; i < AIRSPACECLASSCOUNT; i++)
void Graphics::Initialise() { /// @todo enhancement: support red/green color blind pilots with adjusted colour scheme LogStartUp(_T("Initialise graphics")); LoadUnitSymbols(); hTerrainWarning.load_big(IDB_TERRAINWARNING, IDB_TERRAINWARNING_HD); hGPSStatus1.load_big(IDB_GPSSTATUS1, IDB_GPSSTATUS1_HD, false); hGPSStatus2.load_big(IDB_GPSSTATUS2, IDB_GPSSTATUS2_HD, false); hLogger.load_big(IDB_LOGGER, IDB_LOGGER_HD); hLoggerOff.load_big(IDB_LOGGEROFF, IDB_LOGGEROFF_HD); hCruise.load_big(IDB_CRUISE, IDB_CRUISE_HD, false); hClimb.load_big(IDB_CLIMB, IDB_CLIMB_HD, false); hFinalGlide.load_big(IDB_FINALGLIDE, IDB_FINALGLIDE_HD, false); hAbort.load_big(IDB_ABORT, IDB_ABORT_HD, false); #ifdef HAVE_HATCHED_BRUSH hAboveTerrainBitmap.load(IDB_ABOVETERRAIN); hAboveTerrainBrush.set(hAboveTerrainBitmap); #endif hpWind.set(Layout::Scale(1), dark_color(COLOR_GRAY)); hpWindTail.set(Pen::DASH, 1, COLOR_BLACK); hbWind.set(COLOR_GRAY); hBmpMapScaleLeft.load_big(IDB_MAPSCALE_LEFT, IDB_MAPSCALE_LEFT_HD, false); hBmpMapScaleRight.load_big(IDB_MAPSCALE_RIGHT, IDB_MAPSCALE_RIGHT_HD, false); hBmpTabTask.load((Layout::scale > 1) ? IDB_TASK_HD : IDB_TASK); hBmpTabWrench.load((Layout::scale > 1) ? IDB_WRENCH_HD : IDB_WRENCH); hBmpTabSettings.load((Layout::scale > 1) ? IDB_SETTINGS_HD : IDB_SETTINGS); hBmpTabCalculator.load((Layout::scale > 1) ? IDB_CALCULATOR_HD : IDB_CALCULATOR); hBmpTabFlight.load((Layout::scale > 1) ? IDB_GLOBE_HD : IDB_GLOBE); hBmpTabSystem.load((Layout::scale > 1) ? IDB_DEVICE_HD : IDB_DEVICE); hBmpTabRules.load((Layout::scale > 1) ? IDB_RULES_HD : IDB_RULES); hBmpTabTimes.load((Layout::scale > 1) ? IDB_CLOCK_HD : IDB_CLOCK); hBmpThermalSource.load_big(IDB_THERMALSOURCE, IDB_THERMALSOURCE_HD); hBmpTrafficSafe.load_big(IDB_TRAFFIC_SAFE, IDB_TRAFFIC_SAFE_HD, false); hBmpTrafficWarning.load_big(IDB_TRAFFIC_WARNING, IDB_TRAFFIC_WARNING_HD, false); hBmpTrafficAlarm.load_big(IDB_TRAFFIC_ALARM, IDB_TRAFFIC_ALARM_HD, false); hbCompass.set(Color(207, 207, 207)); hbFinalGlideBelow.set(COLOR_RED); hpFinalGlideBelow.set(Layout::Scale(1), dark_color(COLOR_RED)); hbFinalGlideBelowLandable.set(COLOR_ORANGE); hpFinalGlideBelowLandable.set(Layout::Scale(1), dark_color(COLOR_ORANGE)); hbFinalGlideAbove.set(COLOR_GREEN); hpFinalGlideAbove.set(Layout::Scale(1), dark_color(COLOR_GREEN)); hpCompass.set(Layout::Scale(1), COLOR_GRAY); hpMapScale.set(Layout::Scale(1), COLOR_BLACK); hpTerrainLine.set(Pen::DASH, Layout::Scale(1), clrSepia); hpTerrainLineThick.set(Pen::DASH, Layout::Scale(2), clrSepia); TracePen.set(2, Color(50, 243, 45)); ContestPen[0].set(Layout::Scale(1)+2, COLOR_RED); ContestPen[1].set(Layout::Scale(1)+1, COLOR_ORANGE); ContestPen[2].set(Layout::Scale(1), COLOR_BLUE); // used for landable rendering hbGreen.set(COLOR_GREEN); hbWhite.set(COLOR_WHITE); hbOrange.set(COLOR_ORANGE); hbLightGray.set(COLOR_LIGHT_GRAY); hbNotReachableTerrain.set(light_color(COLOR_RED)); hbGround.set(GroundColor); hpTrackBearingLine.set(3, COLOR_GRAY); }