Commit 79212c99 authored by Alexander.Trofimov's avatar Alexander.Trofimov

add CreateColorFromRGB to api builder

delete duplicate colors
parent 64269ce0
......@@ -103,16 +103,6 @@
this.color = color;
}
/**
* Class representing RGB color
* @constructor
*/
function ApiRGBColor(r, g, b) {
ApiRGBColor.superclass.constructor.call(this, new Asc.asc_CColor(r, g, b));
}
AscCommon.extendClass(ApiRGBColor, ApiColor);
/**
* Returns an object that represents the active sheet
* @memberof Api
......@@ -133,10 +123,10 @@
* @param {byte} r
* @param {byte} g
* @param {byte} b
* @returns {ApiRGBColor}
* @returns {ApiColor}
*/
Api.prototype.CreateRGBColor = function (r, g, b) {
return new ApiRGBColor(r, g, b);
Api.prototype.CreateColorFromRGB = function (r, g, b) {
return new ApiColor(AscCommonExcel.createRgbColor(r, g, b));
};
/**
......@@ -891,7 +881,7 @@
Api.prototype["GetActiveSheet"] = Api.prototype.GetActiveSheet;
Api.prototype["CreateNewHistoryPoint"] = Api.prototype.CreateNewHistoryPoint;
Api.prototype["CreateRGBColor"] = Api.prototype.CreateRGBColor;
Api.prototype["CreateColorFromRGB"] = Api.prototype.CreateColorFromRGB;
ApiWorksheet.prototype["GetActiveCell"] = ApiWorksheet.prototype.GetActiveCell;
ApiWorksheet.prototype["SetName"] = ApiWorksheet.prototype.SetName;
......
......@@ -123,6 +123,9 @@ function shiftSort(a, b, offset)
}
return nRes;
}
function createRgbColor(r, g, b) {
return new RgbColor((r << 16) + (g << 8) + b);
}
var g_oRgbColorProperties = {
rgb : 0
};
......@@ -365,7 +368,7 @@ function CorrectAscColor(asc_color)
}
default:
{
ret = new RgbColor((asc_color.asc_getR() << 16) + (asc_color.asc_getG() << 8) + asc_color.asc_getB());
ret = createRgbColor(asc_color.asc_getR(), asc_color.asc_getG(), asc_color.asc_getB());
}
}
return ret;
......@@ -7795,6 +7798,7 @@ function getCurrencyFormat(opt_cultureInfo, opt_fraction, opt_currency, opt_curr
window['AscCommonExcel'].map_themeExcel_to_themePresentation = map_themeExcel_to_themePresentation;
window['AscCommonExcel'].shiftGetBBox = shiftGetBBox;
window['AscCommonExcel'].RgbColor = RgbColor;
window['AscCommonExcel'].createRgbColor = createRgbColor;
window['AscCommonExcel'].ThemeColor = ThemeColor;
window['AscCommonExcel'].CorrectAscColor = CorrectAscColor;
window['AscCommonExcel'].Fragment = Fragment;
......
......@@ -856,6 +856,7 @@
}
};
/** @constructor */
function asc_CColor() {
this.type = c_oAscColor.COLOR_TYPE_SRGB;
this.value = null;
......@@ -886,7 +887,7 @@
}
asc_CColor.prototype = {
asc_getR: function () {
constructor: asc_CColor, asc_getR: function () {
return this.r
}, asc_putR: function (v) {
this.r = v;
......
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