Commit d45ec47e authored by Oleg Korshul's avatar Oleg Korshul

line dash

parent 54e66ab2
......@@ -424,6 +424,10 @@ CPdfPrinter.prototype =
{
return this.DocumentRenderer.p_width(w);
},
p_dash : function(params)
{
// TODO:
},
// brush methods
b_color1 : function(r,g,b,a)
{
......
......@@ -183,6 +183,14 @@ CGraphics.prototype =
}
}
},
p_dash : function(params)
{
if (!this.m_oContext.setLineDash)
return;
this.m_oContext.setLineDash(params ? params : []);
},
// brush methods
b_color1 : function(r,g,b,a)
{
......
......@@ -658,6 +658,14 @@ CShapeDrawer.prototype =
this.p_width(1000 * this.StrokeWidth);
if (this.Ln.prstDash != null && AscCommon.DashPatternPresets[this.Ln.prstDash])
{
var _arr = AscCommon.DashPatternPresets[this.Ln.prstDash].slice();;
for (var indexD = 0; indexD < _arr.length; indexD++)
_arr[indexD] *= this.StrokeWidth;
this.Graphics.p_dash(_arr);
}
if (graphics.IsSlideBoundsCheckerType && !this.bIsNoStrokeAttack)
graphics.LineWidth = this.StrokeWidth;
......@@ -738,6 +746,8 @@ CShapeDrawer.prototype =
{
this.Graphics.m_oContext.globalCompositeOperation = _old_composite;
}
this.Graphics.p_dash(null);
},
p_width : function(w)
......
......@@ -8126,6 +8126,9 @@ CSlideBoundsChecker.prototype =
p_width : function(w)
{
},
p_dash : function(params)
{
},
// brush methods
b_color1 : function(r,g,b,a)
{
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -931,6 +931,9 @@ CTextDrawer.prototype =
}
this.Get_PathToDraw(false, true);
},
p_dash : function(w)
{
},
// brush methods
b_color1 : function(r,g,b,a)
{
......
......@@ -590,6 +590,10 @@ CAutoshapeTrack.prototype =
if (_EpsLine > this.MaxEpsLine)
this.MaxEpsLine = _EpsLine;
},
p_dash : function(params)
{
this.Graphics.p_dash(params);
},
b_color1 : function(r,g,b,a)
{
this.Graphics.b_color1(r,g,b,a);
......
......@@ -2524,7 +2524,7 @@ function BinaryPPTYLoader()
}
case 1:
{
s.SkipRecord();
ln.setPrstDash(this.ReadLineDash());
break;
}
case 2:
......@@ -2594,6 +2594,39 @@ function BinaryPPTYLoader()
return endL;
}
this.ReadLineDash = function()
{
var s = this.stream;
var _rec_start = s.cur;
var _end_rec = _rec_start + s.GetLong() + 4;
var _dash = 6; // solid
s.Skip2(1); // start attributes
while (true)
{
var _at = s.GetUChar();
if (_at == g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
{
_dash = s.GetUChar();
break;
}
default:
break;
}
}
s.Seek2(_end_rec);
return _dash;
}
this.ReadLineJoin = function()
{
var s = this.stream;
......
......@@ -2460,6 +2460,7 @@ function CBinaryFileWriter()
oThis.WriteUChar(g_nodeAttributeEnd);
oThis.WriteRecord2(0, ln.Fill, oThis.WriteUniFill);
oThis.WriteRecord2(1, ln.prstDash, oThis.WriteLineDash);
oThis.WriteRecord1(2, ln.Join, oThis.WriteLineJoin);
oThis.WriteRecord2(3, ln.headEnd, oThis.WriteLineEnd);
oThis.WriteRecord2(4, ln.tailEnd, oThis.WriteLineEnd);
......@@ -2481,6 +2482,16 @@ function CBinaryFileWriter()
oThis.WriteUChar(g_nodeAttributeEnd);
}
this.WriteLineDash = function(dash)
{
if (dash == null || dash === undefined)
return;
oThis.WriteUChar(g_nodeAttributeStart);
oThis._WriteLimit2(0, dash);
oThis.WriteUChar(g_nodeAttributeEnd);
}
this.WriteLineEnd = function(end)
{
oThis.WriteUChar(g_nodeAttributeStart);
......
......@@ -207,6 +207,15 @@ CGraphics.prototype =
}
}
},
p_dash : function(params)
{
if (!this.m_oContext.setLineDash)
return;
this.m_oContext.setLineDash(params ? params : []);
},
// brush methods
b_color1 : function(r,g,b,a)
{
......
......@@ -630,6 +630,14 @@ CShapeDrawer.prototype =
this.StrokeWidth /= 36000.0;
this.p_width(1000 * this.StrokeWidth);
if (this.Ln.prstDash != null && AscCommon.DashPatternPresets[this.Ln.prstDash])
{
var _arr = AscCommon.DashPatternPresets[this.Ln.prstDash].slice();;
for (var indexD = 0; indexD < _arr.length; indexD++)
_arr[indexD] *= this.StrokeWidth;
this.Graphics.p_dash(_arr);
}
if (graphics.IsSlideBoundsCheckerType && !this.bIsNoStrokeAttack)
graphics.LineWidth = this.StrokeWidth;
......@@ -699,6 +707,8 @@ CShapeDrawer.prototype =
{
this.Graphics.CorrectBounds2();
}
this.Graphics.p_dash(null);
},
p_width : function(w)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment