Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
84392f17
Commit
84392f17
authored
Jul 04, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved STROKE_FONT from PAINTER to GAL.
parent
fe6c901a
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
47 additions
and
39 deletions
+47
-39
graphics_abstraction_layer.cpp
common/gal/graphics_abstraction_layer.cpp
+14
-2
stroke_font.cpp
common/gal/stroke_font.cpp
+0
-11
painter.cpp
common/painter.cpp
+0
-6
graphics_abstraction_layer.h
include/gal/graphics_abstraction_layer.h
+29
-1
stroke_font.h
include/gal/stroke_font.h
+0
-7
painter.h
include/painter.h
+0
-5
pcb_painter.cpp
pcbnew/pcb_painter.cpp
+4
-6
pcb_painter.h
pcbnew/pcb_painter.h
+0
-1
No files found.
common/gal/graphics_abstraction_layer.cpp
View file @
84392f17
...
...
@@ -28,12 +28,12 @@
#include <gal/graphics_abstraction_layer.h>
#include <gal/definitions.h>
#include <gal/color4d.h>
using
namespace
KiGfx
;
GAL
::
GAL
()
GAL
::
GAL
()
:
strokeFont
(
this
)
{
// Set the default values for the internal variables
SetIsFill
(
false
);
...
...
@@ -47,6 +47,8 @@ GAL::GAL()
SetCoarseGrid
(
5
);
SetLineWidth
(
1.0
);
SetDepthRange
(
VECTOR2D
(
-
2048
,
2047
)
);
strokeFont
.
LoadNewStrokeFont
(
newstroke_font
,
newstroke_font_bufsize
);
}
...
...
@@ -156,3 +158,13 @@ void GAL::DrawGrid()
SetStrokeColor
(
savedColor
);
}
void
GAL
::
SetTextAttributes
(
const
EDA_TEXT
*
aText
)
{
strokeFont
.
SetGlyphSize
(
VECTOR2D
(
aText
->
GetSize
()
)
);
strokeFont
.
SetHorizontalJustify
(
aText
->
GetHorizJustify
()
);
strokeFont
.
SetVerticalJustify
(
aText
->
GetVertJustify
()
);
strokeFont
.
SetBold
(
aText
->
IsBold
()
);
strokeFont
.
SetItalic
(
aText
->
IsItalic
()
);
strokeFont
.
SetMirrored
(
aText
->
IsMirrored
()
);
}
common/gal/stroke_font.cpp
View file @
84392f17
...
...
@@ -114,17 +114,6 @@ bool STROKE_FONT::LoadNewStrokeFont( const char* const aNewStrokeFont[], int aNe
}
void
STROKE_FONT
::
LoadAttributes
(
const
EDA_TEXT
*
aText
)
{
SetGlyphSize
(
VECTOR2D
(
aText
->
GetSize
()
)
);
SetHorizontalJustify
(
aText
->
GetHorizJustify
()
);
SetVerticalJustify
(
aText
->
GetVertJustify
()
);
SetBold
(
aText
->
IsBold
()
);
SetItalic
(
aText
->
IsItalic
()
);
SetMirrored
(
aText
->
IsMirrored
()
);
}
BOX2D
STROKE_FONT
::
computeBoundingBox
(
const
Glyph
&
aGlyph
,
const
VECTOR2D
&
aGlyphBoundingX
)
const
{
BOX2D
boundingBox
;
...
...
common/painter.cpp
View file @
84392f17
...
...
@@ -25,8 +25,6 @@
*/
#include <painter.h>
#include <gal/stroke_font.h>
#include <newstroke_font.h>
using
namespace
KiGfx
;
...
...
@@ -70,14 +68,11 @@ void RENDER_SETTINGS::Update()
PAINTER
::
PAINTER
(
GAL
*
aGal
)
:
m_gal
(
aGal
),
m_settings
(
NULL
)
{
m_stroke_font
=
new
STROKE_FONT
(
aGal
);
m_stroke_font
->
LoadNewStrokeFont
(
newstroke_font
,
newstroke_font_bufsize
);
}
PAINTER
::~
PAINTER
()
{
delete
m_stroke_font
;
delete
m_settings
;
}
...
...
@@ -85,5 +80,4 @@ PAINTER::~PAINTER()
void
PAINTER
::
SetGAL
(
GAL
*
aGal
)
{
m_gal
=
aGal
;
m_stroke_font
->
SetGAL
(
aGal
);
}
include/gal/graphics_abstraction_layer.h
View file @
84392f17
...
...
@@ -33,8 +33,10 @@
#include <wx/event.h>
#include <math/matrix3x3.h>
#include <gal/color4d.h>
#include <gal/color4d.h>
#include <gal/stroke_font.h>
#include <newstroke_font.h>
namespace
KiGfx
{
...
...
@@ -260,6 +262,29 @@ public:
layerDepth
=
aLayerDepth
;
}
// ----
// Text
// ----
/**
* @brief Draws a vector type text using preloaded Newstroke font.
*
* @param aText is the text to be drawn.
* @param aPosition is the text position in world coordinates.
* @param aRotationAngle is the text rotation angle.
*/
inline
virtual
void
StrokeText
(
const
std
::
string
&
aText
,
const
VECTOR2D
&
aPosition
,
double
aRotationAngle
)
{
strokeFont
.
Draw
(
aText
,
aPosition
,
aRotationAngle
);
}
/**
* @brief Loads attributes of the given text (bold/italic/underline/mirrored and so on).
*
* @param aText is the text item.
*/
virtual
void
SetTextAttributes
(
const
EDA_TEXT
*
aText
);
// --------------
// Transformation
// --------------
...
...
@@ -696,6 +721,9 @@ protected:
VECTOR2D
cursorPosition
;
///< The cursor position
COLOR4D
cursorColor
;
///< Cursor color
/// Instance of object that stores information about how to draw texts
STROKE_FONT
strokeFont
;
/// Compute the scaling factor for the world->screen matrix
inline
void
ComputeWorldScale
()
{
...
...
include/gal/stroke_font.h
View file @
84392f17
...
...
@@ -66,13 +66,6 @@ public:
*/
bool
LoadNewStrokeFont
(
const
char
*
const
aNewStrokeFont
[],
int
aNewStrokeFontSize
);
/**
* @brief Load attributes of a given text, in order to be used during drawing.
*
* @param aText is the text string.
*/
void
LoadAttributes
(
const
EDA_TEXT
*
aText
);
/**
* @brief Draw a string.
*
...
...
include/painter.h
View file @
84392f17
...
...
@@ -40,7 +40,6 @@ class COLORS_DESIGN_SETTINGS;
namespace
KiGfx
{
class
GAL
;
class
STROKE_FONT
;
class
VIEW_ITEM
;
/**
...
...
@@ -231,10 +230,6 @@ protected:
/// commands used to draw (eg. DrawLine, DrawCircle, etc.)
GAL
*
m_gal
;
/// Instance of object that stores information about how to draw texts (including different
/// font display modes [bold/italic/mirror]).
STROKE_FONT
*
m_stroke_font
;
/// Colors and display modes settings that are going to be used when drawing items.
RENDER_SETTINGS
*
m_settings
;
};
...
...
pcbnew/pcb_painter.cpp
View file @
84392f17
...
...
@@ -38,8 +38,6 @@
#include <view/view.h>
#include <pcb_painter.h>
#include <gal/graphics_abstraction_layer.h>
#include <gal/stroke_font.h>
#include <newstroke_font.h>
using
namespace
KiGfx
;
...
...
@@ -482,8 +480,8 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText )
m_gal
->
SetStrokeColor
(
strokeColor
);
m_gal
->
SetLineWidth
(
aText
->
GetThickness
()
);
m_
stroke_font
->
Load
Attributes
(
aText
);
m_
stroke_font
->
Draw
(
std
::
string
(
aText
->
GetText
().
mb_str
()
),
position
,
orientation
);
m_
gal
->
SetText
Attributes
(
aText
);
m_
gal
->
StrokeText
(
std
::
string
(
aText
->
GetText
().
mb_str
()
),
position
,
orientation
);
}
...
...
@@ -495,8 +493,8 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
m_gal
->
SetStrokeColor
(
strokeColor
);
m_gal
->
SetLineWidth
(
aText
->
GetThickness
()
);
m_
stroke_font
->
Load
Attributes
(
aText
);
m_
stroke_font
->
Draw
(
std
::
string
(
aText
->
GetText
().
mb_str
()
),
position
,
orientation
);
m_
gal
->
SetText
Attributes
(
aText
);
m_
gal
->
StrokeText
(
std
::
string
(
aText
->
GetText
().
mb_str
()
),
position
,
orientation
);
}
...
...
pcbnew/pcb_painter.h
View file @
84392f17
...
...
@@ -52,7 +52,6 @@ class PCB_TARGET;
namespace
KiGfx
{
class
GAL
;
class
STROKE_FONT
;
/**
* Class PCB_RENDER_SETTINGS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment