29 return aDeemph ? 0.5 : 1.0;
40 str << prefix <<
": ";
70 constexpr double aspectRatio = 1.0;
71 constexpr double hdpiSizes[] = { 7, 8, 9, 11, 13, 14, 16 };
72 constexpr double sizes[] = { 8, 10, 12, 14, 15, 16, 18 };
75 double thicknessFactor;
77 double linePitchFactor;
83 height = hdpiSizes[ 3 + aRelativeSize ];
84 thicknessFactor = 0.15;
86 linePitchFactor = 1.7;
90 height = sizes[ 3 + aRelativeSize ];
91 thicknessFactor = 0.20;
93 linePitchFactor = 1.9;
103 textDims.
LinePitch = height * linePitchFactor;
112 return COLOR4D::BLACK;
114 return COLOR4D::WHITE;
120 const wxArrayString& aStrings,
121 bool aDrawingDropShadows )
140 if( aTextQuadrant.
y > 0 )
141 textPos.
y -= textDims.
LinePitch * ( aStrings.size() + 1 );
143 if( aTextQuadrant.
x < 0 )
164 int shadowXoffset = aDrawingDropShadows ? textDims.
ShadowWidth : 0;
170 const float adjust = 1.2f;
171 shadowXoffset *= adjust;
174 textPos.
x -= shadowXoffset;
176 textPos.
x += shadowXoffset;
185 if( aDrawingDropShadows )
192 for(
const wxString& str : aStrings )
wxGLCanvas wrapper for HiDPI/Retina support.
double GetScaleFactor() const
Get the current scale factor.
FONT is an abstract base class for both outline and stroke fonts.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttributes, const METRICS &aFontMetrics) const
Draw a string.
static const METRICS & Default()
A color representation with 4 components: red, green, blue, alpha.
double GetBrightness() const
Returns the brightness value of the color ranged from 0.0 to 1.0.
Attribute save/restore for GAL attributes.
Abstract interface for drawing on a 2D-surface.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
const COLOR4D & GetStrokeColor() const
Get the stroke color.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
double GetWorldScale() const
Get the world scale.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
GR_TEXT_H_ALIGN_T m_Halign
@ LAYER_AUX_ITEMS
Auxiliary items (guides, rule, etc)
KICOMMON_API double ToUserUnit(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
KICOMMON_API wxString GetText(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
COLOR4D GetShadowColor(const COLOR4D &aColor)
void DrawTextNextToCursor(KIGFX::VIEW *aView, const VECTOR2D &aCursorPos, const VECTOR2D &aTextQuadrant, const wxArrayString &aStrings, bool aDrawingDropShadows)
Draw strings next to the cursor.
wxString DimensionLabel(const wxString &prefix, double aVal, const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, bool aIncludeUnits=true)
Get a formatted string showing a dimension to a sane precision with an optional prefix and unit suffi...
double PreviewOverlayDeemphAlpha(bool aDeemph=true)
Default alpha of "de-emphasised" features (like previously locked-in lines.
TEXT_DIMS GetConstantGlyphHeight(KIGFX::GAL *aGal, int aRelativeSize=0)
Set the GAL glyph height to a constant scaled value, so that it always looks the same on screen.
VECTOR2< int32_t > VECTOR2I