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
9e8fb761
Commit
9e8fb761
authored
Dec 12, 2010
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
touch ups mostly to Marco's draw_gerber_screen patch
parent
adb4ad1a
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
137 additions
and
86 deletions
+137
-86
draw_gerber_screen.cpp
gerbview/draw_gerber_screen.cpp
+56
-17
plot_common.h
include/plot_common.h
+62
-57
class_pad.cpp
pcbnew/class_pad.cpp
+5
-1
pcbplot.h
pcbnew/pcbplot.h
+14
-11
No files found.
gerbview/draw_gerber_screen.cpp
View file @
9e8fb761
...
...
@@ -103,45 +103,84 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, int aDrawMode, const wxPo
{
// Because Images can be negative (i.e with background filled in color) items are drawn
// graphic layer per graphic layer, after the background is filled
int
bitmapWidth
,
bitmapHeight
;
aPanel
->
GetClientSize
(
&
bitmapWidth
,
&
bitmapHeight
);
wxBitmap
layerBitmap
(
bitmapWidth
,
bitmapHeight
);
wxMemoryDC
memoryDC
;
memoryDC
.
SelectObject
(
layerBitmap
);
wxColour
bgColor
=
MakeColour
(
g_DrawBgColor
);
wxBrush
bgBrush
(
bgColor
,
wxSOLID
);
for
(
int
layer
=
0
;
layer
<
32
;
layer
++
)
{
if
(
!
GetBoard
()
->
IsLayerVisible
(
layer
)
)
continue
;
GERBER_IMAGE
*
gerber
=
g_GERBER_List
[
layer
];
if
(
gerber
==
NULL
)
// Graphic layer not yet used
continue
;
/* Draw background negative (i.e. in graphic layer color) for negative images:
* Background is drawn here in GR_OR mode because in COPY mode
* all previous graphics will be erased
* Note: items in background color ("Erased" items) are always drawn in COPY mode
* Some artifacts can happen when more than one gerber file is loaded
*/
// Draw each layer into a bitmap first. Negative Gerber
// layers are drawn in background color.
memoryDC
.
SetBackground
(
bgBrush
);
memoryDC
.
Clear
();
if
(
gerber
->
m_ImageNegative
)
{
int
color
=
GetBoard
()
->
GetLayerColor
(
layer
);
GRSetDrawMode
(
aDC
,
GR_OR
);
// Draw background negative (i.e. in graphic layer color) for negative images.
int
color
=
GetBoard
()
->
GetLayerColor
(
layer
);
GRSetDrawMode
(
(
wxDC
*
)
&
memoryDC
,
GR_COPY
);
// GR_COPY is faster than GR_OR
EDA_Rect
*
cbox
=
&
aPanel
->
m_ClipBox
;
GRSFilledRect
(
cbox
,
aDC
,
cbox
->
GetX
(),
cbox
->
GetY
(),
GRSFilledRect
(
cbox
,
(
wxDC
*
)
&
memoryDC
,
cbox
->
GetX
(),
cbox
->
GetY
(),
cbox
->
GetRight
(),
cbox
->
GetBottom
(),
0
,
color
,
color
);
GRSetDrawMode
(
aDC
,
aDrawMode
);
GRSetDrawMode
(
(
wxDC
*
)
&
memoryDC
,
aDrawMode
);
}
int
dcode_hight
light
=
0
;
int
dcode_high
light
=
0
;
if
(
layer
==
m_PcbFrame
->
GetScreen
()
->
m_Active_Layer
)
dcode_high
t
light
=
gerber
->
m_Selected_Tool
;
BOARD_ITEM
*
item
=
GetBoard
()
->
m_Drawings
;
for
(
;
item
;
item
=
item
->
Next
()
)
dcode_highlight
=
gerber
->
m_Selected_Tool
;
for
(
BOARD_ITEM
*
item
=
GetBoard
()
->
m_Drawings
;
item
;
item
=
item
->
Next
()
)
{
GERBER_DRAW_ITEM
*
gerb_item
=
(
GERBER_DRAW_ITEM
*
)
item
;
if
(
gerb_item
->
GetLayer
()
!=
layer
)
if
(
gerb_item
->
GetLayer
()
!=
layer
)
continue
;
int
drawMode
=
aDrawMode
;
if
(
dcode_high
t
light
==
gerb_item
->
m_DCode
)
if
(
dcode_highlight
==
gerb_item
->
m_DCode
)
drawMode
|=
GR_SURBRILL
;
gerb_item
->
Draw
(
aPanel
,
aDC
,
drawMode
);
gerb_item
->
Draw
(
aPanel
,
(
wxDC
*
)
&
memoryDC
,
drawMode
);
}
#if 0
// Use the layer bitmap itself as a mask when blitting.
// The bitmap cannot be referenced by a device context
// when setting the mask.
memoryDC.SelectObject( wxNullBitmap );
layerBitmap.SetMask( new wxMask( layerBitmap, bgColor ) );
memoryDC.SelectObject( layerBitmap );
aDC->Blit( 0, 0, bitmapWidth, bitmapHeight,
(wxDC*)&memoryDC, 0, 0, wxCOPY, true );
#else
// Dick: seems a little faster, crisper
aDC
->
Blit
(
0
,
0
,
bitmapWidth
,
bitmapHeight
,
(
wxDC
*
)
&
memoryDC
,
0
,
0
,
wxOR
,
false
);
#endif
}
m_PcbFrame
->
GetScreen
()
->
ClrRefreshReq
();
...
...
include/plot_common.h
View file @
9e8fb761
This diff is collapsed.
Click to expand it.
pcbnew/class_pad.cpp
View file @
9e8fb761
...
...
@@ -57,7 +57,8 @@ D_PAD::~D_PAD()
*/
int
D_PAD
::
GetMaxRadius
()
const
{
int
x
,
y
,
radius
;
int
x
,
y
;
int
radius
;
switch
(
m_PadShape
&
0x7F
)
{
...
...
@@ -79,6 +80,9 @@ int D_PAD::GetMaxRadius() const
y
=
m_Size
.
y
+
ABS
(
m_DeltaSize
.
x
);
// Remember: m_DeltaSize.x is the m_Size.y change
radius
=
1
+
(
int
)
(
sqrt
(
(
double
)
y
*
y
+
(
double
)
x
*
x
)
/
2
);
break
;
default
:
radius
=
0
;
// quiet compiler
}
return
radius
;
...
...
pcbnew/pcbplot.h
View file @
9e8fb761
...
...
@@ -43,23 +43,26 @@ public:
int
PlotPSColorOpt
;
// True for color Postscript output
bool
Plot_PS_Negative
;
// True to create a negative board ps plot
/
* Flags to enable or disable ploting of various PCB elements. */
/
// Flags to enable or disable ploting of various PCB elements.
bool
Sel_Texte_Reference
;
bool
Sel_Texte_Valeur
;
bool
Sel_Texte_Divers
;
bool
Sel_Texte_Invisible
;
bool
PlotPadsOnSilkLayer
;
/* allows pads on silkscreen */
bool
PlotPadsOnSilkLayer
;
///< allows pads on silkscreen
bool
m_SubtractMaskFromSilk
;
/* id for plot format (see enum PlotFormat in plot_common.h) */
int
PlotFormat
;
int
PlotOrient
;
int
PlotScaleOpt
;
enum
DrillShapeOptT
{
/// id for plot format (see enum PlotFormat in plot_common.h)
int
PlotFormat
;
int
PlotOrient
;
int
PlotScaleOpt
;
enum
DrillShapeOptT
{
NO_DRILL_SHAPE
=
0
,
SMALL_DRILL_SHAPE
=
1
,
FULL_DRILL_SHAPE
=
2
};
DrillShapeOptT
DrillShapeOpt
;
double
Scale
;
double
ScaleAdjX
;
...
...
@@ -70,10 +73,10 @@ private:
public
:
PCB_Plot_Options
();
void
SetOutputDirectory
(
wxString
aDir
)
{
outputDirectory
=
aDir
;
};
wxString
GetOutputDirectory
()
{
return
outputDirectory
;
};
void
SetSubtractMaskFromSilk
(
bool
aSubtract
)
{
m_SubtractMaskFromSilk
=
aSubtract
;
};
bool
GetSubtractMaskFromSilk
()
{
return
m_SubtractMaskFromSilk
;
};
void
SetOutputDirectory
(
wxString
aDir
)
{
outputDirectory
=
aDir
;
};
wxString
GetOutputDirectory
()
{
return
outputDirectory
;
};
void
SetSubtractMaskFromSilk
(
bool
aSubtract
)
{
m_SubtractMaskFromSilk
=
aSubtract
;
};
bool
GetSubtractMaskFromSilk
()
{
return
m_SubtractMaskFromSilk
;
};
};
extern
PCB_Plot_Options
g_pcb_plot_options
;
...
...
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