Commit 18becc3a authored by Sergey Luzyanin's avatar Sergey Luzyanin Committed by Alexander.Trofimov

Поменял примененение модификаторов tint, shade, gamma, invGamma.

Поправлен баг с локом правых панелей для залоченныйх автофигур в презентациях
parent 40e2ee5d
......@@ -6611,6 +6611,7 @@ DrawingObjectsController.prototype =
if(!table_props)
{
table_props = new_table_props;
new_table_props.Locked = locked;
if(new_table_props.CellsBackground)
{
if(new_table_props.CellsBackground.Unifill && new_table_props.CellsBackground.Unifill.fill && new_table_props.CellsBackground.Unifill.fill.type !== c_oAscFill.FILL_TYPE_NONE)
......
......@@ -9501,20 +9501,23 @@ function getMaxIdx(arr)
function getArrayFillsFromBase(arrBaseFills, needFillsCount)
{
var ret = [];
var count_base = arrBaseFills.length;
var need_create = parseInt(needFillsCount / count_base) + 1;
var nMaxCycleIdx = parseInt((needFillsCount - 1)/arrBaseFills.length);
for(var i = 0; i < needFillsCount; ++i)
{
var nCycleIdx = ( i / arrBaseFills.length ) >> 0;
var fShadeTint = ( nCycleIdx + 1 ) / (nMaxCycleIdx + 2) * 1.4 - 0.7;
for (var i = 0; i < need_create; i++)
if(fShadeTint < 0)
{
for (var j = 0; j < count_base; j++)
fShadeTint = -(1 + fShadeTint);
}
else
{
var percent = (-70 + 140 * ( (i + 1) / (need_create + 1) )) /100;
var color = CreateUniFillSolidFillWidthTintOrShade(arrBaseFills[j], 1 - percent);
ret.push( color );
fShadeTint = (1 - fShadeTint);
}
var color = CreateUniFillSolidFillWidthTintOrShade(arrBaseFills[i % arrBaseFills.length], fShadeTint);
ret.push(color);
}
ret.splice(needFillsCount, ret.length - needFillsCount);
return ret;
}
......
......@@ -593,6 +593,10 @@ var cd13 = 1.0/3.0;
var cd23 = 2.0/3.0;
var max_hls = 255.0;
var DEC_GAMMA = 2.3;
var INC_GAMMA = 1.0 / DEC_GAMMA;
var MAX_PERCENT = 100000;
function CColorModifiers()
{
this.Mods = [];
......@@ -800,6 +804,36 @@ CColorModifiers.prototype =
return v1;
},
lclRgbCompToCrgbComp: function(value)
{
return (value * MAX_PERCENT / 255);
},
lclCrgbCompToRgbComp: function(value)
{
return (value * 255 / MAX_PERCENT);
},
lclGamma: function(nComp, fGamma)
{
return (Math.pow(nComp/MAX_PERCENT, fGamma)*MAX_PERCENT) >> 0;
},
RgbtoCrgb: function(RGBA)
{
RGBA.R = this.lclGamma(this.lclRgbCompToCrgbComp(RGBA.R), DEC_GAMMA);
RGBA.G = this.lclGamma(this.lclRgbCompToCrgbComp(RGBA.G), DEC_GAMMA);
RGBA.B = this.lclGamma(this.lclRgbCompToCrgbComp(RGBA.B), DEC_GAMMA);
},
CrgbtoRgb: function(RGBA)
{
RGBA.R = this.lclCrgbCompToRgbComp(this.lclGamma(RGBA.R, INC_GAMMA)) >> 0;
RGBA.G = this.lclCrgbCompToRgbComp(this.lclGamma(RGBA.G, INC_GAMMA)) >> 0;
RGBA.B = this.lclCrgbCompToRgbComp(this.lclGamma(RGBA.B, INC_GAMMA)) >> 0;
},
Apply : function(RGBA)
{
if (null == this.Mods)
......@@ -961,52 +995,39 @@ CColorModifiers.prototype =
}
else if (colorMod.name == "shade")
{
/*
RGBA.R = Math.max(0, scRGB_to_sRGB(sRGB_to_scRGB(RGBA.R/255) * val)*255 >> 0);
RGBA.G = Math.max(0, scRGB_to_sRGB(sRGB_to_scRGB(RGBA.G/255) * val)*255 >> 0);
RGBA.B = Math.max(0, scRGB_to_sRGB(sRGB_to_scRGB(RGBA.B/255) * val)*255 >> 0);
*/
this.RgbtoCrgb(RGBA);
if (val < 0) val = 0;
if (val > 1) val = 1;
RGBA.R = (RGBA.R * val) >> 0;
RGBA.G = (RGBA.G * val) >> 0;
RGBA.B = (RGBA.B * val) >> 0;
RGBA.R = ((RGBA.R * val)) >> 0;
RGBA.G = ((RGBA.G * val)) >> 0;
RGBA.B = ((RGBA.B * val)) >> 0;
this.CrgbtoRgb(RGBA);
}
else if (colorMod.name == "tint")
{
/*
if(val > 0)
{
RGBA.R = Math.max(0, scRGB_to_sRGB(1 - (1 - sRGB_to_scRGB(RGBA.R/255)) * val)*255 >> 0);
RGBA.G = Math.max(0, scRGB_to_sRGB(1 - (1 - sRGB_to_scRGB(RGBA.G/255)) * val)*255 >> 0);
RGBA.B = Math.max(0, scRGB_to_sRGB(1 - (1 - sRGB_to_scRGB(RGBA.B/255)) * val)*255 >> 0);
}
else
{
RGBA.R = Math.max(0, scRGB_to_sRGB(1 - (1 - sRGB_to_scRGB(RGBA.R/255)) * (1-val))*255 >> 0);
RGBA.G = Math.max(0, scRGB_to_sRGB(1 - (1 - sRGB_to_scRGB(RGBA.G/255)) * (1-val))*255 >> 0);
RGBA.B = Math.max(0, scRGB_to_sRGB(1 - (1 - sRGB_to_scRGB(RGBA.B/255)) * (1-val))*255 >> 0);
}
*/
this.RgbtoCrgb(RGBA);
if (val < 0) val = 0;
if (val > 1) val = 1;
RGBA.R = (255 - (255 - RGBA.R) * val) >> 0;
RGBA.G = (255 - (255 - RGBA.G) * val) >> 0;
RGBA.B = (255 - (255 - RGBA.B) * val) >> 0;
RGBA.R = ( MAX_PERCENT - (MAX_PERCENT - RGBA.R) * val );
RGBA.G = ( MAX_PERCENT - (MAX_PERCENT - RGBA.G) * val );
RGBA.B = ( MAX_PERCENT - (MAX_PERCENT - RGBA.B) * val );
this.CrgbtoRgb(RGBA);
}
else if (colorMod.name == "gamma")
{
// LO
// 1/2.3 = 0.4347826;
RGBA.R = this.applyGamma(RGBA.R, 0.4347826);
RGBA.G = this.applyGamma(RGBA.G, 0.4347826);
RGBA.B = this.applyGamma(RGBA.B, 0.4347826);
this.RgbtoCrgb(RGBA);
RGBA.R = this.lclGamma(RGBA.R, INC_GAMMA);
RGBA.G = this.lclGamma(RGBA.G, INC_GAMMA);
RGBA.B = this.lclGamma(RGBA.B, INC_GAMMA);
this.CrgbtoRgb(RGBA);
}
else if (colorMod.name == "invGamma")
{
RGBA.R = this.applyGamma(RGBA.R, 2.3);
RGBA.G = this.applyGamma(RGBA.G, 2.3);
RGBA.B = this.applyGamma(RGBA.B, 2.3);
this.RgbtoCrgb(RGBA);
RGBA.R = this.lclGamma(RGBA.R, DEC_GAMMA);
RGBA.G = this.lclGamma(RGBA.G, DEC_GAMMA);
RGBA.B = this.lclGamma(RGBA.B, DEC_GAMMA);
this.CrgbtoRgb(RGBA);
}
}
},
......
......@@ -3210,6 +3210,16 @@ CPresentation.prototype =
return AllFonts;
},
Get_GraphicObjectsProps : function()
{
if(this.Slides[this.CurPage])
{
return this.Slides[this.CurPage].graphicObjects.getDrawingProps();
}
return null;
},
// Обновляем текущее состояние (определяем где мы находимся, картинка/параграф/таблица/колонтитул)
Document_UpdateInterfaceState : function()
{
......@@ -3251,12 +3261,6 @@ CPresentation.prototype =
editor.sync_PrLineSpacingCallBack(para_pr.Spacing);
if(!target_content)
{
//editor.UpdateParagraphProp( para_pr, flag );
//if(selected_objects.length === 1 )
//{
// if ( "undefined" != typeof(para_props.Tabs) && null != para_props.Tabs )
// editor.Update_ParaTab( Default_Tab_Stop, para_props.Tabs );//TODO:
//}
editor.UpdateTextPr(text_pr);
}
......
......@@ -1648,6 +1648,13 @@ asc_docs_api.prototype.sync_Vert = function(vert)
ParaPr.StyleName = "";
var TextPr = editor.WordControl.m_oLogicDocument.Get_Paragraph_TextPr();
var oDrawingProps = editor.WordControl.m_oLogicDocument.Get_GraphicObjectsProps();
if(oDrawingProps.shapeProps && oDrawingProps.shapeProps.locked
|| oDrawingProps.chartProps && oDrawingProps.chartProps.locked
|| oDrawingProps.tableProps && oDrawingProps.tableProps.Locked)
{
ParaPr.Locked = true;
}
ParaPr.Subscript = ( TextPr.VertAlign === AscCommon.vertalign_SubScript ? true : false );
ParaPr.Superscript = ( TextPr.VertAlign === AscCommon.vertalign_SuperScript ? true : false );
ParaPr.Strikeout = TextPr.Strikeout;
......
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