KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIGFX Namespace Reference

The Cairo implementation of the graphics abstraction layer. More...

Namespaces

namespace  BUILTIN_FONT
 
namespace  DETAIL
 
namespace  PREVIEW
 

Classes

class  ACCELERATING_ZOOM_CONTROLLER
 Class that zooms faster if scroll events happen very close together. More...
 
class  ANCHOR_DEBUG
 View item to draw debug items for anchors. More...
 
class  ANTIALIASING_NONE
 
class  ANTIALIASING_SMAA
 
class  ANTIALIASING_SUPERSAMPLING
 
class  CACHED_CONTAINER
 Class to store VERTEX instances with caching. More...
 
class  CACHED_CONTAINER_GPU
 Specialization of CACHED_CONTAINER that stores data in video memory via memory mapping. More...
 
class  CACHED_CONTAINER_RAM
 Specialization of CACHED_CONTAINER that stores data in RAM. More...
 
class  CAIRO_COMPOSITOR
 
class  CAIRO_GAL
 
class  CAIRO_GAL_BASE
 
class  CAIRO_PRINT_CTX
 Provide a Cairo context created from wxPrintDC. More...
 
class  CAIRO_PRINT_GAL
 
class  COLOR4D
 A color representation with 4 components: red, green, blue, alpha. More...
 
class  COMPOSITOR
 
class  CONSTANT_ZOOM_CONTROLLER
 A CONSTANT_ZOOM_CONTROLLER that zooms by a fixed factor based only on the magnitude of the scroll wheel rotation. More...
 
class  CONSTRUCTION_GEOM
 Shows construction geometry for things like line extensions, arc centers, etc. More...
 
class  DS_PAINTER
 Methods for painting drawing sheet items. More...
 
class  DS_RENDER_SETTINGS
 Store page-layout-specific render settings. More...
 
class  GAL
 Abstract interface for drawing on a 2D-surface. More...
 
class  GAL_CONTEXT_LOCKER
 
class  GAL_DISPLAY_OPTIONS
 
class  GAL_DISPLAY_OPTIONS_OBSERVER
 
class  GAL_DRAWING_CONTEXT
 
class  GAL_PRINT
 Wrapper around GAL to provide information needed for printing. More...
 
class  GAL_SCOPED_ATTRS
 Attribute save/restore for GAL attributes. More...
 
class  GAL_UPDATE_CONTEXT
 
class  GERBVIEW_PAINTER
 Methods for drawing GerbView specific items. More...
 
class  GERBVIEW_RENDER_SETTINGS
 Store GerbView specific render settings. More...
 
class  GL_BITMAP_CACHE
 
class  GPU_CACHED_MANAGER
 
class  GPU_MANAGER
 Class to handle uploading vertices and indices to GPU in drawing purposes. More...
 
class  GPU_NONCACHED_MANAGER
 
class  NONCACHED_CONTAINER
 
class  OPENGL_COMPOSITOR
 
class  OPENGL_GAL
 OpenGL implementation of the Graphics Abstraction Layer. More...
 
class  OPENGL_PRESENTOR
 
class  ORIGIN_VIEWITEM
 
class  PAINTER
 Contains all the knowledge about how to draw graphical object onto any particular output device. More...
 
class  PCB_PAINTER
 Contains methods for drawing PCB-specific items. More...
 
class  PCB_PRINT_PAINTER
 Special flavor of PCB_PAINTER that contains modifications to handle printing options. More...
 
class  PCB_RENDER_SETTINGS
 PCB specific render settings. More...
 
class  PCB_VIEW
 
class  PRINT_CONTEXT
 
class  RENDER_SETTINGS
 Container for all the knowledge about how graphical objects are drawn on any output surface/device. More...
 
class  SCH_PAINTER
 Contains methods for drawing schematic-specific items. More...
 
class  SCH_VIEW
 
class  SHADER
 Provide the access to the OpenGL shaders. More...
 
class  SNAP_INDICATOR
 View item to draw an origin marker with an optional snap type indicator. More...
 
struct  VC_SETTINGS
 Structure to keep VIEW_CONTROLS settings for easy store/restore operations. More...
 
struct  VERTEX
 
class  VERTEX_CONTAINER
 
class  VERTEX_ITEM
 
class  VERTEX_MANAGER
 Class to control vertex container and GPU with possibility of emulating old-style OpenGL 1.0 state machine using modern OpenGL methods. More...
 
class  VIEW
 Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the GAL. More...
 
class  VIEW_CONTROLS
 An interface for classes handling user events controlling the view behavior such as zooming, panning, mouse grab, etc. More...
 
class  VIEW_GROUP
 Extend VIEW_ITEM by possibility of grouping items into a single object. More...
 
class  VIEW_ITEM
 An abstract base class for deriving all objects that can be added to a VIEW. More...
 
class  VIEW_ITEM_DATA
 
class  VIEW_OVERLAY
 
class  VIEW_RTREE
 Implement an non-owning R-tree for fast spatial indexing of VIEW items. More...
 
class  WX_VIEW_CONTROLS
 An implementation of class VIEW_CONTROLS for wxWidgets library. More...
 
class  ZOOM_CONTROLLER
 Handle the response of the zoom scale to external inputs. More...
 

Typedefs

typedef RTree< VIEW_ITEM *, int, 2, double > VIEW_RTREE_BASE
 

Enumerations

enum  RENDER_TARGET {
  TARGET_CACHED = 0 , TARGET_NONCACHED , TARGET_OVERLAY , TARGET_TEMP ,
  TARGETS_NUMBER
}
 RENDER_TARGET: Possible rendering targets. More...
 
enum class  GRID_STYLE { DOTS , LINES , SMALL_CROSS }
 GRID_STYLE: Type definition of the grid style. More...
 
enum class  OPENGL_ANTIALIASING_MODE { NONE , SMAA , SUPERSAMPLING }
 
enum class  CAIRO_ANTIALIASING_MODE { NONE , FAST , GOOD }
 
enum class  GRID_SNAPPING { ALWAYS , WITH_GRID , NEVER }
 
enum  SHADER_TYPE { SHADER_TYPE_VERTEX = GL_VERTEX_SHADER , SHADER_TYPE_FRAGMENT = GL_FRAGMENT_SHADER , SHADER_TYPE_GEOMETRY = GL_GEOMETRY_SHADER }
 Type definition for the shader. More...
 
enum  SHADER_MODE {
  SHADER_NONE = 0 , SHADER_FILLED_CIRCLE = 2 , SHADER_STROKED_CIRCLE = 3 , SHADER_FONT = 4 ,
  SHADER_LINE_A = 5 , SHADER_LINE_B = 6 , SHADER_LINE_C = 7 , SHADER_LINE_D = 8 ,
  SHADER_LINE_E = 9 , SHADER_LINE_F = 10
}
 < Possible types of shaders (keep consistent with the actual shader source in kicad_vert.glsl and kicad_frag.glsl). More...
 
enum  VIEW_UPDATE_FLAGS {
  NONE = 0x00 , APPEARANCE = 0x01 , COLOR = 0x02 , GEOMETRY = 0x04 ,
  LAYERS = 0x08 , INITIAL_ADD = 0x10 , REPAINT = 0x20 , ALL = 0xef
}
 Define the how severely the appearance of the item has been changed. More...
 
enum  VIEW_VISIBILITY_FLAGS { VISIBLE = 0x01 , HIDDEN = 0x02 , OVERLAY_HIDDEN = 0x04 }
 Define the visibility of the item (temporarily hidden, invisible, etc). More...
 

Functions

bool operator== (const COLOR4D &lhs, const COLOR4D &rhs)
 Equality operator, are two colors equal.
 
bool operator!= (const COLOR4D &lhs, const COLOR4D &rhs)
 Not equality operator, are two colors not equal.
 
bool operator< (const COLOR4D &lhs, const COLOR4D &rhs)
 
std::ostream & operator<< (std::ostream &aStream, COLOR4D const &aColor)
 Syntactic sugar for outputting colors to strings.
 
void to_json (nlohmann::json &aJson, const COLOR4D &aColor)
 
void from_json (const nlohmann::json &aJson, COLOR4D &aColor)
 
EESCHEMA_SETTINGSeeconfig ()
 
static LIB_SYMBOLdummy ()
 Used when a LIB_SYMBOL is not found in library to draw a dummy shape.
 
static bool isFieldsLayer (int aLayer)
 
static BOX2I GetTextExtents (const wxString &aText, const VECTOR2D &aPosition, KIFONT::FONT &aFont, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
 
static void strokeText (KIGFX::GAL &aGal, const wxString &aText, const VECTOR2D &aPosition, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
 
static void bitmapText (KIGFX::GAL &aGal, const wxString &aText, const VECTOR2D &aPosition, const TEXT_ATTRIBUTES &aAttrs)
 
static void knockoutText (KIGFX::GAL &aGal, const wxString &aText, const VECTOR2D &aPosition, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
 
static void boxText (KIGFX::GAL &aGal, const wxString &aText, const VECTOR2D &aPosition, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
 
static void drawAltPinModesIcon (GAL &aGal, const VECTOR2D &aPos, double aSize, bool aBaseSelected, bool aRotate, int aExtraLineWidth, const COLOR4D &aColor)
 Draw an alternate pin mode indicator icon.
 
void DrawCross (GAL &aGal, const VECTOR2I &aPosition, int aSize)
 Draw a cross at a given position.
 
void DrawDashedLine (GAL &aGal, const SEG &aSeg, double aDashSize)
 Draw a dashed line.
 

Variables

static constexpr size_t VERTEX_SIZE = sizeof(VERTEX)
 
static constexpr size_t VERTEX_STRIDE = VERTEX_SIZE / sizeof(GLfloat)
 
static constexpr size_t COORD_OFFSET = offsetof(VERTEX, x)
 
static constexpr size_t COORD_SIZE = sizeof(VERTEX::x) + sizeof(VERTEX::y) + sizeof(VERTEX::z)
 
static constexpr size_t COORD_STRIDE = COORD_SIZE / sizeof(GLfloat)
 
static constexpr size_t COLOR_OFFSET = offsetof(VERTEX, r)
 
static constexpr size_t COLOR_SIZE = sizeof(VERTEX::r) + sizeof(VERTEX::g) + sizeof(VERTEX::b) + sizeof(VERTEX::a)
 
static constexpr size_t COLOR_STRIDE = COLOR_SIZE / sizeof(GLubyte)
 
static constexpr size_t SHADER_OFFSET = offsetof(VERTEX, shader)
 
static constexpr size_t SHADER_SIZE = sizeof(VERTEX::shader)
 
static constexpr size_t SHADER_STRIDE = SHADER_SIZE / sizeof(GLfloat)
 
static constexpr size_t INDEX_SIZE = sizeof(GLuint)
 

Detailed Description

The Cairo implementation of the graphics abstraction layer.

View item to draw an origin marker.

Quote from Wikipedia: " Cairo is a software library used to provide a vector graphics-based, device-independent API for software developers. It is designed to provide primitives for 2-dimensional drawing across a number of different backends. "

Cairo offers also backends for PostScript and PDF surfaces. So it can be used for printing of KiCad graphics surfaces as well.

Typedef Documentation

◆ VIEW_RTREE_BASE

typedef RTree<VIEW_ITEM*, int, 2, double> KIGFX::VIEW_RTREE_BASE

Definition at line 36 of file view_rtree.h.

Enumeration Type Documentation

◆ CAIRO_ANTIALIASING_MODE

enum class KIGFX::CAIRO_ANTIALIASING_MODE
strong
Enumerator
NONE 
FAST 
GOOD 

Definition at line 60 of file gal_display_options.h.

◆ GRID_SNAPPING

enum class KIGFX::GRID_SNAPPING
strong
Enumerator
ALWAYS 
WITH_GRID 
NEVER 

Definition at line 67 of file gal_display_options.h.

◆ GRID_STYLE

enum class KIGFX::GRID_STYLE
strong

GRID_STYLE: Type definition of the grid style.

Enumerator
DOTS 

Use dots for the grid.

LINES 

Use lines for the grid.

SMALL_CROSS 

Use small cross instead of dots for the grid.

Definition at line 46 of file gal_display_options.h.

◆ OPENGL_ANTIALIASING_MODE

Enumerator
NONE 
SMAA 
SUPERSAMPLING 

Definition at line 53 of file gal_display_options.h.

◆ RENDER_TARGET

RENDER_TARGET: Possible rendering targets.

Enumerator
TARGET_CACHED 

Main rendering target (cached)

TARGET_NONCACHED 

Auxiliary rendering target (noncached)

TARGET_OVERLAY 

Items that may change while the view stays the same (noncached)

TARGET_TEMP 

Temporary target for drawing in separate layer.

TARGETS_NUMBER 

Number of available rendering targets.

Definition at line 46 of file definitions.h.

◆ SHADER_MODE

< Possible types of shaders (keep consistent with the actual shader source in kicad_vert.glsl and kicad_frag.glsl).

Enumerator
SHADER_NONE 
SHADER_FILLED_CIRCLE 
SHADER_STROKED_CIRCLE 
SHADER_FONT 
SHADER_LINE_A 
SHADER_LINE_B 
SHADER_LINE_C 
SHADER_LINE_D 
SHADER_LINE_E 
SHADER_LINE_F 

Definition at line 45 of file vertex_common.h.

◆ SHADER_TYPE

Type definition for the shader.

Enumerator
SHADER_TYPE_VERTEX 

Vertex shader.

SHADER_TYPE_FRAGMENT 

Fragment shader.

SHADER_TYPE_GEOMETRY 

Geometry shader.

Definition at line 44 of file shader.h.

◆ VIEW_UPDATE_FLAGS

Define the how severely the appearance of the item has been changed.

Enumerator
NONE 

No updates are required.

APPEARANCE 

Visibility flag has changed.

COLOR 

Color has changed.

GEOMETRY 

Position or shape has changed.

LAYERS 

Layers have changed.

INITIAL_ADD 

Item is being added to the view.

REPAINT 

Item needs to be redrawn.

ALL 

All except INITIAL_ADD.

Definition at line 50 of file view_item.h.

◆ VIEW_VISIBILITY_FLAGS

Define the visibility of the item (temporarily hidden, invisible, etc).

Enumerator
VISIBLE 

Item is visible (in general)

HIDDEN 

Item is temporarily hidden (usually in favor of a being drawn from an overlay, such as a SELECTION).

Overrides VISIBLE flag.

OVERLAY_HIDDEN 

Item is temporarily hidden from being drawn on an overlay.

Definition at line 64 of file view_item.h.

Function Documentation

◆ bitmapText()

◆ boxText()

◆ drawAltPinModesIcon()

static void KIGFX::drawAltPinModesIcon ( GAL aGal,
const VECTOR2D aPos,
double  aSize,
bool  aBaseSelected,
bool  aRotate,
int  aExtraLineWidth,
const COLOR4D aColor 
)
static

◆ DrawCross()

void KIGFX::DrawCross ( GAL aGal,
const VECTOR2I aPosition,
int  aSize 
)

Draw a cross at a given position.

Parameters
aGalThe graphics abstraction layer to draw with.
aPositionThe position to draw the cross at.
aSizeThe size of the cross.

Definition at line 33 of file item_drawing_utils.cpp.

References KIGFX::GAL::DrawLine().

Referenced by KIGFX::CONSTRUCTION_GEOM::ViewDraw().

◆ DrawDashedLine()

void KIGFX::DrawDashedLine ( GAL aGal,
const SEG aSeg,
double  aDashSize 
)

Draw a dashed line.

Parameters
aGalThe graphics abstraction layer to draw with.
aSegThe line to draw.
aDashSizeThe size of the dashes.

Definition at line 41 of file item_drawing_utils.cpp.

References SEG::A, SEG::B, BOX2< VECTOR2I >::ByCorners(), ClipLine(), KIGFX::GAL::DrawLine(), KIGFX::GAL::GetWorldScale(), KiROUND(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by KIGFX::CONSTRUCTION_GEOM::ViewDraw().

◆ dummy()

static LIB_SYMBOL * KIGFX::dummy ( )
static

Used when a LIB_SYMBOL is not found in library to draw a dummy shape.

This symbol is a 400 mils square with the text "??"

DEF DUMMY U 0 40 Y Y 1 0 N F0 "U" 0 -350 60 H V F1 "DUMMY" 0 350 60 H V DRAW T 0 0 0 150 0 0 0 ?? S -200 200 200 -200 0 1 0 ENDDRAW ENDDEF

Definition at line 113 of file sch_painter.cpp.

References LIB_SYMBOL::AddDrawItem(), LAYER_DEVICE, EDA_IU_SCALE::MilsToIU(), schIUScale, square(), and text.

Referenced by KIGFX::OPENGL_GAL::CheckFeatures(), and KIGFX::VIEW_CONTROLS::Reset().

◆ eeconfig()

◆ from_json()

KICOMMON_API void KIGFX::from_json ( const nlohmann::json &  aJson,
COLOR4D aColor 
)

Definition at line 288 of file color4d.cpp.

References KIGFX::COLOR4D::SetFromWxString().

◆ GetTextExtents()

◆ isFieldsLayer()

static bool KIGFX::isFieldsLayer ( int  aLayer)
static

◆ knockoutText()

◆ operator!=()

KICOMMON_API bool KIGFX::operator!= ( const COLOR4D lhs,
const COLOR4D rhs 
)

Not equality operator, are two colors not equal.

Definition at line 255 of file color4d.cpp.

◆ operator<()

KICOMMON_API bool KIGFX::operator< ( const COLOR4D lhs,
const COLOR4D rhs 
)

◆ operator<<()

KICOMMON_API std::ostream & KIGFX::operator<< ( std::ostream &  aStream,
COLOR4D const &  aColor 
)

Syntactic sugar for outputting colors to strings.

Definition at line 276 of file color4d.cpp.

References operator<<(), and KIGFX::COLOR4D::ToCSSString().

◆ operator==()

KICOMMON_API bool KIGFX::operator== ( const COLOR4D lhs,
const COLOR4D rhs 
)

Equality operator, are two colors equal.

Definition at line 249 of file color4d.cpp.

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, KIGFX::COLOR4D::g, and KIGFX::COLOR4D::r.

◆ strokeText()

static void KIGFX::strokeText ( KIGFX::GAL aGal,
const wxString &  aText,
const VECTOR2D aPosition,
const TEXT_ATTRIBUTES aAttrs,
const KIFONT::METRICS aFontMetrics 
)
static

◆ to_json()

KICOMMON_API void KIGFX::to_json ( nlohmann::json &  aJson,
const COLOR4D aColor 
)

Definition at line 282 of file color4d.cpp.

References KIGFX::COLOR4D::ToCSSString().

Variable Documentation

◆ COLOR_OFFSET

constexpr size_t KIGFX::COLOR_OFFSET = offsetof(VERTEX, r)
staticconstexpr

◆ COLOR_SIZE

constexpr size_t KIGFX::COLOR_SIZE = sizeof(VERTEX::r) + sizeof(VERTEX::g) + sizeof(VERTEX::b) + sizeof(VERTEX::a)
staticconstexpr

Definition at line 75 of file vertex_common.h.

◆ COLOR_STRIDE

constexpr size_t KIGFX::COLOR_STRIDE = COLOR_SIZE / sizeof(GLubyte)
staticconstexpr

◆ COORD_OFFSET

constexpr size_t KIGFX::COORD_OFFSET = offsetof(VERTEX, x)
staticconstexpr

Definition at line 70 of file vertex_common.h.

Referenced by KIGFX::GPU_CACHED_MANAGER::EndDrawing().

◆ COORD_SIZE

constexpr size_t KIGFX::COORD_SIZE = sizeof(VERTEX::x) + sizeof(VERTEX::y) + sizeof(VERTEX::z)
staticconstexpr

Definition at line 71 of file vertex_common.h.

◆ COORD_STRIDE

constexpr size_t KIGFX::COORD_STRIDE = COORD_SIZE / sizeof(GLfloat)
staticconstexpr

◆ INDEX_SIZE

constexpr size_t KIGFX::INDEX_SIZE = sizeof(GLuint)
staticconstexpr

Definition at line 83 of file vertex_common.h.

◆ SHADER_OFFSET

constexpr size_t KIGFX::SHADER_OFFSET = offsetof(VERTEX, shader)
staticconstexpr

◆ SHADER_SIZE

constexpr size_t KIGFX::SHADER_SIZE = sizeof(VERTEX::shader)
staticconstexpr

Definition at line 80 of file vertex_common.h.

◆ SHADER_STRIDE

constexpr size_t KIGFX::SHADER_STRIDE = SHADER_SIZE / sizeof(GLfloat)
staticconstexpr

◆ VERTEX_SIZE

◆ VERTEX_STRIDE

constexpr size_t KIGFX::VERTEX_STRIDE = VERTEX_SIZE / sizeof(GLfloat)
staticconstexpr

Definition at line 68 of file vertex_common.h.