mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-04-07 14:09:12 +08:00
git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48901 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander.Trofimov
parent
8332570c2a
commit
888fe2bc45
@ -653,6 +653,7 @@ function CCommandsType()
|
||||
this.ctBrushTextureMode = 28;
|
||||
this.ctBrushRectable = 29;
|
||||
this.ctBrushRectableEnabled = 30;
|
||||
this.ctBrushGradient = 31;
|
||||
|
||||
// font
|
||||
this.ctFontXML = 40;
|
||||
@ -730,6 +731,12 @@ function CCommandsType()
|
||||
|
||||
var CommandType = new CCommandsType();
|
||||
|
||||
var MetaBrushType = {
|
||||
Solid : 0,
|
||||
Gradient : 1,
|
||||
Texture : 2
|
||||
};
|
||||
|
||||
function CMetafile(width, height)
|
||||
{
|
||||
this.Width = width;
|
||||
@ -750,7 +757,7 @@ function CMetafile(width, height)
|
||||
this.Memory = null;
|
||||
this.VectorMemoryForPrint = null;
|
||||
|
||||
this.BrushTypeSolid = true;
|
||||
this.BrushType = MetaBrushType.Solid;
|
||||
|
||||
// RFonts
|
||||
this.m_oTextPr = null;
|
||||
@ -792,11 +799,11 @@ CMetafile.prototype =
|
||||
// brush methods
|
||||
b_color1 : function(r,g,b,a)
|
||||
{
|
||||
if (this.BrushTypeSolid != true)
|
||||
if (this.BrushType != MetaBrushType.Solid)
|
||||
{
|
||||
this.Memory.WriteByte(CommandType.ctBrushType);
|
||||
this.Memory.WriteLong(1000);
|
||||
this.BrushTypeSolid = true;
|
||||
this.BrushType = MetaBrushType.Solid;
|
||||
}
|
||||
|
||||
if (this.m_oBrush.Color1.R != r || this.m_oBrush.Color1.G != g || this.m_oBrush.Color1.B != b)
|
||||
@ -838,11 +845,11 @@ CMetafile.prototype =
|
||||
|
||||
put_brushTexture : function(src, mode)
|
||||
{
|
||||
if (this.BrushTypeSolid != false)
|
||||
if (this.BrushType != MetaBrushType.Texture)
|
||||
{
|
||||
this.Memory.WriteByte(CommandType.ctBrushType);
|
||||
this.Memory.WriteLong(3008);
|
||||
this.BrushTypeSolid = false;
|
||||
this.BrushType = MetaBrushType.Texture;
|
||||
}
|
||||
|
||||
this.m_oBrush.Color1.R = -1;
|
||||
@ -871,6 +878,63 @@ CMetafile.prototype =
|
||||
this.Memory.WriteByte(write);
|
||||
},
|
||||
|
||||
put_BrushGradient : function(gradFill, points)
|
||||
{
|
||||
this.BrushType = MetaBrushType.Gradient;
|
||||
|
||||
this.Memory.WriteByte(CommandType.ctBrushGradient);
|
||||
|
||||
this.Memory.WriteByte(g_nodeAttributeStart);
|
||||
|
||||
if (gradFill.path != null)
|
||||
{
|
||||
this.Memory.WriteByte(1);
|
||||
this.Memory.WriteByte(gradFill.path);
|
||||
|
||||
this.Memory.WriteDouble(points.x0);
|
||||
this.Memory.WriteDouble(points.y0);
|
||||
this.Memory.WriteDouble(points.x1);
|
||||
this.Memory.WriteDouble(points.y1);
|
||||
this.Memory.WriteDouble(points.r0);
|
||||
this.Memory.WriteDouble(points.r1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Memory.WriteByte(0);
|
||||
if (null == gradFill.lin)
|
||||
{
|
||||
this.Memory.WriteLong(90 * 60000);
|
||||
this.Memory.WriteBool(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Memory.WriteLong(gradFill.lin.angle);
|
||||
this.Memory.WriteBool(gradFill.lin.scale);
|
||||
}
|
||||
|
||||
this.Memory.WriteDouble(points.x0);
|
||||
this.Memory.WriteDouble(points.y0);
|
||||
this.Memory.WriteDouble(points.x1);
|
||||
this.Memory.WriteDouble(points.y1);
|
||||
}
|
||||
|
||||
var _colors = gradFill.colors;
|
||||
this.Memory.WriteByte(2);
|
||||
this.Memory.WriteLong(_colors.length);
|
||||
|
||||
for (var i = 0; i < _colors.length; i++)
|
||||
{
|
||||
this.Memory.WriteLong(_colors[i].pos);
|
||||
|
||||
this.Memory.WriteByte(_colors[i].color.RGBA.R);
|
||||
this.Memory.WriteByte(_colors[i].color.RGBA.G);
|
||||
this.Memory.WriteByte(_colors[i].color.RGBA.B);
|
||||
this.Memory.WriteByte(_colors[i].color.RGBA.A);
|
||||
}
|
||||
|
||||
this.Memory.WriteByte(g_nodeAttributeEnd);
|
||||
},
|
||||
|
||||
transform : function(sx,shy,shx,sy,tx,ty)
|
||||
{
|
||||
if (this.m_oTransform.sx != sx || this.m_oTransform.shx != shx || this.m_oTransform.shy != shy ||
|
||||
@ -1747,6 +1811,11 @@ CDocumentRenderer.prototype =
|
||||
if (0 != this.m_lPagesCount)
|
||||
this.m_arrayPages[this.m_lPagesCount - 1].put_BrushTextureAlpha(alpha);
|
||||
},
|
||||
put_BrushGradient : function(gradFill, points)
|
||||
{
|
||||
if (0 != this.m_lPagesCount)
|
||||
this.m_arrayPages[this.m_lPagesCount - 1].put_BrushGradient(gradFill, points);
|
||||
},
|
||||
|
||||
// функции клиппирования
|
||||
AddClipRect : function(x, y, w, h)
|
||||
|
||||
@ -1190,8 +1190,25 @@ CShapeDrawer.prototype =
|
||||
}
|
||||
else if (_fill.type == FILL_TYPE_GRAD)
|
||||
{
|
||||
var points = this.getGradientPoints(this.min_x, this.min_y, this.max_x, this.max_y, 0, false);
|
||||
return;
|
||||
var points = null;
|
||||
if (_fill.lin)
|
||||
{
|
||||
points = this.getGradientPoints(this.min_x, this.min_y, this.max_x, this.max_y, _fill.lin.angle, _fill.lin.scale);
|
||||
}
|
||||
else if (_fill.path)
|
||||
{
|
||||
var _cx = (this.min_x + this.max_x) / 2;
|
||||
var _cy = (this.min_y + this.max_y) / 2;
|
||||
var _r = Math.max(this.max_x - this.min_x, this.max_y - this.min_y) / 2;
|
||||
|
||||
points = { x0 : _cx, y0 : _cy, x1 : _cx, y1 : _cy, r0 : 1, r1 : _r };
|
||||
}
|
||||
else
|
||||
{
|
||||
points = this.getGradientPoints(this.min_x, this.min_y, this.max_x, this.max_y, 90 * 60000, false);
|
||||
}
|
||||
|
||||
this.Graphics.put_BrushGradient(_fill, points);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user