mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
"graphics like CJSClass" begin
This commit is contained in:
@ -48,7 +48,8 @@ SOURCES += \
|
||||
doctrenderer.cpp \
|
||||
docbuilder.cpp \
|
||||
docbuilder_p.cpp \
|
||||
nativebuilder.cpp
|
||||
nativebuilder.cpp \
|
||||
graphics.cpp
|
||||
|
||||
SOURCES += \
|
||||
../../Common/OfficeFileFormatChecker2.cpp \
|
||||
@ -60,7 +61,18 @@ HEADERS += \
|
||||
docbuilder_p.h \
|
||||
memorystream.h \
|
||||
nativecontrol.h \
|
||||
nativebuilder.h
|
||||
nativebuilder.h \
|
||||
graphics.h
|
||||
|
||||
HEADERS += \
|
||||
js_internal/embed/GraphicsEmbed.h \
|
||||
js_internal/js_base.h \
|
||||
js_internal/v8/v8_base.h
|
||||
|
||||
SOURCES += \
|
||||
js_internal/embed/GraphicsEmbed.cpp \
|
||||
js_internal/embed/v8/v8_Graphics.cpp \
|
||||
js_internal/v8/v8_base.cpp
|
||||
}
|
||||
|
||||
# downloader
|
||||
|
||||
@ -3,90 +3,10 @@
|
||||
#include <string>
|
||||
#include <cmath>
|
||||
|
||||
CJSGraphics::CJSGraphics()
|
||||
namespace NSGraphics
|
||||
{
|
||||
m_oContext = nullptr;
|
||||
m_dWidthMM = 0.0;
|
||||
m_dHeightMM = 0.0;
|
||||
m_lWidthPix = 0.0;
|
||||
m_lHeightPix = 0.0;
|
||||
m_dDpiX = 96.0;
|
||||
m_dDpiY = 96.0;
|
||||
m_bIsBreak = false;
|
||||
|
||||
m_oPen = nullptr; // new AscCommon.CPen();
|
||||
m_bPenColorInit = false;
|
||||
m_oBrush = nullptr; // new AscCommon.CBrush();
|
||||
m_bBrushColorInit = false;
|
||||
|
||||
m_oFontManager = nullptr;
|
||||
|
||||
m_oCoordTransform = nullptr; // new CMatrixL();
|
||||
m_oBaseTransform = nullptr; // new CMatrixL();
|
||||
m_oTransform = nullptr; // new CMatrixL();
|
||||
m_oFullTransform = nullptr; // new CMatrixL();
|
||||
m_oInvertFullTransform = nullptr; // new CMatrixL();
|
||||
|
||||
ArrayPoints = nullptr;
|
||||
|
||||
m_oTextPr = nullptr;
|
||||
m_oGrFonts = nullptr; // new AscCommon.CGrRFonts();
|
||||
m_oLastFont = nullptr; // new AscCommon.CFontSetup();
|
||||
|
||||
m_bIntegerGrid = true;
|
||||
|
||||
ClipManager = nullptr; // new AscCommon.CClipManager();
|
||||
// ClipManager.BaseObject = this;
|
||||
|
||||
TextureFillTransformScaleX = 1;
|
||||
TextureFillTransformScaleY = 1;
|
||||
IsThumbnail = false;
|
||||
|
||||
IsDemonstrationMode = false;
|
||||
|
||||
GrState = nullptr; // new AscCommon.CGrState();
|
||||
// GrState.Parent = this;
|
||||
|
||||
globalAlpha = 1;
|
||||
|
||||
TextClipRect = nullptr;
|
||||
IsClipContext = false;
|
||||
|
||||
IsUseFonts2 = false;
|
||||
m_oFontManager2 = nullptr;
|
||||
m_oLastFont2 = nullptr;
|
||||
|
||||
ClearMode = false;
|
||||
IsRetina = false;
|
||||
|
||||
dash_no_smart = nullptr;
|
||||
}
|
||||
|
||||
CJSGraphics::~CJSGraphics()
|
||||
{
|
||||
if(m_oContext) delete m_oContext;
|
||||
if(m_oPen) delete m_oPen;
|
||||
if(m_oBrush) delete m_oBrush;
|
||||
if(m_oFontManager) delete m_oFontManager;
|
||||
if(m_oCoordTransform) delete m_oCoordTransform;
|
||||
if(m_oBaseTransform) delete m_oBaseTransform;
|
||||
if(m_oTransform) delete m_oTransform;
|
||||
if(m_oFullTransform) delete m_oFullTransform;
|
||||
if(m_oInvertFullTransform) delete m_oInvertFullTransform;
|
||||
if(ArrayPoints) delete ArrayPoints;
|
||||
if(m_oTextPr) delete m_oTextPr;
|
||||
if(m_oGrFonts) delete m_oGrFonts;
|
||||
if(m_oLastFont) delete m_oLastFont;
|
||||
if(LastFontOriginInfo.Replace) delete LastFontOriginInfo.Replace;
|
||||
if(ClipManager) delete ClipManager;
|
||||
if(GrState) delete GrState;
|
||||
if(TextClipRect) delete TextClipRect;
|
||||
if(m_oFontManager2) delete m_oFontManager2;
|
||||
if(m_oLastFont2) delete m_oLastFont2;
|
||||
if(dash_no_smart) delete dash_no_smart;
|
||||
}
|
||||
|
||||
void CJSGraphics::init(v8::Local<v8::Value>* context, double width_px, double height_px, double width_mm, double height_mm)
|
||||
void CGraphics::init(v8::Local<v8::Value>* context, double width_px, double height_px, double width_mm, double height_mm)
|
||||
{
|
||||
m_oContext = context;
|
||||
m_lHeightPix = height_px; // height_px >> 0;
|
||||
@ -111,7 +31,7 @@ void CJSGraphics::init(v8::Local<v8::Value>* context, double width_px, double he
|
||||
m_bBrushColorInit = false;
|
||||
}
|
||||
|
||||
void CJSGraphics::put_GlobalAlpha(bool enable, int alpha)
|
||||
void CGraphics::put_GlobalAlpha(bool enable, int alpha)
|
||||
{
|
||||
if(!enable)
|
||||
{
|
||||
@ -125,7 +45,7 @@ void CJSGraphics::put_GlobalAlpha(bool enable, int alpha)
|
||||
}
|
||||
}
|
||||
|
||||
void CJSGraphics::End_GlobalAlpha()
|
||||
void CGraphics::End_GlobalAlpha()
|
||||
{
|
||||
if (!m_bIntegerGrid)
|
||||
{
|
||||
@ -147,7 +67,7 @@ void CJSGraphics::End_GlobalAlpha()
|
||||
}
|
||||
}
|
||||
|
||||
void CJSGraphics::p_color(int r, int g, int b, int a)
|
||||
void CGraphics::p_color(int r, int g, int b, int a)
|
||||
{
|
||||
/*
|
||||
var _c = m_oPen.Color;
|
||||
@ -165,7 +85,7 @@ void CJSGraphics::p_color(int r, int g, int b, int a)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::p_width(int w)
|
||||
void CGraphics::p_width(int w)
|
||||
{
|
||||
// m_oPen.LineWidth = static_cast<int>(static_cast<double>(w) / 1000.0);
|
||||
|
||||
@ -208,7 +128,7 @@ void CJSGraphics::p_width(int w)
|
||||
}
|
||||
}
|
||||
|
||||
void CJSGraphics::p_dash(const v8::Local<v8::Value>& params)
|
||||
void CGraphics::p_dash(const v8::Local<v8::Value>& params)
|
||||
{
|
||||
/*
|
||||
if (!m_oContext.setLineDash)
|
||||
@ -219,7 +139,7 @@ void CJSGraphics::p_dash(const v8::Local<v8::Value>& params)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::b_color1(int r, int g, int b, int a)
|
||||
void CGraphics::b_color1(int r, int g, int b, int a)
|
||||
{
|
||||
/*
|
||||
var _c = m_oBrush.Color1;
|
||||
@ -238,7 +158,7 @@ void CJSGraphics::b_color1(int r, int g, int b, int a)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::b_color2(int r, int g, int b, int a)
|
||||
void CGraphics::b_color2(int r, int g, int b, int a)
|
||||
{
|
||||
/*
|
||||
var _c = m_oBrush.Color2;
|
||||
@ -249,7 +169,7 @@ void CJSGraphics::b_color2(int r, int g, int b, int a)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::transform(double sx, double shy, double shx, double sy, double tx, double ty)
|
||||
void CGraphics::transform(double sx, double shy, double shx, double sy, double tx, double ty)
|
||||
{
|
||||
/*
|
||||
v8::Local<v8::Value> _t = m_oTransform;
|
||||
@ -272,7 +192,7 @@ void CJSGraphics::transform(double sx, double shy, double shx, double sy, double
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::CalculateFullTransform(bool isInvertNeed)
|
||||
void CGraphics::CalculateFullTransform(bool isInvertNeed)
|
||||
{
|
||||
/*
|
||||
v8::Local<v8::Value> _ft = m_oFullTransform;
|
||||
@ -300,22 +220,22 @@ void CJSGraphics::CalculateFullTransform(bool isInvertNeed)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::_s()
|
||||
void CGraphics::_s()
|
||||
{
|
||||
// m_oContext.beginPath();
|
||||
}
|
||||
|
||||
void CJSGraphics::_e()
|
||||
void CGraphics::_e()
|
||||
{
|
||||
// m_oContext.beginPath();
|
||||
}
|
||||
|
||||
void CJSGraphics::_z()
|
||||
void CGraphics::_z()
|
||||
{
|
||||
// m_oContext.closePath();
|
||||
}
|
||||
|
||||
void CJSGraphics::_m(double x, double y)
|
||||
void CGraphics::_m(double x, double y)
|
||||
{
|
||||
/*
|
||||
if (!m_bIntegerGrid)
|
||||
@ -334,7 +254,7 @@ void CJSGraphics::_m(double x, double y)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::_l(double x, double y)
|
||||
void CGraphics::_l(double x, double y)
|
||||
{
|
||||
/*
|
||||
if (!m_bIntegerGrid)
|
||||
@ -353,7 +273,7 @@ void CJSGraphics::_l(double x, double y)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::_c(double x1, double y1, double x2, double y2, double x3, double y3)
|
||||
void CGraphics::_c(double x1, double y1, double x2, double y2, double x3, double y3)
|
||||
{
|
||||
/*
|
||||
if (!m_bIntegerGrid)
|
||||
@ -382,7 +302,7 @@ void CJSGraphics::_c(double x1, double y1, double x2, double y2, double x3, doub
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::_c2(double x1, double y1, double x2, double y2)
|
||||
void CGraphics::_c2(double x1, double y1, double x2, double y2)
|
||||
{
|
||||
/*
|
||||
if (!m_bIntegerGrid)
|
||||
@ -408,22 +328,22 @@ void CJSGraphics::_c2(double x1, double y1, double x2, double y2)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::ds()
|
||||
void CGraphics::ds()
|
||||
{
|
||||
// m_oContext.stroke();
|
||||
}
|
||||
|
||||
void CJSGraphics::df()
|
||||
void CGraphics::df()
|
||||
{
|
||||
// m_oContext.fill();
|
||||
}
|
||||
|
||||
void CJSGraphics::save()
|
||||
void CGraphics::save()
|
||||
{
|
||||
// m_oContext.save();
|
||||
}
|
||||
|
||||
void CJSGraphics::restore()
|
||||
void CGraphics::restore()
|
||||
{
|
||||
// m_oContext.restore();
|
||||
|
||||
@ -431,12 +351,12 @@ void CJSGraphics::restore()
|
||||
m_bBrushColorInit = false;
|
||||
}
|
||||
|
||||
void CJSGraphics::clip()
|
||||
void CGraphics::clip()
|
||||
{
|
||||
// m_oContext.clip();
|
||||
}
|
||||
|
||||
void CJSGraphics::reset()
|
||||
void CGraphics::reset()
|
||||
{
|
||||
// m_oTransform.Reset();
|
||||
CalculateFullTransform(false);
|
||||
@ -447,7 +367,7 @@ void CJSGraphics::reset()
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::transform3(const v8::Local<v8::Value>& m, bool isNeedInvert)
|
||||
void CGraphics::transform3(const v8::Local<v8::Value>& m, bool isNeedInvert)
|
||||
{
|
||||
/*
|
||||
v8::Local<v8::Value> _t = m_oTransform;
|
||||
@ -469,12 +389,12 @@ void CJSGraphics::transform3(const v8::Local<v8::Value>& m, bool isNeedInvert)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::FreeFont()
|
||||
void CGraphics::FreeFont()
|
||||
{
|
||||
// m_oFontManager.m_pFont = null;
|
||||
}
|
||||
|
||||
void CJSGraphics::ClearLastFont()
|
||||
void CGraphics::ClearLastFont()
|
||||
{
|
||||
/*
|
||||
m_oLastFont = new AscCommon.CFontSetup();
|
||||
@ -482,7 +402,7 @@ void CJSGraphics::ClearLastFont()
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::drawImage2(const v8::Local<v8::Value>& img, double x, double y, double w, double h, int alpha, const v8::Local<v8::Value>& srcRect)
|
||||
void CGraphics::drawImage2(const v8::Local<v8::Value>& img, double x, double y, double w, double h, int alpha, const v8::Local<v8::Value>& srcRect)
|
||||
{
|
||||
/*
|
||||
if (srcRect)
|
||||
@ -698,7 +618,7 @@ void CJSGraphics::drawImage2(const v8::Local<v8::Value>& img, double x, double y
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::drawImage(const v8::Local<v8::Value>& img, double x, double y, double w, double h, int alpha, const v8::Local<v8::Value>& srcRect, const v8::Local<v8::Value>& nativeImage)
|
||||
void CGraphics::drawImage(const v8::Local<v8::Value>& img, double x, double y, double w, double h, int alpha, const v8::Local<v8::Value>& srcRect, const v8::Local<v8::Value>& nativeImage)
|
||||
{
|
||||
/*
|
||||
if (nativeImage)
|
||||
@ -787,12 +707,12 @@ void CJSGraphics::drawImage(const v8::Local<v8::Value>& img, double x, double y,
|
||||
*/
|
||||
}
|
||||
|
||||
CFont CJSGraphics::GetFont()
|
||||
CFont CGraphics::GetFont()
|
||||
{
|
||||
return m_oCurFont;
|
||||
}
|
||||
|
||||
void CJSGraphics::font(unsigned int font_id, int font_size)
|
||||
void CGraphics::font(unsigned int font_id, int font_size)
|
||||
{
|
||||
/*
|
||||
AscFonts.g_font_infos[AscFonts.g_map_font_index[font_id]].LoadFont(editor.FontLoader, this.IsUseFonts2 ? this.m_oFontManager2 : this.m_oFontManager,
|
||||
@ -800,7 +720,7 @@ void CJSGraphics::font(unsigned int font_id, int font_size)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::SetFont(const v8::Local<v8::Value>& font)
|
||||
void CGraphics::SetFont(const v8::Local<v8::Value>& font)
|
||||
{
|
||||
/*
|
||||
if (null == font)
|
||||
@ -843,7 +763,7 @@ void CJSGraphics::SetFont(const v8::Local<v8::Value>& font)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::SetTextPr(const v8::Local<v8::Value>& textPr, const v8::Local<v8::Value>& theme)
|
||||
void CGraphics::SetTextPr(const v8::Local<v8::Value>& textPr, const v8::Local<v8::Value>& theme)
|
||||
{
|
||||
/*
|
||||
m_oTextPr = textPr;
|
||||
@ -854,7 +774,7 @@ void CJSGraphics::SetTextPr(const v8::Local<v8::Value>& textPr, const v8::Local<
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::SetFontSlot(const v8::Local<v8::Value>& slot, double fontSizeKoef)
|
||||
void CGraphics::SetFontSlot(const v8::Local<v8::Value>& slot, double fontSizeKoef)
|
||||
{
|
||||
/*
|
||||
var _rfonts = this.m_oGrFonts;
|
||||
@ -949,12 +869,12 @@ void CJSGraphics::SetFontSlot(const v8::Local<v8::Value>& slot, double fontSizeK
|
||||
*/
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> CJSGraphics::GetTextPr()
|
||||
v8::Local<v8::Value> CGraphics::GetTextPr()
|
||||
{
|
||||
return *m_oTextPr;
|
||||
}
|
||||
|
||||
void CJSGraphics::FillText(double x, double y, const v8::Local<v8::Value>& text)
|
||||
void CGraphics::FillText(double x, double y, const v8::Local<v8::Value>& text)
|
||||
{
|
||||
/*
|
||||
if (this.m_bIsBreak)
|
||||
@ -998,7 +918,7 @@ void CJSGraphics::FillText(double x, double y, const v8::Local<v8::Value>& text)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::t(const v8::Local<v8::Value>& text, double x, double y, bool isBounds)
|
||||
void CGraphics::t(const v8::Local<v8::Value>& text, double x, double y, bool isBounds)
|
||||
{
|
||||
/*
|
||||
if (this.m_bIsBreak)
|
||||
@ -1040,7 +960,7 @@ void CJSGraphics::t(const v8::Local<v8::Value>& text, double x, double y, bool i
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::FillText2(double x, double y, const v8::Local<v8::Value>& text, double cropX, double cropW)
|
||||
void CGraphics::FillText2(double x, double y, const v8::Local<v8::Value>& text, double cropX, double cropW)
|
||||
{
|
||||
/*
|
||||
if (this.m_bIsBreak)
|
||||
@ -1081,7 +1001,7 @@ void CJSGraphics::FillText2(double x, double y, const v8::Local<v8::Value>& text
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::t2(const v8::Local<v8::Value>& text, double x, double y, double cropX, double cropW)
|
||||
void CGraphics::t2(const v8::Local<v8::Value>& text, double x, double y, double cropX, double cropW)
|
||||
{
|
||||
/*
|
||||
if (this.m_bIsBreak)
|
||||
@ -1121,7 +1041,7 @@ void CJSGraphics::t2(const v8::Local<v8::Value>& text, double x, double y, doubl
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::FillTextCode(double x, double y, const v8::Local<v8::Value>& lUnicode)
|
||||
void CGraphics::FillTextCode(double x, double y, const v8::Local<v8::Value>& lUnicode)
|
||||
{
|
||||
/*
|
||||
if (this.m_bIsBreak)
|
||||
@ -1163,7 +1083,7 @@ void CJSGraphics::FillTextCode(double x, double y, const v8::Local<v8::Value>& l
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::tg(const v8::Local<v8::Value>& text, double x, double y)
|
||||
void CGraphics::tg(const v8::Local<v8::Value>& text, double x, double y)
|
||||
{
|
||||
/*
|
||||
if (this.m_bIsBreak)
|
||||
@ -1208,7 +1128,7 @@ void CJSGraphics::tg(const v8::Local<v8::Value>& text, double x, double y)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::private_FillGlyph(const v8::Local<v8::Value>& pGlyph, const v8::Local<v8::Value>& _bounds)
|
||||
void CGraphics::private_FillGlyph(const v8::Local<v8::Value>& pGlyph, const v8::Local<v8::Value>& _bounds)
|
||||
{
|
||||
/*
|
||||
var nW = pGlyph.oBitmap.nWidth;
|
||||
@ -1245,7 +1165,7 @@ void CJSGraphics::private_FillGlyph(const v8::Local<v8::Value>& pGlyph, const v8
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::private_FillGlyphC(const v8::Local<v8::Value>& pGlyph, double cropX, double cropW)
|
||||
void CGraphics::private_FillGlyphC(const v8::Local<v8::Value>& pGlyph, double cropX, double cropW)
|
||||
{
|
||||
/*
|
||||
var nW = pGlyph.oBitmap.nWidth;
|
||||
@ -1271,7 +1191,7 @@ void CJSGraphics::private_FillGlyphC(const v8::Local<v8::Value>& pGlyph, double
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::private_FillGlyph2(const v8::Local<v8::Value>& pGlyph)
|
||||
void CGraphics::private_FillGlyph2(const v8::Local<v8::Value>& pGlyph)
|
||||
{
|
||||
/*
|
||||
var i = 0;
|
||||
@ -1329,7 +1249,7 @@ void CJSGraphics::private_FillGlyph2(const v8::Local<v8::Value>& pGlyph)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::SetIntegerGrid(bool param)
|
||||
void CGraphics::SetIntegerGrid(bool param)
|
||||
{
|
||||
/*
|
||||
if (true == param)
|
||||
@ -1346,12 +1266,12 @@ void CJSGraphics::SetIntegerGrid(bool param)
|
||||
*/
|
||||
}
|
||||
|
||||
bool CJSGraphics::GetIntegerGrid()
|
||||
bool CGraphics::GetIntegerGrid()
|
||||
{
|
||||
return m_bIntegerGrid;
|
||||
}
|
||||
|
||||
void CJSGraphics::DrawStringASCII(const std::string& name, int size, bool bold, bool italic, const v8::Local<v8::Value>& text, double x, double y, bool bIsHeader)
|
||||
void CGraphics::DrawStringASCII(const std::string& name, int size, bool bold, bool italic, const v8::Local<v8::Value>& text, double x, double y, bool bIsHeader)
|
||||
{
|
||||
/*
|
||||
var _textProp = {
|
||||
@ -1413,7 +1333,7 @@ void CJSGraphics::DrawStringASCII(const std::string& name, int size, bool bold,
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::DrawStringASCII2(const std::string& name, int size, bool bold, bool italic, const v8::Local<v8::Value>& text, double x, double y, bool bIsHeader)
|
||||
void CGraphics::DrawStringASCII2(const std::string& name, int size, bool bold, bool italic, const v8::Local<v8::Value>& text, double x, double y, bool bIsHeader)
|
||||
{
|
||||
/*
|
||||
var _textProp = {
|
||||
@ -1478,7 +1398,7 @@ void CJSGraphics::DrawStringASCII2(const std::string& name, int size, bool bold,
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::DrawHeaderEdit(double yPos, const v8::Local<v8::Value>& lock_type, int sectionNum, bool bIsRepeat, const v8::Local<v8::Value>& type)
|
||||
void CGraphics::DrawHeaderEdit(double yPos, const v8::Local<v8::Value>& lock_type, int sectionNum, bool bIsRepeat, const v8::Local<v8::Value>& type)
|
||||
{
|
||||
/*
|
||||
var _y = this.m_oFullTransform.TransformPointY(0,yPos);
|
||||
@ -1584,7 +1504,7 @@ void CJSGraphics::DrawHeaderEdit(double yPos, const v8::Local<v8::Value>& lock_t
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::DrawFooterEdit(double yPos, const v8::Local<v8::Value>& lock_type, int sectionNum, bool bIsRepeat, const v8::Local<v8::Value>& type)
|
||||
void CGraphics::DrawFooterEdit(double yPos, const v8::Local<v8::Value>& lock_type, int sectionNum, bool bIsRepeat, const v8::Local<v8::Value>& type)
|
||||
{
|
||||
/*
|
||||
var _y = this.m_oFullTransform.TransformPointY(0,yPos);
|
||||
@ -1689,7 +1609,7 @@ void CJSGraphics::DrawFooterEdit(double yPos, const v8::Local<v8::Value>& lock_t
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::DrawLockParagraph(const v8::Local<v8::Value>& lock_type, double x, double y1, double y2)
|
||||
void CGraphics::DrawLockParagraph(const v8::Local<v8::Value>& lock_type, double x, double y1, double y2)
|
||||
{
|
||||
/*
|
||||
if (lock_type == locktype_None || editor.WordControl.m_oDrawingDocument.IsLockObjectsEnable === false || editor.isViewMode || (lock_type === locktype_Mine && true === AscCommon.CollaborativeEditing.Is_Fast()))
|
||||
@ -1783,7 +1703,7 @@ void CJSGraphics::DrawLockParagraph(const v8::Local<v8::Value>& lock_type, doubl
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::DrawLockObjectRect(const v8::Local<v8::Value>& lock_type, double x, double y, double w, double h)
|
||||
void CGraphics::DrawLockObjectRect(const v8::Local<v8::Value>& lock_type, double x, double y, double w, double h)
|
||||
{
|
||||
/*
|
||||
if (editor.isViewMode || this.IsThumbnail || lock_type == locktype_None || this.IsDemonstrationMode || (lock_type === locktype_Mine && true === AscCommon.CollaborativeEditing.Is_Fast()))
|
||||
@ -1893,7 +1813,7 @@ void CJSGraphics::DrawLockObjectRect(const v8::Local<v8::Value>& lock_type, doub
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::DrawEmptyTableLine(double x1, double y1, double x2, double y2)
|
||||
void CGraphics::DrawEmptyTableLine(double x1, double y1, double x2, double y2)
|
||||
{
|
||||
/*
|
||||
if ((!editor.isShowTableEmptyLine || editor.isViewMode) && (editor.isShowTableEmptyLineAttack === false))
|
||||
@ -1992,7 +1912,7 @@ void CJSGraphics::DrawEmptyTableLine(double x1, double y1, double x2, double y2)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::DrawSpellingLine(double y0, double x0, double x1, double w)
|
||||
void CGraphics::DrawSpellingLine(double y0, double x0, double x1, double w)
|
||||
{
|
||||
/*
|
||||
if (!editor.isViewMode)
|
||||
@ -2000,7 +1920,7 @@ void CJSGraphics::DrawSpellingLine(double y0, double x0, double x1, double w)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::drawHorLine(int align, double y, double x, double r, int penW)
|
||||
void CGraphics::drawHorLine(int align, double y, double x, double r, int penW)
|
||||
{
|
||||
/*
|
||||
var _check_transform = global_MatrixTransformer.IsIdentity2(this.m_oTransform);
|
||||
@ -2085,7 +2005,7 @@ void CJSGraphics::drawHorLine(int align, double y, double x, double r, int penW)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::drawHorLine2(int align, double y, double x, double r, int penW)
|
||||
void CGraphics::drawHorLine2(int align, double y, double x, double r, int penW)
|
||||
{
|
||||
/*
|
||||
var _check_transform = global_MatrixTransformer.IsIdentity2(this.m_oTransform);
|
||||
@ -2165,7 +2085,7 @@ void CJSGraphics::drawHorLine2(int align, double y, double x, double r, int penW
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::drawVerLine(int align, double x, double y, double b, int penW)
|
||||
void CGraphics::drawVerLine(int align, double x, double y, double b, int penW)
|
||||
{
|
||||
/*
|
||||
var _check_transform = global_MatrixTransformer.IsIdentity2(this.m_oTransform);
|
||||
@ -2247,7 +2167,7 @@ void CJSGraphics::drawVerLine(int align, double x, double y, double b, int penW)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::drawHorLineExt(int align, double y, double x, double r, int penW, double leftMW, double rightMW)
|
||||
void CGraphics::drawHorLineExt(int align, double y, double x, double r, int penW, double leftMW, double rightMW)
|
||||
{
|
||||
/*
|
||||
var _check_transform = global_MatrixTransformer.IsIdentity2(this.m_oTransform);
|
||||
@ -2385,7 +2305,7 @@ void CJSGraphics::drawHorLineExt(int align, double y, double x, double r, int pe
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::rect(double x, double y, double w, double h)
|
||||
void CGraphics::rect(double x, double y, double w, double h)
|
||||
{
|
||||
/*
|
||||
var ctx = this.m_oContext;
|
||||
@ -2427,7 +2347,7 @@ void CJSGraphics::rect(double x, double y, double w, double h)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::TableRect(double x, double y, double w, double h)
|
||||
void CGraphics::TableRect(double x, double y, double w, double h)
|
||||
{
|
||||
/*
|
||||
var ctx = this.m_oContext;
|
||||
@ -2448,7 +2368,7 @@ void CJSGraphics::TableRect(double x, double y, double w, double h)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::AddClipRect(double x, double y, double w, double h)
|
||||
void CGraphics::AddClipRect(double x, double y, double w, double h)
|
||||
{
|
||||
/*
|
||||
var __rect = new AscCommon._rect();
|
||||
@ -2460,7 +2380,7 @@ void CJSGraphics::AddClipRect(double x, double y, double w, double h)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::SetClip(const v8::Local<v8::Value>& r)
|
||||
void CGraphics::SetClip(const v8::Local<v8::Value>& r)
|
||||
{
|
||||
/*
|
||||
var ctx = this.m_oContext;
|
||||
@ -2486,7 +2406,7 @@ void CJSGraphics::SetClip(const v8::Local<v8::Value>& r)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::RemoveClip()
|
||||
void CGraphics::RemoveClip()
|
||||
{
|
||||
/*
|
||||
this.m_oContext.restore();
|
||||
@ -2500,7 +2420,7 @@ void CJSGraphics::RemoveClip()
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::drawCollaborativeChanges(double x, double y, double w, double h, const v8::Local<v8::Value>& Color)
|
||||
void CGraphics::drawCollaborativeChanges(double x, double y, double w, double h, const v8::Local<v8::Value>& Color)
|
||||
{
|
||||
/*
|
||||
this.b_color1( Color.r, Color.g, Color.b, 255 );
|
||||
@ -2509,7 +2429,7 @@ void CJSGraphics::drawCollaborativeChanges(double x, double y, double w, double
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::drawMailMergeField(double x, double y, double w, double h)
|
||||
void CGraphics::drawMailMergeField(double x, double y, double w, double h)
|
||||
{
|
||||
/*
|
||||
this.b_color1(206, 212, 223, 204);
|
||||
@ -2519,7 +2439,7 @@ void CJSGraphics::drawMailMergeField(double x, double y, double w, double h)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::drawSearchResult(double x, double y, double w, double h)
|
||||
void CGraphics::drawSearchResult(double x, double y, double w, double h)
|
||||
{
|
||||
/*
|
||||
this.b_color1( 255, 238, 128, 255 );
|
||||
@ -2528,7 +2448,7 @@ void CJSGraphics::drawSearchResult(double x, double y, double w, double h)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::drawFlowAnchor(double x, double y)
|
||||
void CGraphics::drawFlowAnchor(double x, double y)
|
||||
{
|
||||
/*
|
||||
if (!AscCommon.g_flow_anchor || !AscCommon.g_flow_anchor.asc_complete || (!editor || !editor.ShowParaMarks))
|
||||
@ -2552,52 +2472,52 @@ void CJSGraphics::drawFlowAnchor(double x, double y)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::SavePen()
|
||||
void CGraphics::SavePen()
|
||||
{
|
||||
// this.GrState.SavePen();
|
||||
}
|
||||
|
||||
void CJSGraphics::RestorePen()
|
||||
void CGraphics::RestorePen()
|
||||
{
|
||||
// this.GrState.RestorePen();
|
||||
}
|
||||
|
||||
void CJSGraphics::SaveBrush()
|
||||
void CGraphics::SaveBrush()
|
||||
{
|
||||
// this.GrState.SaveBrush();
|
||||
}
|
||||
|
||||
void CJSGraphics::RestoreBrush()
|
||||
void CGraphics::RestoreBrush()
|
||||
{
|
||||
// this.GrState.RestoreBrush();
|
||||
}
|
||||
|
||||
void CJSGraphics::SavePenBrush()
|
||||
void CGraphics::SavePenBrush()
|
||||
{
|
||||
// this.GrState.SavePenBrush();
|
||||
}
|
||||
|
||||
void CJSGraphics::RestorePenBrush()
|
||||
void CGraphics::RestorePenBrush()
|
||||
{
|
||||
// this.GrState.RestorePenBrush();
|
||||
}
|
||||
|
||||
void CJSGraphics::SaveGrState()
|
||||
void CGraphics::SaveGrState()
|
||||
{
|
||||
// this.GrState.SaveGrState();
|
||||
}
|
||||
|
||||
void CJSGraphics::RestoreGrState()
|
||||
void CGraphics::RestoreGrState()
|
||||
{
|
||||
// this.GrState.RestoreGrState();
|
||||
}
|
||||
|
||||
void CJSGraphics::EndClipPath()
|
||||
void CGraphics::EndClipPath()
|
||||
{
|
||||
// this.m_oContext.clip();
|
||||
}
|
||||
|
||||
void CJSGraphics::StartCheckTableDraw()
|
||||
void CGraphics::StartCheckTableDraw()
|
||||
{
|
||||
/*
|
||||
if (!this.m_bIntegerGrid && global_MatrixTransformer.IsIdentity2(this.m_oTransform))
|
||||
@ -2610,13 +2530,13 @@ void CJSGraphics::StartCheckTableDraw()
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::EndCheckTableDraw(bool bIsRestore)
|
||||
void CGraphics::EndCheckTableDraw(bool bIsRestore)
|
||||
{
|
||||
if (bIsRestore)
|
||||
RestoreGrState();
|
||||
}
|
||||
|
||||
void CJSGraphics::SetTextClipRect(double _l, double _t, double _r, double _b)
|
||||
void CGraphics::SetTextClipRect(double _l, double _t, double _r, double _b)
|
||||
{
|
||||
/*
|
||||
this.TextClipRect = {
|
||||
@ -2628,7 +2548,7 @@ void CJSGraphics::SetTextClipRect(double _l, double _t, double _r, double _b)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::AddSmartRect(double x, double y, double w, double h, int pen_w)
|
||||
void CGraphics::AddSmartRect(double x, double y, double w, double h, int pen_w)
|
||||
{
|
||||
/*
|
||||
if (!global_MatrixTransformer.IsIdentity2(this.m_oTransform))
|
||||
@ -2782,7 +2702,7 @@ void CJSGraphics::AddSmartRect(double x, double y, double w, double h, int pen_w
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::CheckUseFonts2(const v8::Local<v8::Value>& _transform)
|
||||
void CGraphics::CheckUseFonts2(const v8::Local<v8::Value>& _transform)
|
||||
{
|
||||
/*
|
||||
if (!global_MatrixTransformer.IsIdentity2(_transform))
|
||||
@ -2803,12 +2723,12 @@ void CJSGraphics::CheckUseFonts2(const v8::Local<v8::Value>& _transform)
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::UncheckUseFonts2()
|
||||
void CGraphics::UncheckUseFonts2()
|
||||
{
|
||||
// IsUseFonts2 = false;
|
||||
}
|
||||
|
||||
void CJSGraphics::DrawPresentationComment(const v8::Local<v8::Value>& type, double x, double y, double w, double h)
|
||||
void CGraphics::DrawPresentationComment(const v8::Local<v8::Value>& type, double x, double y, double w, double h)
|
||||
{
|
||||
/*
|
||||
if (this.IsThumbnail || this.IsDemonstrationMode)
|
||||
@ -2843,7 +2763,7 @@ void CJSGraphics::DrawPresentationComment(const v8::Local<v8::Value>& type, doub
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::DrawPolygon(const v8::Local<v8::Value>& oPath, int lineWidth, double shift)
|
||||
void CGraphics::DrawPolygon(const v8::Local<v8::Value>& oPath, int lineWidth, double shift)
|
||||
{
|
||||
/*
|
||||
this.m_oContext.lineWidth = lineWidth;
|
||||
@ -2903,7 +2823,7 @@ void CJSGraphics::DrawPolygon(const v8::Local<v8::Value>& oPath, int lineWidth,
|
||||
*/
|
||||
}
|
||||
|
||||
void CJSGraphics::DrawFootnoteRect(double x, double y, double w, double h)
|
||||
void CGraphics::DrawFootnoteRect(double x, double y, double w, double h)
|
||||
{
|
||||
/*
|
||||
var _old = this.m_bIntegerGrid;
|
||||
@ -2933,3 +2853,4 @@ void CJSGraphics::DrawFootnoteRect(double x, double y, double w, double h)
|
||||
this.SetIntegerGrid(false);
|
||||
*/
|
||||
}
|
||||
}
|
||||
359
DesktopEditor/doctrenderer/graphics.h
Normal file
359
DesktopEditor/doctrenderer/graphics.h
Normal file
@ -0,0 +1,359 @@
|
||||
#ifndef CGRAPHICS_H
|
||||
#define CGRAPHICS_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "../common/Types.h"
|
||||
#include "v8.h"
|
||||
#include "libplatform/libplatform.h"
|
||||
|
||||
struct CFont
|
||||
{
|
||||
std::string Name;
|
||||
int FontSize;
|
||||
bool Bold;
|
||||
bool Italic;
|
||||
|
||||
CFont() : Name(""), FontSize(10), Bold(false), Italic(false) {}
|
||||
};
|
||||
|
||||
struct CLastFontOriginInfo
|
||||
{
|
||||
std::string Name;
|
||||
v8::Local<v8::Value>* Replace;
|
||||
|
||||
CLastFontOriginInfo() : Name(""), Replace(nullptr) {}
|
||||
};
|
||||
|
||||
namespace NSGraphics
|
||||
{
|
||||
class CGraphics
|
||||
{
|
||||
private:
|
||||
v8::Local<v8::Value>* m_oContext;
|
||||
double m_dWidthMM;
|
||||
double m_dHeightMM;
|
||||
double m_lWidthPix;
|
||||
double m_lHeightPix;
|
||||
double m_dDpiX;
|
||||
double m_dDpiY;
|
||||
bool m_bIsBreak;
|
||||
|
||||
v8::Local<v8::Value>* m_oPen;
|
||||
bool m_bPenColorInit;
|
||||
v8::Local<v8::Value>* m_oBrush;
|
||||
bool m_bBrushColorInit;
|
||||
|
||||
v8::Local<v8::Value>* m_oFontManager;
|
||||
|
||||
v8::Local<v8::Value>* m_oCoordTransform;
|
||||
v8::Local<v8::Value>* m_oBaseTransform;
|
||||
v8::Local<v8::Value>* m_oTransform;
|
||||
v8::Local<v8::Value>* m_oFullTransform;
|
||||
v8::Local<v8::Value>* m_oInvertFullTransform;
|
||||
|
||||
v8::Local<v8::Value>* ArrayPoints;
|
||||
|
||||
CFont m_oCurFont;
|
||||
|
||||
v8::Local<v8::Value>* m_oTextPr;
|
||||
v8::Local<v8::Value>* m_oGrFonts;
|
||||
v8::Local<v8::Value>* m_oLastFont;
|
||||
|
||||
CLastFontOriginInfo LastFontOriginInfo;
|
||||
|
||||
bool m_bIntegerGrid;
|
||||
|
||||
v8::Local<v8::Value>* ClipManager;
|
||||
|
||||
int TextureFillTransformScaleX;
|
||||
int TextureFillTransformScaleY;
|
||||
bool IsThumbnail;
|
||||
|
||||
bool IsDemonstrationMode;
|
||||
|
||||
v8::Local<v8::Value>* GrState;
|
||||
|
||||
int globalAlpha;
|
||||
|
||||
v8::Local<v8::Value>* TextClipRect;
|
||||
bool IsClipContext;
|
||||
|
||||
bool IsUseFonts2;
|
||||
v8::Local<v8::Value>* m_oFontManager2;
|
||||
v8::Local<v8::Value>* m_oLastFont2;
|
||||
|
||||
bool ClearMode;
|
||||
bool IsRetina;
|
||||
|
||||
v8::Local<v8::Value>* dash_no_smart;
|
||||
public:
|
||||
CGraphics()
|
||||
{
|
||||
m_oContext = nullptr;
|
||||
m_dWidthMM = 0.0;
|
||||
m_dHeightMM = 0.0;
|
||||
m_lWidthPix = 0.0;
|
||||
m_lHeightPix = 0.0;
|
||||
m_dDpiX = 96.0;
|
||||
m_dDpiY = 96.0;
|
||||
m_bIsBreak = false;
|
||||
|
||||
m_oPen = nullptr; // new AscCommon.CPen();
|
||||
m_bPenColorInit = false;
|
||||
m_oBrush = nullptr; // new AscCommon.CBrush();
|
||||
m_bBrushColorInit = false;
|
||||
|
||||
m_oFontManager = nullptr;
|
||||
|
||||
m_oCoordTransform = nullptr; // new CMatrixL();
|
||||
m_oBaseTransform = nullptr; // new CMatrixL();
|
||||
m_oTransform = nullptr; // new CMatrixL();
|
||||
m_oFullTransform = nullptr; // new CMatrixL();
|
||||
m_oInvertFullTransform = nullptr; // new CMatrixL();
|
||||
|
||||
ArrayPoints = nullptr;
|
||||
|
||||
m_oTextPr = nullptr;
|
||||
m_oGrFonts = nullptr; // new AscCommon.CGrRFonts();
|
||||
m_oLastFont = nullptr; // new AscCommon.CFontSetup();
|
||||
|
||||
m_bIntegerGrid = true;
|
||||
|
||||
ClipManager = nullptr; // new AscCommon.CClipManager();
|
||||
// ClipManager.BaseObject = this;
|
||||
|
||||
TextureFillTransformScaleX = 1;
|
||||
TextureFillTransformScaleY = 1;
|
||||
IsThumbnail = false;
|
||||
|
||||
IsDemonstrationMode = false;
|
||||
|
||||
GrState = nullptr; // new AscCommon.CGrState();
|
||||
// GrState.Parent = this;
|
||||
|
||||
globalAlpha = 1;
|
||||
|
||||
TextClipRect = nullptr;
|
||||
IsClipContext = false;
|
||||
|
||||
IsUseFonts2 = false;
|
||||
m_oFontManager2 = nullptr;
|
||||
m_oLastFont2 = nullptr;
|
||||
|
||||
ClearMode = false;
|
||||
IsRetina = false;
|
||||
|
||||
dash_no_smart = nullptr;
|
||||
}
|
||||
~CGraphics()
|
||||
{
|
||||
if(m_oContext) delete m_oContext;
|
||||
if(m_oPen) delete m_oPen;
|
||||
if(m_oBrush) delete m_oBrush;
|
||||
if(m_oFontManager) delete m_oFontManager;
|
||||
if(m_oCoordTransform) delete m_oCoordTransform;
|
||||
if(m_oBaseTransform) delete m_oBaseTransform;
|
||||
if(m_oTransform) delete m_oTransform;
|
||||
if(m_oFullTransform) delete m_oFullTransform;
|
||||
if(m_oInvertFullTransform) delete m_oInvertFullTransform;
|
||||
if(ArrayPoints) delete ArrayPoints;
|
||||
if(m_oTextPr) delete m_oTextPr;
|
||||
if(m_oGrFonts) delete m_oGrFonts;
|
||||
if(m_oLastFont) delete m_oLastFont;
|
||||
if(LastFontOriginInfo.Replace) delete LastFontOriginInfo.Replace;
|
||||
if(ClipManager) delete ClipManager;
|
||||
if(GrState) delete GrState;
|
||||
if(TextClipRect) delete TextClipRect;
|
||||
if(m_oFontManager2) delete m_oFontManager2;
|
||||
if(m_oLastFont2) delete m_oLastFont2;
|
||||
if(dash_no_smart) delete dash_no_smart;
|
||||
}
|
||||
|
||||
void init(v8::Local<v8::Value>* context, double width_px, double height_px, double width_mm, double height_mm);
|
||||
void EndDraw() {}
|
||||
void put_GlobalAlpha(bool enable, int globalAlpha);
|
||||
void Start_GlobalAlpha() {}
|
||||
void End_GlobalAlpha();
|
||||
// pen methods
|
||||
void p_color(int r, int g, int b, int a);
|
||||
void p_width(int w);
|
||||
void p_dash(const v8::Local<v8::Value>& params);
|
||||
// brush methods
|
||||
void b_color1(int r, int g, int b, int a);
|
||||
void b_color2(int r, int g, int b, int a);
|
||||
void transform(double sx, double shy, double shx, double sy, double tx, double ty);
|
||||
void CalculateFullTransform(bool isInvertNeed);
|
||||
// path commands
|
||||
void _s();
|
||||
void _e();
|
||||
void _z();
|
||||
void _m(double x, double y);
|
||||
void _l(double x, double y);
|
||||
void _c(double x1, double y1, double x2, double y2, double x3, double y3);
|
||||
void _c2(double x1, double y1, double x2, double y2);
|
||||
void ds();
|
||||
void df();
|
||||
// canvas state
|
||||
void save();
|
||||
void restore();
|
||||
void clip();
|
||||
void reset();
|
||||
void transform3(const v8::Local<v8::Value>& m, bool isNeedInvert);
|
||||
void FreeFont();
|
||||
void ClearLastFont();
|
||||
// images
|
||||
void drawImage2(const v8::Local<v8::Value>& img, double x, double y, double w, double h, int alpha, const v8::Local<v8::Value>& srcRect);
|
||||
void drawImage(const v8::Local<v8::Value>& img, double x, double y, double w, double h, int alpha, const v8::Local<v8::Value>& srcRect, const v8::Local<v8::Value>& nativeImage);
|
||||
// text
|
||||
CFont GetFont();
|
||||
void font(unsigned int font_id, int font_size);
|
||||
void SetFont(const v8::Local<v8::Value>& font);
|
||||
void SetTextPr(const v8::Local<v8::Value>& textPr, const v8::Local<v8::Value>& theme);
|
||||
void SetFontSlot(const v8::Local<v8::Value>& slot, double fontSizeKoef);
|
||||
v8::Local<v8::Value> GetTextPr();
|
||||
void FillText(double x, double y, const v8::Local<v8::Value>& text);
|
||||
void t(const v8::Local<v8::Value>& text, double x, double y, bool isBounds);
|
||||
void FillText2(double x, double y, const v8::Local<v8::Value>& text, double cropX, double cropW);
|
||||
void t2(const v8::Local<v8::Value>& text, double x, double y, double cropX, double cropW);
|
||||
void FillTextCode(double x, double y, const v8::Local<v8::Value>& lUnicode);
|
||||
void tg(const v8::Local<v8::Value>& text, double x, double y);
|
||||
void charspace(const v8::Local<v8::Value>& space) {}
|
||||
// private methods
|
||||
void private_FillGlyph(const v8::Local<v8::Value>& pGlyph, const v8::Local<v8::Value>& _bounds);
|
||||
void private_FillGlyphC(const v8::Local<v8::Value>& pGlyph, double cropX, double cropW);
|
||||
void private_FillGlyph2(const v8::Local<v8::Value>& pGlyph);
|
||||
void SetIntegerGrid(bool param);
|
||||
bool GetIntegerGrid();
|
||||
void DrawStringASCII(const std::string& name, int size, bool bold, bool italic, const v8::Local<v8::Value>& text, double x, double y, bool bIsHeader);
|
||||
void DrawStringASCII2(const std::string& name, int size, bool bold, bool italic, const v8::Local<v8::Value>& text, double x, double y, bool bIsHeader);
|
||||
void DrawHeaderEdit(double yPos, const v8::Local<v8::Value>& lock_type, int sectionNum, bool bIsRepeat, const v8::Local<v8::Value>& type);
|
||||
void DrawFooterEdit(double yPos, const v8::Local<v8::Value>& lock_type, int sectionNum, bool bIsRepeat, const v8::Local<v8::Value>& type);
|
||||
void DrawLockParagraph(const v8::Local<v8::Value>& lock_type, double x, double y1, double y2);
|
||||
void DrawLockObjectRect(const v8::Local<v8::Value>& lock_type, double x, double y, double w, double h);
|
||||
void DrawEmptyTableLine(double x1, double y1, double x2, double y2);
|
||||
void DrawSpellingLine(double y0, double x0, double x1, double w);
|
||||
// smart methods for horizontal / vertical lines
|
||||
void drawHorLine(int align, double y, double x, double r, int penW);
|
||||
void drawHorLine2(int align, double y, double x, double r, int penW);
|
||||
void drawVerLine(int align, double x, double y, double b, int penW);
|
||||
// мега крутые функции для таблиц
|
||||
void drawHorLineExt(int align, double y, double x, double r, int penW, double leftMW, double rightMW);
|
||||
void rect(double x, double y, double w, double h);
|
||||
void TableRect(double x, double y, double w, double h);
|
||||
// функции клиппирования
|
||||
void AddClipRect(double x, double y, double w, double h);
|
||||
void RemoveClipRect() {}
|
||||
void SetClip(const v8::Local<v8::Value>& r);
|
||||
void RemoveClip();
|
||||
void drawCollaborativeChanges(double x, double y, double w, double h, const v8::Local<v8::Value>& Color);
|
||||
void drawMailMergeField(double x, double y, double w, double h);
|
||||
void drawSearchResult(double x, double y, double w, double h);
|
||||
void drawFlowAnchor(double x, double y);
|
||||
void SavePen();
|
||||
void RestorePen();
|
||||
void SaveBrush();
|
||||
void RestoreBrush();
|
||||
void SavePenBrush();
|
||||
void RestorePenBrush();
|
||||
void SaveGrState();
|
||||
void RestoreGrState();
|
||||
void StartClipPath() {}
|
||||
void EndClipPath();
|
||||
void StartCheckTableDraw();
|
||||
void EndCheckTableDraw(bool bIsRestore);
|
||||
void SetTextClipRect(double _l, double _t, double _r, double _b);
|
||||
void AddSmartRect(double x, double y, double w, double h, int pen_w);
|
||||
void CheckUseFonts2(const v8::Local<v8::Value>& _transform);
|
||||
void UncheckUseFonts2();
|
||||
void Drawing_StartCheckBounds(double x, double y, double w, double h) {}
|
||||
void Drawing_EndCheckBounds() {}
|
||||
void DrawPresentationComment(const v8::Local<v8::Value>& type, double x, double y, double w, double h);
|
||||
void DrawPolygon(const v8::Local<v8::Value>& oPath, int lineWidth, double shift);
|
||||
void DrawFootnoteRect(double x, double y, double w, double h);
|
||||
|
||||
v8::Local<v8::Value>* g_m_oContext() { return m_oContext; }
|
||||
v8::Local<v8::Value>* g_m_oPen() { return m_oPen; }
|
||||
v8::Local<v8::Value>* g_m_oBrush() { return m_oBrush; }
|
||||
v8::Local<v8::Value>* g_m_oFontManager() { return m_oFontManager; }
|
||||
v8::Local<v8::Value>* g_m_oCoordTransform() { return m_oCoordTransform; }
|
||||
v8::Local<v8::Value>* g_m_oBaseTransform() { return m_oBaseTransform; }
|
||||
v8::Local<v8::Value>* g_m_oTransform() { return m_oTransform; }
|
||||
v8::Local<v8::Value>* g_m_oFullTransform() { return m_oFullTransform; }
|
||||
v8::Local<v8::Value>* g_m_oInvertFullTransform() { return m_oInvertFullTransform; }
|
||||
v8::Local<v8::Value>* g_ArrayPoints() { return ArrayPoints; }
|
||||
v8::Local<v8::Value>* g_m_oTextPr() { return m_oTextPr; }
|
||||
v8::Local<v8::Value>* g_m_oGrFonts() { return m_oGrFonts; }
|
||||
v8::Local<v8::Value>* g_m_oLastFont() { return m_oLastFont; }
|
||||
v8::Local<v8::Value>* g_ClipManager() { return ClipManager; }
|
||||
v8::Local<v8::Value>* g_GrState() { return GrState; }
|
||||
v8::Local<v8::Value>* g_TextClipRect() { return TextClipRect; }
|
||||
v8::Local<v8::Value>* g_m_oFontManager2() { return m_oFontManager2; }
|
||||
v8::Local<v8::Value>* g_m_oLastFont2() { return m_oLastFont2; }
|
||||
v8::Local<v8::Value>* g_dash_no_smart() { return dash_no_smart; }
|
||||
double g_m_dWidthMM() { return m_dWidthMM; }
|
||||
double g_m_dHeightMM() { return m_dHeightMM; }
|
||||
double g_m_lWidthPix() { return m_lWidthPix; }
|
||||
double g_m_lHeightPix() { return m_lHeightPix; }
|
||||
double g_m_dDpiX() { return m_dDpiX; }
|
||||
double g_m_dDpiY() { return m_dDpiY; }
|
||||
bool g_m_bIsBreak() { return m_bIsBreak; }
|
||||
bool g_m_bPenColorInit() { return m_bPenColorInit; }
|
||||
bool g_m_bBrushColorInit() { return m_bBrushColorInit; }
|
||||
bool g_m_bIntegerGrid() { return m_bIntegerGrid; }
|
||||
bool g_IsThumbnail() { return IsThumbnail; }
|
||||
bool g_IsDemonstrationMode() { return IsDemonstrationMode; }
|
||||
bool g_IsClipContext() { return IsClipContext; }
|
||||
bool g_IsUseFonts2() { return IsUseFonts2; }
|
||||
bool g_ClearMode() { return ClearMode; }
|
||||
bool g_IsRetina() { return IsRetina; }
|
||||
CFont g_m_oCurFont() { return m_oCurFont; }
|
||||
CLastFontOriginInfo g_LastFontOriginInfo() { return LastFontOriginInfo; }
|
||||
int g_TextureFillTransformScaleX() { return TextureFillTransformScaleX; }
|
||||
int g_TextureFillTransformScaleY() { return TextureFillTransformScaleY; }
|
||||
int g_globalAlpha() { return globalAlpha; }
|
||||
|
||||
void s_m_oContext (v8::Local<v8::Value>* a) { m_oContext = a; }
|
||||
void s_m_oPen (v8::Local<v8::Value>* a) { m_oPen = a; }
|
||||
void s_m_oBrush (v8::Local<v8::Value>* a) { m_oBrush = a; }
|
||||
void s_m_oFontManager (v8::Local<v8::Value>* a) { m_oFontManager = a; }
|
||||
void s_m_oCoordTransform (v8::Local<v8::Value>* a) { m_oCoordTransform = a; }
|
||||
void s_m_oBaseTransform (v8::Local<v8::Value>* a) { m_oBaseTransform = a; }
|
||||
void s_m_oTransform (v8::Local<v8::Value>* a) { m_oTransform = a; }
|
||||
void s_m_oFullTransform (v8::Local<v8::Value>* a) { m_oFullTransform = a; }
|
||||
void s_m_oInvertFullTransform(v8::Local<v8::Value>* a) { m_oInvertFullTransform = a; }
|
||||
void s_ArrayPoints (v8::Local<v8::Value>* a) { ArrayPoints = a; }
|
||||
void s_m_oTextPr (v8::Local<v8::Value>* a) { m_oTextPr = a; }
|
||||
void s_m_oGrFonts (v8::Local<v8::Value>* a) { m_oGrFonts = a; }
|
||||
void s_m_oLastFont (v8::Local<v8::Value>* a) { m_oLastFont = a; }
|
||||
void s_ClipManager (v8::Local<v8::Value>* a) { ClipManager = a; }
|
||||
void s_GrState (v8::Local<v8::Value>* a) { GrState = a; }
|
||||
void s_TextClipRect (v8::Local<v8::Value>* a) { TextClipRect = a; }
|
||||
void s_m_oFontManager2 (v8::Local<v8::Value>* a) { m_oFontManager2 = a; }
|
||||
void s_m_oLastFont2 (v8::Local<v8::Value>* a) { m_oLastFont2 = a; }
|
||||
void s_dash_no_smart (v8::Local<v8::Value>* a) { dash_no_smart = a; }
|
||||
void s_m_dWidthMM (double a) { m_dWidthMM = a; }
|
||||
void s_m_dHeightMM (double a) { m_dHeightMM = a; }
|
||||
void s_m_lWidthPix (double a) { m_lWidthPix = a; }
|
||||
void s_m_lHeightPix (double a) { m_lHeightPix = a; }
|
||||
void s_m_dDpiX (double a) { m_dDpiX = a; }
|
||||
void s_m_dDpiY (double a) { m_dDpiY = a; }
|
||||
void s_m_bIsBreak (bool a) { m_bIsBreak = a; }
|
||||
void s_m_bPenColorInit (bool a) { m_bPenColorInit = a; }
|
||||
void s_m_bBrushColorInit (bool a) { m_bBrushColorInit = a; }
|
||||
void s_m_bIntegerGrid (bool a) { m_bIntegerGrid = a; }
|
||||
void s_IsThumbnail (bool a) { IsThumbnail = a; }
|
||||
void s_IsDemonstrationMode(bool a) { IsDemonstrationMode = a; }
|
||||
void s_IsClipContext (bool a) { IsClipContext = a; }
|
||||
void s_IsUseFonts2 (bool a) { IsUseFonts2 = a; }
|
||||
void s_ClearMode (bool a) { ClearMode = a; }
|
||||
void s_IsRetina (bool a) { IsRetina = a; }
|
||||
void s_m_oCurFont (CFont a) { m_oCurFont = a; }
|
||||
void s_LastFontOriginInfo(CLastFontOriginInfo a) { LastFontOriginInfo = a; }
|
||||
void s_TextureFillTransformScaleX(int a) { TextureFillTransformScaleX = a; }
|
||||
void s_TextureFillTransformScaleY(int a) { TextureFillTransformScaleY = a; }
|
||||
void s_globalAlpha (int a) { globalAlpha = a; }
|
||||
};
|
||||
}
|
||||
|
||||
#endif // CGRAPHICS_H
|
||||
@ -0,0 +1,97 @@
|
||||
#include "./GraphicsEmbed.h"
|
||||
|
||||
JSSmart<CJSValue> CGraphicsEmbed::init(JSSmart<CJSValue> context, JSSmart<CJSValue> width_px, JSSmart<CJSValue> height_px, JSSmart<CJSValue> width_mm, JSSmart<CJSValue> height_mm)
|
||||
{
|
||||
m_pInternal->init(context->toObject(), width_px->toDouble(), height_px->toDouble(), width_mm->toDouble(), height_mm->toDouble());
|
||||
return NULL;
|
||||
}
|
||||
JSSmart<CJSValue> CGraphicsEmbed::EndDraw() {}
|
||||
JSSmart<CJSValue> CGraphicsEmbed::put_GlobalAlpha(JSSmart<CJSValue> enable, JSSmart<CJSValue> globalAlpha);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::Start_GlobalAlpha() {}
|
||||
JSSmart<CJSValue> CGraphicsEmbed::End_GlobalAlpha();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::p_color(JSSmart<CJSValue> r, JSSmart<CJSValue> g, JSSmart<CJSValue> b, JSSmart<CJSValue> a);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::p_width(JSSmart<CJSValue> w);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::p_dash(JSSmart<CJSValue> params);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::b_color1(JSSmart<CJSValue> r, JSSmart<CJSValue> g, JSSmart<CJSValue> b, JSSmart<CJSValue> a);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::b_color2(JSSmart<CJSValue> r, JSSmart<CJSValue> g, JSSmart<CJSValue> b, JSSmart<CJSValue> a);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::transform(JSSmart<CJSValue> sx, JSSmart<CJSValue> shy, JSSmart<CJSValue> shx, JSSmart<CJSValue> sy, JSSmart<CJSValue> tx, JSSmart<CJSValue> ty);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::CalculateFullTransform(JSSmart<CJSValue> isInvertNeed);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::_s();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::_e();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::_z();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::_m (JSSmart<CJSValue> x, JSSmart<CJSValue> y);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::_l (JSSmart<CJSValue> x, JSSmart<CJSValue> y);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::_c (JSSmart<CJSValue> x1, JSSmart<CJSValue> y1, JSSmart<CJSValue> x2, JSSmart<CJSValue> y2, JSSmart<CJSValue> x3, JSSmart<CJSValue> y3);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::_c2(JSSmart<CJSValue> x1, JSSmart<CJSValue> y1, JSSmart<CJSValue> x2, JSSmart<CJSValue> y2);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::ds();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::df();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::save();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::restore();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::clip();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::reset();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::transform3(JSSmart<CJSValue> m, JSSmart<CJSValue> isNeedInvert);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::FreeFont();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::ClearLastFont();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::drawImage2(JSSmart<CJSValue> img, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h, JSSmart<CJSValue> alpha, JSSmart<CJSValue> srcRect);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::drawImage (JSSmart<CJSValue> img, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h, JSSmart<CJSValue> alpha, JSSmart<CJSValue> srcRect, JSSmart<CJSValue> nativeImage);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::GetFont();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::font(JSSmart<CJSValue> font_id, JSSmart<CJSValue> font_size);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::SetFont(JSSmart<CJSValue> font);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::SetTextPr(JSSmart<CJSValue> textPr, JSSmart<CJSValue> theme);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::SetFontSlot(JSSmart<CJSValue> slot, JSSmart<CJSValue> fontSizeKoef);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::GetTextPr();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::FillText(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> text);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::t(JSSmart<CJSValue> text, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> isBounds);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::FillText2(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> text, JSSmart<CJSValue> cropX, JSSmart<CJSValue> cropW);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::t2(JSSmart<CJSValue> text, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> cropX, JSSmart<CJSValue> cropW);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::FillTextCode(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> lUnicode);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::tg(JSSmart<CJSValue> text, JSSmart<CJSValue> x, JSSmart<CJSValue> y);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::charspace(JSSmart<CJSValue> space) {}
|
||||
JSSmart<CJSValue> CGraphicsEmbed::private_FillGlyph (JSSmart<CJSValue> pGlyph, JSSmart<CJSValue> _bounds);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::private_FillGlyphC(JSSmart<CJSValue> pGlyph, JSSmart<CJSValue> cropX, JSSmart<CJSValue> cropW);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::private_FillGlyph2(JSSmart<CJSValue> pGlyph);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::SetIntegerGrid(JSSmart<CJSValue> param);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::GetIntegerGrid();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::DrawStringASCII (JSSmart<CJSValue> name, JSSmart<CJSValue> size, JSSmart<CJSValue> bold, JSSmart<CJSValue> italic, JSSmart<CJSValue> text, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> bIsHeader);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::DrawStringASCII2(JSSmart<CJSValue> name, JSSmart<CJSValue> size, JSSmart<CJSValue> bold, JSSmart<CJSValue> italic, JSSmart<CJSValue> text, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> bIsHeader);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::DrawHeaderEdit(JSSmart<CJSValue> yPos, JSSmart<CJSValue> lock_type, JSSmart<CJSValue> sectionNum, JSSmart<CJSValue> bIsRepeat, JSSmart<CJSValue> type);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::DrawFooterEdit(JSSmart<CJSValue> yPos, JSSmart<CJSValue> lock_type, JSSmart<CJSValue> sectionNum, JSSmart<CJSValue> bIsRepeat, JSSmart<CJSValue> type);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::DrawLockParagraph (JSSmart<CJSValue> lock_type, JSSmart<CJSValue> x, JSSmart<CJSValue> y1, JSSmart<CJSValue> y2);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::DrawLockObjectRect(JSSmart<CJSValue> lock_type, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::DrawEmptyTableLine(JSSmart<CJSValue> x1, JSSmart<CJSValue> y1, JSSmart<CJSValue> x2, JSSmart<CJSValue> y2);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::DrawSpellingLine (JSSmart<CJSValue> y0, JSSmart<CJSValue> x0, JSSmart<CJSValue> x1, JSSmart<CJSValue> w);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::drawHorLine (JSSmart<CJSValue> align, JSSmart<CJSValue> y, JSSmart<CJSValue> x, JSSmart<CJSValue> r, JSSmart<CJSValue> penW);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::drawHorLine2(JSSmart<CJSValue> align, JSSmart<CJSValue> y, JSSmart<CJSValue> x, JSSmart<CJSValue> r, JSSmart<CJSValue> penW);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::drawVerLine (JSSmart<CJSValue> align, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> b, JSSmart<CJSValue> penW);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::drawHorLineExt(JSSmart<CJSValue> align, JSSmart<CJSValue> y, JSSmart<CJSValue> x, JSSmart<CJSValue> r, JSSmart<CJSValue> penW, JSSmart<CJSValue> leftMW, JSSmart<CJSValue> rightMW);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::rect (JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::TableRect(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::AddClipRect(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::RemoveClipRect() {}
|
||||
JSSmart<CJSValue> CGraphicsEmbed::SetClip(JSSmart<CJSValue> r);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::RemoveClip();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::drawCollaborativeChanges(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h, JSSmart<CJSValue> Color);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::drawMailMergeField(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::drawSearchResult (JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::drawFlowAnchor (JSSmart<CJSValue> x, JSSmart<CJSValue> y);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::SavePen();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::RestorePen();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::SaveBrush();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::RestoreBrush();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::SavePenBrush();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::RestorePenBrush();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::SaveGrState();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::RestoreGrState();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::StartClipPath() {}
|
||||
JSSmart<CJSValue> CGraphicsEmbed::EndClipPath();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::StartCheckTableDraw();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::EndCheckTableDraw(JSSmart<CJSValue> bIsRestore);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::SetTextClipRect(JSSmart<CJSValue> _l, JSSmart<CJSValue> _t, JSSmart<CJSValue> _r, JSSmart<CJSValue> _b);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::AddSmartRect (JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h, JSSmart<CJSValue> pen_w);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::CheckUseFonts2 (JSSmart<CJSValue> _transform);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::UncheckUseFonts2();
|
||||
JSSmart<CJSValue> CGraphicsEmbed::Drawing_StartCheckBounds(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h) {}
|
||||
JSSmart<CJSValue> CGraphicsEmbed::Drawing_EndCheckBounds() {}
|
||||
JSSmart<CJSValue> CGraphicsEmbed::DrawPresentationComment(JSSmart<CJSValue> type, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::DrawPolygon(JSSmart<CJSValue> oPath, JSSmart<CJSValue> lineWidth, JSSmart<CJSValue> shift);
|
||||
JSSmart<CJSValue> CGraphicsEmbed::DrawFootnoteRect(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
|
||||
125
DesktopEditor/doctrenderer/js_internal/embed/GraphicsEmbed.h
Normal file
125
DesktopEditor/doctrenderer/js_internal/embed/GraphicsEmbed.h
Normal file
@ -0,0 +1,125 @@
|
||||
#ifndef _BUILD_NATIVE_GRAPHICS_EMBED_H_
|
||||
#define _BUILD_NATIVE_GRAPHICS_EMBED_H_
|
||||
|
||||
#include "../../graphics.h"
|
||||
#include "../js_base.h"
|
||||
|
||||
using namespace NSJSBase;
|
||||
class CGraphicsEmbed : public CJSEmbedObject
|
||||
{
|
||||
public:
|
||||
NSGraphics::CGraphics* m_pInternal;
|
||||
|
||||
public:
|
||||
CGraphicsEmbed() : m_pInternal(new NSGraphics::CGraphics()) {}
|
||||
~CGraphicsEmbed() { RELEASEOBJECT(m_pInternal); }
|
||||
|
||||
virtual void* getObject() { return (void*)m_pInternal; }
|
||||
|
||||
public:
|
||||
JSSmart<CJSValue> init(JSSmart<CJSValue> context, JSSmart<CJSValue> width_px, JSSmart<CJSValue> height_px, JSSmart<CJSValue> width_mm, JSSmart<CJSValue> height_mm);
|
||||
JSSmart<CJSValue> EndDraw() {}
|
||||
JSSmart<CJSValue> put_GlobalAlpha(JSSmart<CJSValue> enable, JSSmart<CJSValue> globalAlpha);
|
||||
JSSmart<CJSValue> Start_GlobalAlpha() {}
|
||||
JSSmart<CJSValue> End_GlobalAlpha();
|
||||
// pen methods
|
||||
JSSmart<CJSValue> p_color(JSSmart<CJSValue> r, JSSmart<CJSValue> g, JSSmart<CJSValue> b, JSSmart<CJSValue> a);
|
||||
JSSmart<CJSValue> p_width(JSSmart<CJSValue> w);
|
||||
JSSmart<CJSValue> p_dash(JSSmart<CJSValue> params);
|
||||
// brush methods
|
||||
JSSmart<CJSValue> b_color1(JSSmart<CJSValue> r, JSSmart<CJSValue> g, JSSmart<CJSValue> b, JSSmart<CJSValue> a);
|
||||
JSSmart<CJSValue> b_color2(JSSmart<CJSValue> r, JSSmart<CJSValue> g, JSSmart<CJSValue> b, JSSmart<CJSValue> a);
|
||||
JSSmart<CJSValue> transform(JSSmart<CJSValue> sx, JSSmart<CJSValue> shy, JSSmart<CJSValue> shx, JSSmart<CJSValue> sy, JSSmart<CJSValue> tx, JSSmart<CJSValue> ty);
|
||||
JSSmart<CJSValue> CalculateFullTransform(JSSmart<CJSValue> isInvertNeed);
|
||||
// path commands
|
||||
JSSmart<CJSValue> _s();
|
||||
JSSmart<CJSValue> _e();
|
||||
JSSmart<CJSValue> _z();
|
||||
JSSmart<CJSValue> _m (JSSmart<CJSValue> x, JSSmart<CJSValue> y);
|
||||
JSSmart<CJSValue> _l (JSSmart<CJSValue> x, JSSmart<CJSValue> y);
|
||||
JSSmart<CJSValue> _c (JSSmart<CJSValue> x1, JSSmart<CJSValue> y1, JSSmart<CJSValue> x2, JSSmart<CJSValue> y2, JSSmart<CJSValue> x3, JSSmart<CJSValue> y3);
|
||||
JSSmart<CJSValue> _c2(JSSmart<CJSValue> x1, JSSmart<CJSValue> y1, JSSmart<CJSValue> x2, JSSmart<CJSValue> y2);
|
||||
JSSmart<CJSValue> ds();
|
||||
JSSmart<CJSValue> df();
|
||||
// canvas state
|
||||
JSSmart<CJSValue> save();
|
||||
JSSmart<CJSValue> restore();
|
||||
JSSmart<CJSValue> clip();
|
||||
JSSmart<CJSValue> reset();
|
||||
JSSmart<CJSValue> transform3(JSSmart<CJSValue> m, JSSmart<CJSValue> isNeedInvert);
|
||||
JSSmart<CJSValue> FreeFont();
|
||||
JSSmart<CJSValue> ClearLastFont();
|
||||
// images
|
||||
JSSmart<CJSValue> drawImage2(JSSmart<CJSValue> img, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h, JSSmart<CJSValue> alpha, JSSmart<CJSValue> srcRect);
|
||||
JSSmart<CJSValue> drawImage (JSSmart<CJSValue> img, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h, JSSmart<CJSValue> alpha, JSSmart<CJSValue> srcRect, JSSmart<CJSValue> nativeImage);
|
||||
// text
|
||||
JSSmart<CJSValue> GetFont();
|
||||
JSSmart<CJSValue> font(JSSmart<CJSValue> font_id, JSSmart<CJSValue> font_size);
|
||||
JSSmart<CJSValue> SetFont(JSSmart<CJSValue> font);
|
||||
JSSmart<CJSValue> SetTextPr(JSSmart<CJSValue> textPr, JSSmart<CJSValue> theme);
|
||||
JSSmart<CJSValue> SetFontSlot(JSSmart<CJSValue> slot, JSSmart<CJSValue> fontSizeKoef);
|
||||
JSSmart<CJSValue> GetTextPr();
|
||||
JSSmart<CJSValue> FillText(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> text);
|
||||
JSSmart<CJSValue> t(JSSmart<CJSValue> text, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> isBounds);
|
||||
JSSmart<CJSValue> FillText2(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> text, JSSmart<CJSValue> cropX, JSSmart<CJSValue> cropW);
|
||||
JSSmart<CJSValue> t2(JSSmart<CJSValue> text, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> cropX, JSSmart<CJSValue> cropW);
|
||||
JSSmart<CJSValue> FillTextCode(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> lUnicode);
|
||||
JSSmart<CJSValue> tg(JSSmart<CJSValue> text, JSSmart<CJSValue> x, JSSmart<CJSValue> y);
|
||||
JSSmart<CJSValue> charspace(JSSmart<CJSValue> space) {}
|
||||
// private methods
|
||||
JSSmart<CJSValue> private_FillGlyph (JSSmart<CJSValue> pGlyph, JSSmart<CJSValue> _bounds);
|
||||
JSSmart<CJSValue> private_FillGlyphC(JSSmart<CJSValue> pGlyph, JSSmart<CJSValue> cropX, JSSmart<CJSValue> cropW);
|
||||
JSSmart<CJSValue> private_FillGlyph2(JSSmart<CJSValue> pGlyph);
|
||||
JSSmart<CJSValue> SetIntegerGrid(JSSmart<CJSValue> param);
|
||||
JSSmart<CJSValue> GetIntegerGrid();
|
||||
JSSmart<CJSValue> DrawStringASCII (JSSmart<CJSValue> name, JSSmart<CJSValue> size, JSSmart<CJSValue> bold, JSSmart<CJSValue> italic, JSSmart<CJSValue> text, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> bIsHeader);
|
||||
JSSmart<CJSValue> DrawStringASCII2(JSSmart<CJSValue> name, JSSmart<CJSValue> size, JSSmart<CJSValue> bold, JSSmart<CJSValue> italic, JSSmart<CJSValue> text, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> bIsHeader);
|
||||
JSSmart<CJSValue> DrawHeaderEdit(JSSmart<CJSValue> yPos, JSSmart<CJSValue> lock_type, JSSmart<CJSValue> sectionNum, JSSmart<CJSValue> bIsRepeat, JSSmart<CJSValue> type);
|
||||
JSSmart<CJSValue> DrawFooterEdit(JSSmart<CJSValue> yPos, JSSmart<CJSValue> lock_type, JSSmart<CJSValue> sectionNum, JSSmart<CJSValue> bIsRepeat, JSSmart<CJSValue> type);
|
||||
JSSmart<CJSValue> DrawLockParagraph (JSSmart<CJSValue> lock_type, JSSmart<CJSValue> x, JSSmart<CJSValue> y1, JSSmart<CJSValue> y2);
|
||||
JSSmart<CJSValue> DrawLockObjectRect(JSSmart<CJSValue> lock_type, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
|
||||
JSSmart<CJSValue> DrawEmptyTableLine(JSSmart<CJSValue> x1, JSSmart<CJSValue> y1, JSSmart<CJSValue> x2, JSSmart<CJSValue> y2);
|
||||
JSSmart<CJSValue> DrawSpellingLine (JSSmart<CJSValue> y0, JSSmart<CJSValue> x0, JSSmart<CJSValue> x1, JSSmart<CJSValue> w);
|
||||
// smart methods for horizontal / vertical lines
|
||||
JSSmart<CJSValue> drawHorLine (JSSmart<CJSValue> align, JSSmart<CJSValue> y, JSSmart<CJSValue> x, JSSmart<CJSValue> r, JSSmart<CJSValue> penW);
|
||||
JSSmart<CJSValue> drawHorLine2(JSSmart<CJSValue> align, JSSmart<CJSValue> y, JSSmart<CJSValue> x, JSSmart<CJSValue> r, JSSmart<CJSValue> penW);
|
||||
JSSmart<CJSValue> drawVerLine (JSSmart<CJSValue> align, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> b, JSSmart<CJSValue> penW);
|
||||
// мега крутые функции для таблиц
|
||||
JSSmart<CJSValue> drawHorLineExt(JSSmart<CJSValue> align, JSSmart<CJSValue> y, JSSmart<CJSValue> x, JSSmart<CJSValue> r, JSSmart<CJSValue> penW, JSSmart<CJSValue> leftMW, JSSmart<CJSValue> rightMW);
|
||||
JSSmart<CJSValue> rect (JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
|
||||
JSSmart<CJSValue> TableRect(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
|
||||
// функции клиппирования
|
||||
JSSmart<CJSValue> AddClipRect(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
|
||||
JSSmart<CJSValue> RemoveClipRect() {}
|
||||
JSSmart<CJSValue> SetClip(JSSmart<CJSValue> r);
|
||||
JSSmart<CJSValue> RemoveClip();
|
||||
JSSmart<CJSValue> drawCollaborativeChanges(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h, JSSmart<CJSValue> Color);
|
||||
JSSmart<CJSValue> drawMailMergeField(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
|
||||
JSSmart<CJSValue> drawSearchResult (JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
|
||||
JSSmart<CJSValue> drawFlowAnchor (JSSmart<CJSValue> x, JSSmart<CJSValue> y);
|
||||
JSSmart<CJSValue> SavePen();
|
||||
JSSmart<CJSValue> RestorePen();
|
||||
JSSmart<CJSValue> SaveBrush();
|
||||
JSSmart<CJSValue> RestoreBrush();
|
||||
JSSmart<CJSValue> SavePenBrush();
|
||||
JSSmart<CJSValue> RestorePenBrush();
|
||||
JSSmart<CJSValue> SaveGrState();
|
||||
JSSmart<CJSValue> RestoreGrState();
|
||||
JSSmart<CJSValue> StartClipPath() {}
|
||||
JSSmart<CJSValue> EndClipPath();
|
||||
JSSmart<CJSValue> StartCheckTableDraw();
|
||||
JSSmart<CJSValue> EndCheckTableDraw(JSSmart<CJSValue> bIsRestore);
|
||||
JSSmart<CJSValue> SetTextClipRect(JSSmart<CJSValue> _l, JSSmart<CJSValue> _t, JSSmart<CJSValue> _r, JSSmart<CJSValue> _b);
|
||||
JSSmart<CJSValue> AddSmartRect (JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h, JSSmart<CJSValue> pen_w);
|
||||
JSSmart<CJSValue> CheckUseFonts2 (JSSmart<CJSValue> _transform);
|
||||
JSSmart<CJSValue> UncheckUseFonts2();
|
||||
JSSmart<CJSValue> Drawing_StartCheckBounds(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h) {}
|
||||
JSSmart<CJSValue> Drawing_EndCheckBounds() {}
|
||||
JSSmart<CJSValue> DrawPresentationComment(JSSmart<CJSValue> type, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
|
||||
JSSmart<CJSValue> DrawPolygon(JSSmart<CJSValue> oPath, JSSmart<CJSValue> lineWidth, JSSmart<CJSValue> shift);
|
||||
JSSmart<CJSValue> DrawFootnoteRect(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
|
||||
|
||||
static void CreateObjectInContext(const std::string& name, JSSmart<CJSContext> context);
|
||||
};
|
||||
|
||||
#endif // _BUILD_NATIVE_GRAPHICS_EMBED_H_
|
||||
@ -1,47 +1,344 @@
|
||||
#include "graphics_wrapper.h"
|
||||
#include "../GraphicsEmbed.h"
|
||||
#include "../../v8/v8_base.h"
|
||||
|
||||
#include <string>
|
||||
#define PROPERTY_GET(NAME, NAME_EMBED, TYPE) \
|
||||
void NAME(v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info) \
|
||||
{ \
|
||||
CURRENTWRAPPER* _this = (CURRENTWRAPPER*)unwrap_native(info.Holder()); \
|
||||
info.GetReturnValue().Set(TYPE::New(v8::Isolate::GetCurrent(), _this->->m_pInternal->NAME_EMBED())) \
|
||||
}
|
||||
|
||||
static double to_double(const v8::Local<v8::Value>& v)
|
||||
#define PROPERTY_GET_OBJECT(NAME, NAME_EMBED) \
|
||||
void NAME(v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info) \
|
||||
{ \
|
||||
CURRENTWRAPPER* _this = (CURRENTWRAPPER*)unwrap_native(info.Holder()); \
|
||||
v8::Local<v8::Value>* v = _this->m_pInternal->NAME_EMBED(); \
|
||||
if(v) info.GetReturnValue().Set(*v); \
|
||||
else info.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent())); \
|
||||
}
|
||||
|
||||
namespace NSGraphics
|
||||
{
|
||||
return v->ToNumber(v8::Isolate::GetCurrent()->GetCurrentContext()).FromMaybe(v8::Local<v8::Number>())->Value();
|
||||
}
|
||||
static bool to_bool (const v8::Local<v8::Value>& v)
|
||||
{
|
||||
return v->ToBoolean(v8::Isolate::GetCurrent()->GetCurrentContext()).FromMaybe(v8::Local<v8::Boolean>())->Value();
|
||||
}
|
||||
static int to_int (const v8::Local<v8::Value>& v)
|
||||
{
|
||||
return v->ToInt32(v8::Isolate::GetCurrent()->GetCurrentContext()).FromMaybe(v8::Local<v8::Int32>())->Value();
|
||||
}
|
||||
static unsigned int to_uint (const v8::Local<v8::Value>& v)
|
||||
{
|
||||
return v->ToUint32(v8::Isolate::GetCurrent()->GetCurrentContext()).FromMaybe(v8::Local<v8::Uint32>())->Value();
|
||||
}
|
||||
static std::string to_string(const v8::Local<v8::Value>& v)
|
||||
{
|
||||
v8::String::Utf8Value data(v);
|
||||
const char* p = *data;
|
||||
if (p == NULL) return std::string();
|
||||
return std::string(p);
|
||||
#define CURRENTWRAPPER CGraphicsEmbed
|
||||
|
||||
// FUNCTION
|
||||
FUNCTION_WRAPPER_V8_5(_init, init)
|
||||
FUNCTION_WRAPPER_V8 (_EndDraw, EndDraw)
|
||||
FUNCTION_WRAPPER_V8_2(_put_GlobalAlpha, put_GlobalAlpha)
|
||||
FUNCTION_WRAPPER_V8 (_Start_GlobalAlpha, Start_GlobalAlpha)
|
||||
FUNCTION_WRAPPER_V8 (_End_GlobalAlpha, End_GlobalAlpha)
|
||||
// pen methods
|
||||
FUNCTION_WRAPPER_V8_4(_p_color, p_color)
|
||||
FUNCTION_WRAPPER_V8_1(_p_width, p_width)
|
||||
FUNCTION_WRAPPER_V8_1(_p_dash, p_dash)
|
||||
// brush methods
|
||||
FUNCTION_WRAPPER_V8_4(_b_color1, b_color1)
|
||||
FUNCTION_WRAPPER_V8_4(_b_color2, b_color2)
|
||||
FUNCTION_WRAPPER_V8_6(_transform, transform)
|
||||
FUNCTION_WRAPPER_V8_1(_CalculateFullTransform, CalculateFullTransform)
|
||||
// path commands
|
||||
FUNCTION_WRAPPER_V8 (__s, _s)
|
||||
FUNCTION_WRAPPER_V8 (__e, _e)
|
||||
FUNCTION_WRAPPER_V8 (__z, _z)
|
||||
FUNCTION_WRAPPER_V8_2(__m, _m)
|
||||
FUNCTION_WRAPPER_V8_2(__l, _l)
|
||||
FUNCTION_WRAPPER_V8_6(__c, _c)
|
||||
FUNCTION_WRAPPER_V8_4(__c2, _c2)
|
||||
FUNCTION_WRAPPER_V8 (_ds, ds)
|
||||
FUNCTION_WRAPPER_V8 (_df, df)
|
||||
// canvas state
|
||||
FUNCTION_WRAPPER_V8 (_save, save)
|
||||
FUNCTION_WRAPPER_V8 (_restore, restore)
|
||||
FUNCTION_WRAPPER_V8 (_clip, clip)
|
||||
FUNCTION_WRAPPER_V8 (_reset, reset)
|
||||
FUNCTION_WRAPPER_V8_2(_transform3, transform3)
|
||||
FUNCTION_WRAPPER_V8 (_FreeFont, FreeFont)
|
||||
FUNCTION_WRAPPER_V8 (_ClearLastFont, ClearLastFont)
|
||||
// images
|
||||
FUNCTION_WRAPPER_V8_7(_drawImage2, drawImage2)
|
||||
FUNCTION_WRAPPER_V8_8(_drawImage, drawImage)
|
||||
// text
|
||||
FUNCTION_WRAPPER_V8 (_GetFont, GetFont)
|
||||
FUNCTION_WRAPPER_V8_2(_font, font)
|
||||
FUNCTION_WRAPPER_V8_1(_SetFont, SetFont)
|
||||
FUNCTION_WRAPPER_V8_2(_SetTextPr, SetTextPr)
|
||||
FUNCTION_WRAPPER_V8_2(_SetFontSlot, SetFontSlot)
|
||||
FUNCTION_WRAPPER_V8 (_GetTextPr, GetTextPr)
|
||||
FUNCTION_WRAPPER_V8_3(_FillText, FillText)
|
||||
FUNCTION_WRAPPER_V8_4(_t, t)
|
||||
FUNCTION_WRAPPER_V8_5(_FillText2, FillText2)
|
||||
FUNCTION_WRAPPER_V8_5(_t2, t2)
|
||||
FUNCTION_WRAPPER_V8_3(_FillTextCode, FillTextCode)
|
||||
FUNCTION_WRAPPER_V8_3(_tg, tg)
|
||||
FUNCTION_WRAPPER_V8_1(_charspace, charspace)
|
||||
// private methods
|
||||
FUNCTION_WRAPPER_V8_2(_private_FillGlyph, private_FillGlyph)
|
||||
FUNCTION_WRAPPER_V8_3(_private_FillGlyphC, private_FillGlyphC)
|
||||
FUNCTION_WRAPPER_V8_1(_private_FillGlyph2, private_FillGlyph2)
|
||||
FUNCTION_WRAPPER_V8_1(_SetIntegerGrid, SetIntegerGrid)
|
||||
FUNCTION_WRAPPER_V8 (_GetIntegerGrid, GetIntegerGrid)
|
||||
FUNCTION_WRAPPER_V8_8(_DrawStringASCII, DrawStringASCII)
|
||||
FUNCTION_WRAPPER_V8_8(_DrawStringASCII2, DrawStringASCII2)
|
||||
FUNCTION_WRAPPER_V8_5(_DrawHeaderEdit, DrawHeaderEdit)
|
||||
FUNCTION_WRAPPER_V8_5(_DrawFooterEdit, DrawFooterEdit)
|
||||
FUNCTION_WRAPPER_V8_4(_DrawLockParagraph, DrawLockParagraph)
|
||||
FUNCTION_WRAPPER_V8_5(_DrawLockObjectRect, DrawLockObjectRect)
|
||||
FUNCTION_WRAPPER_V8_4(_DrawEmptyTableLine, DrawEmptyTableLine)
|
||||
FUNCTION_WRAPPER_V8_4(_DrawSpellingLine, DrawSpellingLine)
|
||||
// smart methods for horizontal / vertical lines
|
||||
FUNCTION_WRAPPER_V8_5(_drawHorLine, drawHorLine)
|
||||
FUNCTION_WRAPPER_V8_5(_drawHorLine2, drawHorLine2)
|
||||
FUNCTION_WRAPPER_V8_5(_drawVerLine, drawVerLine)
|
||||
// мега крутые функции для таблиц
|
||||
FUNCTION_WRAPPER_V8_7(_drawHorLineExt, drawHorLineExt)
|
||||
FUNCTION_WRAPPER_V8_4(_rect, rect)
|
||||
FUNCTION_WRAPPER_V8_4(_TableRect, TableRect)
|
||||
// функции клиппирования
|
||||
FUNCTION_WRAPPER_V8_4(_AddClipRect, AddClipRect)
|
||||
FUNCTION_WRAPPER_V8 (_RemoveClipRect, RemoveClipRect)
|
||||
FUNCTION_WRAPPER_V8_1(_SetClip, SetClip)
|
||||
FUNCTION_WRAPPER_V8 (_RemoveClip, RemoveClip)
|
||||
FUNCTION_WRAPPER_V8_5(_drawCollaborativeChanges, drawCollaborativeChanges)
|
||||
FUNCTION_WRAPPER_V8_4(_drawMailMergeField, drawMailMergeField)
|
||||
FUNCTION_WRAPPER_V8_4(_drawSearchResult, drawSearchResult)
|
||||
FUNCTION_WRAPPER_V8_2(_drawFlowAnchor, drawFlowAnchor)
|
||||
FUNCTION_WRAPPER_V8 (_SavePen, SavePen)
|
||||
FUNCTION_WRAPPER_V8 (_RestorePen, RestorePen)
|
||||
FUNCTION_WRAPPER_V8 (_SaveBrush, SaveBrush)
|
||||
FUNCTION_WRAPPER_V8 (_RestoreBrush, RestoreBrush)
|
||||
FUNCTION_WRAPPER_V8 (_SavePenBrush, SavePenBrush)
|
||||
FUNCTION_WRAPPER_V8 (_RestorePenBrush, RestorePenBrush)
|
||||
FUNCTION_WRAPPER_V8 (_SaveGrState, SaveGrState)
|
||||
FUNCTION_WRAPPER_V8 (_RestoreGrState, RestoreGrState)
|
||||
FUNCTION_WRAPPER_V8 (_StartClipPath, StartClipPath)
|
||||
FUNCTION_WRAPPER_V8 (_EndClipPath, EndClipPath)
|
||||
FUNCTION_WRAPPER_V8 (_StartCheckTableDraw, StartCheckTableDraw)
|
||||
FUNCTION_WRAPPER_V8_1(_EndCheckTableDraw, EndCheckTableDraw)
|
||||
FUNCTION_WRAPPER_V8_4(_SetTextClipRect, SetTextClipRect)
|
||||
FUNCTION_WRAPPER_V8_5(_AddSmartRect, AddSmartRect)
|
||||
FUNCTION_WRAPPER_V8_1(_CheckUseFonts2, CheckUseFonts2)
|
||||
FUNCTION_WRAPPER_V8 (_UncheckUseFonts2, UncheckUseFonts2)
|
||||
FUNCTION_WRAPPER_V8_4(_Drawing_StartCheckBounds, Drawing_StartCheckBounds)
|
||||
FUNCTION_WRAPPER_V8 (_Drawing_EndCheckBounds, Drawing_EndCheckBounds)
|
||||
FUNCTION_WRAPPER_V8_5(_DrawPresentationComment, DrawPresentationComment)
|
||||
FUNCTION_WRAPPER_V8_3(_DrawPolygon, DrawPolygon)
|
||||
FUNCTION_WRAPPER_V8_4(_DrawFootnoteRect, DrawFootnoteRect)
|
||||
|
||||
// PROPERTY GET
|
||||
PROPERTY_GET_OBJECT(_g_m_oContext, g_m_oContext)
|
||||
PROPERTY_GET_OBJECT(_g_m_oPen, g_m_oPen)
|
||||
PROPERTY_GET_OBJECT(_g_m_oBrush, g_m_oBrush)
|
||||
PROPERTY_GET_OBJECT(_g_m_oFontManager, g_m_oFontManager)
|
||||
PROPERTY_GET_OBJECT(_g_m_oCoordTransform, g_m_oCoordTransform)
|
||||
PROPERTY_GET_OBJECT(_g_m_oBaseTransform, g_m_oBaseTransform)
|
||||
PROPERTY_GET_OBJECT(_g_m_oTransform, g_m_oTransform)
|
||||
PROPERTY_GET_OBJECT(_g_m_oFullTransform, g_m_oFullTransform)
|
||||
PROPERTY_GET_OBJECT(_g_m_oInvertFullTransform, g_m_oInvertFullTransform)
|
||||
PROPERTY_GET_OBJECT(_g_ArrayPoints, g_ArrayPoints)
|
||||
PROPERTY_GET_OBJECT(_g_m_oTextPr, g_m_oTextPr)
|
||||
PROPERTY_GET_OBJECT(_g_m_oGrFonts, g_m_oGrFonts)
|
||||
PROPERTY_GET_OBJECT(_g_m_oLastFont, g_m_oLastFont)
|
||||
PROPERTY_GET_OBJECT(_g_ClipManager, g_ClipManager)
|
||||
PROPERTY_GET_OBJECT(_g_GrState, g_GrState)
|
||||
PROPERTY_GET_OBJECT(_g_TextClipRect, g_TextClipRect)
|
||||
PROPERTY_GET_OBJECT(_g_m_oFontManager2, g_m_oFontManager2)
|
||||
PROPERTY_GET_OBJECT(_g_m_oLastFont2, g_m_oLastFont2)
|
||||
PROPERTY_GET_OBJECT(_g_dash_no_smart, g_dash_no_smart)
|
||||
/*
|
||||
double m_dWidthMM_get() { return m_dWidthMM; }
|
||||
double m_dHeightMM_get() { return m_dHeightMM; }
|
||||
double m_lWidthPix_get() { return m_lWidthPix; }
|
||||
double m_lHeightPix_get() { return m_lHeightPix; }
|
||||
double m_dDpiX_get() { return m_dDpiX; }
|
||||
double m_dDpiY_get() { return m_dDpiY; }
|
||||
bool m_bIsBreak_get() { return m_bIsBreak; }
|
||||
bool m_bPenColorInit_get() { return m_bPenColorInit; }
|
||||
bool m_bBrushColorInit_get() { return m_bBrushColorInit; }
|
||||
bool m_bIntegerGrid_get() { return m_bIntegerGrid; }
|
||||
bool IsThumbnail_get() { return IsThumbnail; }
|
||||
bool IsDemonstrationMode_get() { return IsDemonstrationMode; }
|
||||
bool IsClipContext_get() { return IsClipContext; }
|
||||
bool IsUseFonts2_get() { return IsUseFonts2; }
|
||||
bool ClearMode_get() { return ClearMode; }
|
||||
bool IsRetina_get() { return IsRetina; }
|
||||
CFont m_oCurFont_get() { return m_oCurFont; }
|
||||
CLastFontOriginInfo LastFontOriginInfo_get() { return LastFontOriginInfo; }
|
||||
int TextureFillTransformScaleX_get() { return TextureFillTransformScaleX; }
|
||||
int TextureFillTransformScaleY_get() { return TextureFillTransformScaleY; }
|
||||
int globalAlpha_get() { return globalAlpha; }
|
||||
*/
|
||||
|
||||
v8::Handle<v8::ObjectTemplate> CreateGraphicsTemplate(v8::Isolate* isolate)
|
||||
{
|
||||
v8::EscapableHandleScope handle_scope(isolate);
|
||||
|
||||
v8::Local<v8::ObjectTemplate> result = v8::ObjectTemplate::New();
|
||||
result->SetInternalFieldCount(1);
|
||||
|
||||
v8::Isolate* current = v8::Isolate::GetCurrent();
|
||||
|
||||
// свойства
|
||||
/*
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_oContext"), m_oContext_get_w, m_oContext_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_dWidthMM"), m_dWidthMM_get_w, m_dWidthMM_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_dHeightMM"), m_dHeightMM_get_w, m_dHeightMM_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_lWidthPix"), m_lWidthPix_get_w, m_lWidthPix_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_lHeightPix"), m_lHeightPix_get_w, m_lHeightPix_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_dDpiX"), m_dDpiX_get_w, m_dDpiX_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_dDpiY"), m_dDpiY_get_w, m_dDpiY_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_bIsBreak"), m_bIsBreak_get_w, m_bIsBreak_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_oPen"), m_oPen_get_w, m_oPen_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_bPenColorInit"), m_bPenColorInit_get_w, m_bPenColorInit_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_oBrush"), m_oBrush_get_w, m_oBrush_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_bBrushColorInit"), m_bBrushColorInit_get_w, m_bBrushColorInit_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_oFontManager"), m_oFontManager_get_w, m_oFontManager_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_oCoordTransform"), m_oCoordTransform_get_w, m_oCoordTransform_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_oBaseTransform"), m_oBaseTransform_get_w, m_oBaseTransform_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_oFullTransform"), m_oFullTransform_get_w, m_oFullTransform_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_oInvertFullTransform"), m_oInvertFullTransform_get_w, m_oInvertFullTransform_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "ArrayPoints"), ArrayPoints_get_w, ArrayPoints_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_oCurFont"), m_oCurFont_get_w, m_oCurFont_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_oTextPr"), m_oTextPr_get_w, m_oTextPr_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_oGrFonts"), m_oGrFonts_get_w, m_oGrFonts_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_oLastFont"), m_oLastFont_get_w, m_oLastFont_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "LastFontOriginInfo"), LastFontOriginInfo_get_w, LastFontOriginInfo_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_bIntegerGrid"), m_bIntegerGrid_get_w, m_bIntegerGrid_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "ClipManager"), ClipManager_get_w, ClipManager_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "TextureFillTransformScaleX"), TextureFillTransformScaleX_get_w, TextureFillTransformScaleX_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "TextureFillTransformScaleY"), TextureFillTransformScaleY_get_w, TextureFillTransformScaleY_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "IsThumbnail"), IsThumbnail_get_w, IsThumbnail_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "IsDemonstrationMode"), IsDemonstrationMode_get_w, IsDemonstrationMode_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "IsDemonstrationMode"), IsDemonstrationMode_get_w, IsDemonstrationMode_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "GrState"), GrState_get_w, GrState_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "globalAlpha"), globalAlpha_get_w, globalAlpha_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "TextClipRect"), TextClipRect_get_w, TextClipRect_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "IsClipContext"), IsClipContext_get_w, IsClipContext_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "IsUseFonts2"), IsUseFonts2_get_w, IsUseFonts2_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_oFontManager2"), m_oFontManager2_get_w, m_oFontManager2_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "m_oLastFont2"), m_oLastFont2_get_w, m_oLastFont2_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "ClearMode"), ClearMode_get_w, ClearMode_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "IsRetina"), IsRetina_get_w, IsRetina_set_w);
|
||||
result->SetAccessor(v8::String::NewFromUtf8(current, "dash_no_smart"), dash_no_smart_get_w, dash_no_smart_set_w);
|
||||
*/
|
||||
|
||||
// методы
|
||||
NSV8Objects::Template_Set(result, "init", _init);
|
||||
NSV8Objects::Template_Set(result, "EndDraw", _EndDraw);
|
||||
NSV8Objects::Template_Set(result, "put_GlobalAlpha", _put_GlobalAlpha);
|
||||
NSV8Objects::Template_Set(result, "Start_GlobalAlpha", _Start_GlobalAlpha);
|
||||
NSV8Objects::Template_Set(result, "End_GlobalAlpha", _End_GlobalAlpha);
|
||||
NSV8Objects::Template_Set(result, "p_color", _p_color);
|
||||
NSV8Objects::Template_Set(result, "p_width", _p_width);
|
||||
NSV8Objects::Template_Set(result, "p_dash", _p_dash);
|
||||
NSV8Objects::Template_Set(result, "b_color1", _b_color1);
|
||||
NSV8Objects::Template_Set(result, "b_color2", _b_color2);
|
||||
NSV8Objects::Template_Set(result, "transform", _transform);
|
||||
NSV8Objects::Template_Set(result, "CalculateFullTransform", _CalculateFullTransform);
|
||||
NSV8Objects::Template_Set(result, "_s", __s);
|
||||
NSV8Objects::Template_Set(result, "_e", __e);
|
||||
NSV8Objects::Template_Set(result, "_z", __z);
|
||||
NSV8Objects::Template_Set(result, "_m", __m);
|
||||
NSV8Objects::Template_Set(result, "_l", __l);
|
||||
NSV8Objects::Template_Set(result, "_c", __c);
|
||||
NSV8Objects::Template_Set(result, "_c2", __c2);
|
||||
NSV8Objects::Template_Set(result, "ds", _ds);
|
||||
NSV8Objects::Template_Set(result, "df", _df);
|
||||
NSV8Objects::Template_Set(result, "save", _save);
|
||||
NSV8Objects::Template_Set(result, "restore", _restore);
|
||||
NSV8Objects::Template_Set(result, "clip", _clip);
|
||||
NSV8Objects::Template_Set(result, "reset", _reset);
|
||||
NSV8Objects::Template_Set(result, "transform3", _transform3);
|
||||
NSV8Objects::Template_Set(result, "FreeFont", _FreeFont);
|
||||
NSV8Objects::Template_Set(result, "ClearLastFont", _ClearLastFont);
|
||||
NSV8Objects::Template_Set(result, "drawImage2", _drawImage2);
|
||||
NSV8Objects::Template_Set(result, "drawImage", _drawImage);
|
||||
NSV8Objects::Template_Set(result, "GetFont", _GetFont);
|
||||
NSV8Objects::Template_Set(result, "font", _font);
|
||||
NSV8Objects::Template_Set(result, "SetFont", _SetFont);
|
||||
NSV8Objects::Template_Set(result, "SetTextPr", _SetTextPr);
|
||||
NSV8Objects::Template_Set(result, "SetFontSlot", _SetFontSlot);
|
||||
NSV8Objects::Template_Set(result, "GetTextPr", _GetTextPr);
|
||||
NSV8Objects::Template_Set(result, "FillText", _FillText);
|
||||
NSV8Objects::Template_Set(result, "t", _t);
|
||||
NSV8Objects::Template_Set(result, "FillText2", _FillText2);
|
||||
NSV8Objects::Template_Set(result, "t2", _t2);
|
||||
NSV8Objects::Template_Set(result, "FillTextCode", _FillTextCode);
|
||||
NSV8Objects::Template_Set(result, "tg", _tg);
|
||||
NSV8Objects::Template_Set(result, "charspace", _charspace);
|
||||
NSV8Objects::Template_Set(result, "private_FillGlyph", _private_FillGlyph);
|
||||
NSV8Objects::Template_Set(result, "private_FillGlyphC", _private_FillGlyphC);
|
||||
NSV8Objects::Template_Set(result, "private_FillGlyph2", _private_FillGlyph2);
|
||||
NSV8Objects::Template_Set(result, "SetIntegerGrid", _SetIntegerGrid);
|
||||
NSV8Objects::Template_Set(result, "GetIntegerGrid", _GetIntegerGrid);
|
||||
NSV8Objects::Template_Set(result, "DrawStringASCII", _DrawStringASCII);
|
||||
NSV8Objects::Template_Set(result, "DrawStringASCII2", _DrawStringASCII2);
|
||||
NSV8Objects::Template_Set(result, "DrawHeaderEdit", _DrawHeaderEdit);
|
||||
NSV8Objects::Template_Set(result, "DrawFooterEdit", _DrawFooterEdit);
|
||||
NSV8Objects::Template_Set(result, "DrawLockParagraph", _DrawLockParagraph);
|
||||
NSV8Objects::Template_Set(result, "DrawLockObjectRect", _DrawLockObjectRect);
|
||||
NSV8Objects::Template_Set(result, "DrawEmptyTableLine", _DrawEmptyTableLine);
|
||||
NSV8Objects::Template_Set(result, "DrawSpellingLine", _DrawSpellingLine);
|
||||
NSV8Objects::Template_Set(result, "drawHorLine", _drawHorLine);
|
||||
NSV8Objects::Template_Set(result, "drawHorLine2", _drawHorLine2);
|
||||
NSV8Objects::Template_Set(result, "drawVerLine", _drawVerLine);
|
||||
NSV8Objects::Template_Set(result, "drawHorLineExt", _drawHorLineExt);
|
||||
NSV8Objects::Template_Set(result, "rect", _rect);
|
||||
NSV8Objects::Template_Set(result, "TableRect", _TableRect);
|
||||
NSV8Objects::Template_Set(result, "AddClipRect", _AddClipRect);
|
||||
NSV8Objects::Template_Set(result, "RemoveClipRect", _RemoveClipRect);
|
||||
NSV8Objects::Template_Set(result, "SetClip", _SetClip);
|
||||
NSV8Objects::Template_Set(result, "RemoveClip", _RemoveClip);
|
||||
NSV8Objects::Template_Set(result, "drawCollaborativeChanges", _drawCollaborativeChanges);
|
||||
NSV8Objects::Template_Set(result, "drawMailMergeField", _drawMailMergeField);
|
||||
NSV8Objects::Template_Set(result, "drawSearchResult", _drawSearchResult);
|
||||
NSV8Objects::Template_Set(result, "drawFlowAnchor", _drawFlowAnchor);
|
||||
NSV8Objects::Template_Set(result, "SavePen", _SavePen);
|
||||
NSV8Objects::Template_Set(result, "RestorePen", _RestorePen);
|
||||
NSV8Objects::Template_Set(result, "SaveBrush", _SaveBrush);
|
||||
NSV8Objects::Template_Set(result, "RestoreBrush", _RestoreBrush);
|
||||
NSV8Objects::Template_Set(result, "SavePenBrush", _SavePenBrush);
|
||||
NSV8Objects::Template_Set(result, "RestorePenBrush", _RestorePenBrush);
|
||||
NSV8Objects::Template_Set(result, "SaveGrState", _SaveGrState);
|
||||
NSV8Objects::Template_Set(result, "RestoreGrState", _RestoreGrState);
|
||||
NSV8Objects::Template_Set(result, "StartClipPath", _StartClipPath);
|
||||
NSV8Objects::Template_Set(result, "EndClipPath", _EndClipPath);
|
||||
NSV8Objects::Template_Set(result, "StartCheckTableDraw", _StartCheckTableDraw);
|
||||
NSV8Objects::Template_Set(result, "EndCheckTableDraw", _EndCheckTableDraw);
|
||||
NSV8Objects::Template_Set(result, "SetTextClipRect", _SetTextClipRect);
|
||||
NSV8Objects::Template_Set(result, "AddSmartRect", _AddSmartRect);
|
||||
NSV8Objects::Template_Set(result, "CheckUseFonts2", _CheckUseFonts2);
|
||||
NSV8Objects::Template_Set(result, "UncheckUseFonts2", _UncheckUseFonts2);
|
||||
NSV8Objects::Template_Set(result, "Drawing_StartCheckBounds", _Drawing_StartCheckBounds);
|
||||
NSV8Objects::Template_Set(result, "Drawing_EndCheckBounds", _Drawing_EndCheckBounds);
|
||||
NSV8Objects::Template_Set(result, "DrawPresentationComment", _DrawPresentationComment);
|
||||
NSV8Objects::Template_Set(result, "DrawPolygon", _DrawPolygon);
|
||||
NSV8Objects::Template_Set(result, "DrawFootnoteRect", _DrawFootnoteRect);
|
||||
|
||||
return handle_scope.Escape(result);
|
||||
}
|
||||
|
||||
void CreateNativeGraphics(const v8::FunctionCallbackInfo<v8::Value>& args)
|
||||
{
|
||||
v8::Isolate* isolate = args.GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
|
||||
v8::Handle<v8::ObjectTemplate> GraphicsTemplate = NSGraphics::CreateGraphicsTemplate(isolate);
|
||||
CGraphicsEmbed* pGraphics = new CGraphicsEmbed();
|
||||
|
||||
v8::Local<v8::Object> obj = GraphicsTemplate->NewInstance(isolate->GetCurrentContext()).ToLocalChecked();
|
||||
obj->SetInternalField(0, v8::External::New(CV8Worker::GetCurrent(), pGraphics));
|
||||
|
||||
args.GetReturnValue().Set(obj);
|
||||
}
|
||||
}
|
||||
|
||||
CJSGraphics* unwrap_Graphics (v8::Handle<v8::Object> obj)
|
||||
void CGraphicsEmbed::CreateObjectInContext(const std::string& name, JSSmart<CJSContext> context)
|
||||
{
|
||||
v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(obj->GetInternalField(0));
|
||||
return static_cast<CJSGraphics*>(field->Value());
|
||||
}
|
||||
CFont* unwrap_Font (v8::Handle<v8::Object> obj)
|
||||
{
|
||||
v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(obj->GetInternalField(0));
|
||||
return static_cast<CFont*>(field->Value());
|
||||
}
|
||||
CLastFontOriginInfo* unwrap_LastFontOriginInfo(v8::Handle<v8::Object> obj)
|
||||
{
|
||||
v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(obj->GetInternalField(0));
|
||||
return static_cast<CLastFontOriginInfo*>(field->Value());
|
||||
v8::Isolate* current = CV8Worker::GetCurrent();
|
||||
context->m_internal->m_global->Set(current, name.c_str(), v8::FunctionTemplate::New(current, NSGraphics::CreateNativeGraphics));
|
||||
}
|
||||
|
||||
/*
|
||||
void init_w (const v8::FunctionCallbackInfo<v8::Value>& args)
|
||||
{
|
||||
args.GetReturnValue().Set(v8::Undefined(v8::Isolate::GetCurrent()));
|
||||
@ -707,7 +1004,8 @@ void DrawFootnoteRect_w (const v8::FunctionCallbackInfo<v8::Value>& args)
|
||||
CJSGraphics* pGraphics = unwrap_Graphics(args.This());
|
||||
pGraphics->DrawFootnoteRect(to_double(args[0]), to_double(args[1]), to_double(args[2]), to_double(args[3]));
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
void m_oContext_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info)
|
||||
{
|
||||
CJSGraphics* pGraphics = unwrap_Graphics(info.Holder());
|
||||
@ -1346,3 +1644,4 @@ void CreateGraphics(const v8::FunctionCallbackInfo<v8::Value>& args)
|
||||
|
||||
args.GetReturnValue().Set(obj);
|
||||
}
|
||||
*/
|
||||
212
DesktopEditor/doctrenderer/js_internal/js_base.h
Normal file
212
DesktopEditor/doctrenderer/js_internal/js_base.h
Normal file
@ -0,0 +1,212 @@
|
||||
#ifndef _CORE_EXT_JS_BASE_H_
|
||||
#define _CORE_EXT_JS_BASE_H_
|
||||
|
||||
#include "../../common/File.h"
|
||||
#include "../../common/Array.h"
|
||||
#include "../../../Common/DocxFormat/Source/Base/SmartPtr.h"
|
||||
|
||||
#define JS_VALUE_EXIST(value) (value.is_init() && !value->isNull() && !value->isUndefined())
|
||||
#define JS_IS_VALUE_ARRAY(value) (value.is_init() && !value->isNull() && !value->isUndefined() && value->isArray())
|
||||
|
||||
template <class T>
|
||||
using JSSmart = NSCommon::smart_ptr<T>;
|
||||
|
||||
namespace NSJSBase
|
||||
{
|
||||
class CJSObject;
|
||||
class CJSArray;
|
||||
class CJSTypedArray;
|
||||
class CJSFunction;
|
||||
|
||||
class CJSValue
|
||||
{
|
||||
public:
|
||||
CJSValue() {}
|
||||
virtual ~CJSValue() {}
|
||||
|
||||
virtual bool isUndefined() = 0;
|
||||
virtual bool isNull() = 0;
|
||||
virtual bool isBool() = 0;
|
||||
virtual bool isNumber() = 0;
|
||||
virtual bool isString() = 0;
|
||||
virtual bool isArray() = 0;
|
||||
virtual bool isTypedArray() = 0;
|
||||
virtual bool isObject() = 0;
|
||||
virtual bool isFunction() = 0;
|
||||
|
||||
virtual void doUndefined() = 0;
|
||||
virtual void doNull() = 0;
|
||||
|
||||
virtual bool toBool() = 0;
|
||||
virtual int toInt32() = 0;
|
||||
virtual double toDouble() = 0;
|
||||
virtual std::string toStringA() = 0;
|
||||
virtual std::wstring toStringW() = 0;
|
||||
|
||||
virtual CJSObject* toObject() = 0;
|
||||
virtual CJSArray* toArray() = 0;
|
||||
virtual CJSTypedArray* toTypedArray() = 0;
|
||||
virtual CJSFunction* toFunction() = 0;
|
||||
};
|
||||
|
||||
class CJSEmbedObject
|
||||
{
|
||||
public:
|
||||
CJSEmbedObject() {}
|
||||
virtual ~CJSEmbedObject() {}
|
||||
|
||||
public:
|
||||
virtual void* getObject() { return NULL; }
|
||||
};
|
||||
|
||||
class CJSObject : public CJSValue
|
||||
{
|
||||
public:
|
||||
CJSObject() {}
|
||||
virtual ~CJSObject() {}
|
||||
|
||||
virtual CJSValue* get(const char* name) = 0;
|
||||
virtual void set(const char* name, CJSValue* value) = 0;
|
||||
|
||||
virtual void set(const char* name, const int& value) = 0;
|
||||
virtual void set(const char* name, const double& value) = 0;
|
||||
|
||||
virtual CJSEmbedObject* getNative() = 0;
|
||||
|
||||
virtual JSSmart<CJSValue> call_func(const char* name, const int argc = 0, JSSmart<CJSValue> argv[] = NULL) = 0;
|
||||
virtual JSSmart<CJSValue> toValue() = 0;
|
||||
};
|
||||
|
||||
class CJSArray : public CJSValue
|
||||
{
|
||||
public:
|
||||
CJSArray() {}
|
||||
virtual ~CJSArray() {}
|
||||
|
||||
virtual int getCount() = 0;
|
||||
virtual JSSmart<CJSValue> get(const int& index) = 0;
|
||||
virtual void set(const int& index, CJSValue* value) = 0;
|
||||
virtual void set(const int& index, const bool& value) = 0;
|
||||
virtual void set(const int& index, const int& value) = 0;
|
||||
virtual void set(const int& index, const double& value) = 0;
|
||||
|
||||
virtual void add(CJSValue* value) = 0;
|
||||
virtual void add_null() = 0;
|
||||
virtual void add_undefined() = 0;
|
||||
virtual void add_bool(const bool& value) = 0;
|
||||
virtual void add_byte(const BYTE& value) = 0;
|
||||
virtual void add_int(const int& value) = 0;
|
||||
virtual void add_double(const double& value) = 0;
|
||||
virtual void add_stringa(const std::string& value) = 0;
|
||||
virtual void add_string(const std::wstring& value) = 0;
|
||||
virtual JSSmart<CJSValue> toValue() = 0;
|
||||
};
|
||||
|
||||
class CJSTypedArray : public CJSValue
|
||||
{
|
||||
public:
|
||||
CJSTypedArray(BYTE* data = NULL, int count = 0) {}
|
||||
virtual ~CJSTypedArray() {}
|
||||
|
||||
virtual int getCount() = 0;
|
||||
virtual const BYTE* getData() = 0;
|
||||
};
|
||||
|
||||
class CJSFunction : public CJSValue
|
||||
{
|
||||
public:
|
||||
CJSFunction() {}
|
||||
virtual ~CJSFunction() {}
|
||||
|
||||
virtual CJSValue* Call(CJSValue* recv, int argc, JSSmart<CJSValue> argv[]) = 0;
|
||||
};
|
||||
|
||||
class CJSTryCatch
|
||||
{
|
||||
public:
|
||||
CJSTryCatch() {}
|
||||
virtual ~CJSTryCatch() {}
|
||||
virtual bool Check() = 0;
|
||||
};
|
||||
|
||||
|
||||
class CJSIsolateScope
|
||||
{
|
||||
public:
|
||||
CJSIsolateScope()
|
||||
{
|
||||
}
|
||||
virtual ~CJSIsolateScope()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class CJSContextScope
|
||||
{
|
||||
public:
|
||||
CJSContextScope()
|
||||
{
|
||||
}
|
||||
virtual ~CJSContextScope()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class CJSLocalScope
|
||||
{
|
||||
public:
|
||||
CJSLocalScope()
|
||||
{
|
||||
}
|
||||
virtual ~CJSLocalScope()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class CJSContextPrivate;
|
||||
class CJSContext
|
||||
{
|
||||
public:
|
||||
CJSContextPrivate* m_internal;
|
||||
|
||||
public:
|
||||
CJSContext();
|
||||
~CJSContext();
|
||||
|
||||
void Initialize();
|
||||
void Dispose();
|
||||
|
||||
CJSTryCatch* GetExceptions();
|
||||
|
||||
void CreateContext();
|
||||
void CreateGlobalForContext();
|
||||
CJSObject* GetGlobal();
|
||||
|
||||
CJSIsolateScope* CreateIsolateScope();
|
||||
CJSContextScope* CreateContextScope();
|
||||
CJSLocalScope* CreateLocalScope();
|
||||
|
||||
JSSmart<CJSValue> runScript(const std::string& script, JSSmart<CJSTryCatch> exception = NULL, const std::wstring& scriptPath = std::wstring(L""));
|
||||
|
||||
public:
|
||||
static CJSValue* createUndefined();
|
||||
static CJSValue* createNull();
|
||||
static CJSValue* createBool(const bool& value);
|
||||
static CJSValue* createInt(const int& value);
|
||||
static CJSValue* createDouble(const double& value);
|
||||
static CJSValue* createString(const char* value, const int& length = -1);
|
||||
static CJSValue* createString(const std::string& value);
|
||||
static CJSValue* createString(const std::wstring& value);
|
||||
|
||||
static CJSObject* createObject();
|
||||
|
||||
static CJSArray* createArray(const int& count);
|
||||
|
||||
static CJSTypedArray* createUint8Array(BYTE* data = NULL, int count = 0);
|
||||
|
||||
public:
|
||||
static CJSContext* GetCurrent();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // _CORE_EXT_JS_BASE_H_
|
||||
517
DesktopEditor/doctrenderer/js_internal/jsc/jsc_base.h
Normal file
517
DesktopEditor/doctrenderer/js_internal/jsc/jsc_base.h
Normal file
@ -0,0 +1,517 @@
|
||||
#ifndef _BUILD_NATIVE_CONTROL_JSC_BASE_H_
|
||||
#define _BUILD_NATIVE_CONTROL_JSC_BASE_H_
|
||||
|
||||
#include "../js_base.h"
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <JavaScriptCore/JavaScriptCore.h>
|
||||
#include <JavaScriptCore/JSTypedArray.h>
|
||||
#include <JavaScriptCore/JSValueRef.h>
|
||||
|
||||
#import "../../../../core/DesktopEditor/common/Mac/NSString+StringUtils.h"
|
||||
|
||||
@protocol JSEmbedObjectProtocol
|
||||
- (void*) getNative;
|
||||
@end
|
||||
|
||||
namespace NSJSBase
|
||||
{
|
||||
class CJSContextPrivate
|
||||
{
|
||||
public:
|
||||
JSContext* context;
|
||||
|
||||
static JSContext* g_lockedContext;
|
||||
|
||||
public:
|
||||
CJSContextPrivate()
|
||||
{
|
||||
context = nil;
|
||||
}
|
||||
~CJSContextPrivate()
|
||||
{
|
||||
context = nil;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static JSContext* _getCurrentContext()
|
||||
{
|
||||
return NSJSBase::CJSContextPrivate::g_lockedContext;
|
||||
}
|
||||
|
||||
namespace NSJSBase
|
||||
{
|
||||
template<typename T>
|
||||
class CJSValueJSCTemplate : public T
|
||||
{
|
||||
public:
|
||||
JSValue* value;
|
||||
JSContext* context;
|
||||
|
||||
CJSValueJSCTemplate()
|
||||
{
|
||||
value = nil;
|
||||
context = nil;
|
||||
}
|
||||
CJSValueJSCTemplate(JSValue* _value)
|
||||
{
|
||||
value = _value;
|
||||
context = _getCurrentContext();
|
||||
|
||||
if (context == nil) {
|
||||
context = _value.context;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
virtual ~CJSValueJSCTemplate()
|
||||
{
|
||||
value = nil;
|
||||
context = nil;
|
||||
}
|
||||
|
||||
virtual bool isUndefined();
|
||||
virtual bool isNull();
|
||||
virtual bool isBool();
|
||||
virtual bool isNumber();
|
||||
virtual bool isString();
|
||||
virtual bool isArray();
|
||||
virtual bool isTypedArray();
|
||||
virtual bool isObject();
|
||||
virtual bool isFunction();
|
||||
|
||||
virtual void doUndefined();
|
||||
virtual void doNull();
|
||||
virtual bool toBool();
|
||||
virtual int toInt32();
|
||||
virtual double toDouble();
|
||||
virtual std::string toStringA();
|
||||
virtual std::wstring toStringW();
|
||||
|
||||
virtual CJSObject* toObject();
|
||||
virtual CJSArray* toArray();
|
||||
virtual CJSTypedArray* toTypedArray();
|
||||
virtual CJSFunction* toFunction();
|
||||
};
|
||||
|
||||
typedef CJSValueJSCTemplate<CJSValue> CJSValueJSC;
|
||||
|
||||
class CJSObjectJSC : public CJSValueJSCTemplate<CJSObject>
|
||||
{
|
||||
public:
|
||||
CJSObjectJSC()
|
||||
{
|
||||
}
|
||||
CJSObjectJSC(JSValue* _value) : CJSValueJSCTemplate<CJSObject>(_value)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~CJSObjectJSC()
|
||||
{
|
||||
value = nil;
|
||||
context = nil;
|
||||
}
|
||||
|
||||
virtual CJSValue* get(const char* name)
|
||||
{
|
||||
CJSValueJSC* _value = new CJSValueJSC();
|
||||
_value->value = [value valueForProperty:[[NSString alloc] initWithUTF8String:name]];
|
||||
_value->context = context;
|
||||
return _value;
|
||||
}
|
||||
|
||||
virtual void set(const char* name, CJSValue* value_param)
|
||||
{
|
||||
CJSValueJSC* _value = static_cast<CJSValueJSC*>(value_param);
|
||||
[value setValue:_value->value forProperty:[[NSString alloc] initWithUTF8String:name]];
|
||||
}
|
||||
|
||||
virtual void set(const char* name, const int& _value)
|
||||
{
|
||||
[value setValue:[JSValue valueWithInt32:_value inContext: context] forProperty:[[NSString alloc] initWithUTF8String:name]];
|
||||
}
|
||||
|
||||
virtual void set(const char* name, const double& _value)
|
||||
{
|
||||
[value setValue:[JSValue valueWithDouble:_value inContext: context] forProperty:[[NSString alloc] initWithUTF8String:name]];
|
||||
}
|
||||
|
||||
virtual CJSEmbedObject* getNative()
|
||||
{
|
||||
id _wrapper = [value toObject];
|
||||
if ([_wrapper conformsToProtocol:@protocol(JSEmbedObjectProtocol)])
|
||||
{
|
||||
return (CJSEmbedObject*)([_wrapper getNative]);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virtual JSSmart<CJSValue> call_func(const char* name, const int argc = 0, JSSmart<CJSValue> argv[] = NULL)
|
||||
{
|
||||
NSMutableArray* arr = nil;
|
||||
|
||||
if (argc > 0)
|
||||
{
|
||||
arr = [[NSMutableArray alloc] init];
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
CJSValueJSC* _val = (CJSValueJSC*)argv[i].operator ->();
|
||||
[arr addObject:_val->value];
|
||||
}
|
||||
}
|
||||
|
||||
CJSValueJSC* _return = new CJSValueJSC();
|
||||
_return->context = context;
|
||||
_return->value = [value invokeMethod: [[NSString alloc] initWithUTF8String:name]
|
||||
withArguments: arr];
|
||||
|
||||
return _return;
|
||||
}
|
||||
|
||||
virtual JSSmart<CJSValue> toValue()
|
||||
{
|
||||
CJSValueJSC* _value = new CJSValueJSC();
|
||||
_value->value = value;
|
||||
//_value->value = [JSValue valueWithJSValueRef:[value JSValueRef] inContext:context];
|
||||
_value->context = context;
|
||||
return _value;
|
||||
}
|
||||
};
|
||||
|
||||
class CJSArrayJSC : public CJSValueJSCTemplate<CJSArray>
|
||||
{
|
||||
public:
|
||||
int m_count;
|
||||
public:
|
||||
CJSArrayJSC()
|
||||
{
|
||||
m_count = 0;
|
||||
}
|
||||
virtual ~CJSArrayJSC()
|
||||
{
|
||||
value = nil;
|
||||
context = nil;
|
||||
}
|
||||
|
||||
virtual int getCount()
|
||||
{
|
||||
JSValue* _ret = [value valueForProperty:@"length"];
|
||||
if (nil != _ret && NO == [_ret isUndefined])
|
||||
return [_ret toInt32];
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual JSSmart<CJSValue> get(const int& index)
|
||||
{
|
||||
CJSValueJSC* _value = new CJSValueJSC();
|
||||
_value->value = [value valueAtIndex:(NSUInteger)index];
|
||||
_value->context = context;
|
||||
return _value;
|
||||
}
|
||||
|
||||
virtual void set(const int& index, CJSValue* value_param)
|
||||
{
|
||||
CJSValueJSC* _value = static_cast<CJSValueJSC*>(value_param);
|
||||
[value setValue:_value->value atIndex:index];
|
||||
}
|
||||
|
||||
virtual void add(CJSValue* value_param)
|
||||
{
|
||||
set(getCount(), value_param);
|
||||
}
|
||||
|
||||
virtual void set(const int& index, const bool& _value)
|
||||
{
|
||||
[value setValue:[JSValue valueWithBool:_value inContext : context] atIndex:index];
|
||||
}
|
||||
|
||||
virtual void set(const int& index, const int& _value)
|
||||
{
|
||||
[value setValue:[JSValue valueWithInt32:_value inContext : context] atIndex:index];
|
||||
}
|
||||
|
||||
virtual void set(const int& index, const double& _value)
|
||||
{
|
||||
[value setValue:[JSValue valueWithDouble:_value inContext : context] atIndex:index];
|
||||
}
|
||||
|
||||
virtual void add_null()
|
||||
{
|
||||
[value setValue:[JSValue valueWithNullInContext:context] atIndex:m_count++];
|
||||
}
|
||||
|
||||
virtual void add_undefined()
|
||||
{
|
||||
[value setValue:nil atIndex:m_count++];
|
||||
}
|
||||
|
||||
virtual void add_bool(const bool& _value)
|
||||
{
|
||||
[value setValue:[JSValue valueWithBool:_value inContext : context] atIndex:m_count++];
|
||||
}
|
||||
|
||||
virtual void add_byte(const BYTE& _value)
|
||||
{
|
||||
[value setValue:[JSValue valueWithInt32:(int)_value inContext : context] atIndex:m_count++];
|
||||
}
|
||||
|
||||
virtual void add_int(const int& _value)
|
||||
{
|
||||
[value setValue:[JSValue valueWithInt32:_value inContext : context] atIndex:m_count++];
|
||||
}
|
||||
|
||||
virtual void add_double(const double& _value)
|
||||
{
|
||||
[value setValue:[JSValue valueWithDouble:_value inContext : context] atIndex:m_count++];
|
||||
}
|
||||
|
||||
virtual void add_stringa(const std::string& _value)
|
||||
{
|
||||
[value setValue:[NSString stringWithAString:_value] atIndex:m_count++];
|
||||
}
|
||||
|
||||
virtual void add_string(const std::wstring& _value)
|
||||
{
|
||||
[value setValue:[NSString stringWithWString:_value] atIndex:m_count++];
|
||||
}
|
||||
|
||||
virtual JSSmart<CJSValue> toValue()
|
||||
{
|
||||
CJSValueJSC* _value = new CJSValueJSC();
|
||||
_value->value = value;
|
||||
_value->context = context;
|
||||
return _value;
|
||||
}
|
||||
};
|
||||
|
||||
class CJSTypedArrayJSC : public CJSValueJSCTemplate<CJSTypedArray>
|
||||
{
|
||||
public:
|
||||
CJSTypedArrayJSC(JSContext* _context, BYTE* data = NULL, int count = 0)
|
||||
{
|
||||
context = _context;
|
||||
if (0 < count)
|
||||
{
|
||||
JSObjectRef object = JSObjectMakeTypedArrayWithBytesNoCopy(context.JSGlobalContextRef,
|
||||
kJSTypedArrayTypeUint8Array,
|
||||
(void*)data, (size_t)count,
|
||||
data_destroy, nullptr, nullptr);
|
||||
if (object)
|
||||
{
|
||||
value = [JSValue valueWithJSValueRef:object inContext:context];
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual ~CJSTypedArrayJSC()
|
||||
{
|
||||
value = nil;
|
||||
context = nil;
|
||||
}
|
||||
|
||||
static void data_destroy(void* bytes, void* deallocatorContext)
|
||||
{
|
||||
free(bytes);
|
||||
}
|
||||
|
||||
virtual int getCount()
|
||||
{
|
||||
JSObjectRef obj = JSValueToObject(context.JSGlobalContextRef, value.JSValueRef, NULL);
|
||||
return (int)JSObjectGetTypedArrayByteLength(context.JSGlobalContextRef, obj, NULL);
|
||||
}
|
||||
|
||||
virtual const BYTE* getData()
|
||||
{
|
||||
JSObjectRef obj = JSValueToObject(context.JSGlobalContextRef, value.JSValueRef, NULL);
|
||||
return (BYTE*)JSObjectGetTypedArrayBytesPtr(context.JSGlobalContextRef, obj, NULL);
|
||||
}
|
||||
};
|
||||
|
||||
class CJSFunctionJSC : public CJSValueJSCTemplate<CJSFunction>
|
||||
{
|
||||
public:
|
||||
CJSFunctionJSC()
|
||||
{
|
||||
}
|
||||
virtual ~CJSFunctionJSC()
|
||||
{
|
||||
value = nil;
|
||||
context = nil;
|
||||
}
|
||||
|
||||
virtual CJSValue* Call(CJSValue* recv, int argc, JSSmart<CJSValue> argv[])
|
||||
{
|
||||
NSMutableArray* arr = [[NSMutableArray alloc] init];
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
CJSValueJSC* _val = (CJSValueJSC*)argv[i].operator ->();
|
||||
[arr addObject:_val->value];
|
||||
}
|
||||
|
||||
CJSValueJSC* _return = new CJSValueJSC();
|
||||
_return->context = context;
|
||||
_return->value = [value callWithArguments:arr];
|
||||
|
||||
return _return;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
CJSObject* CJSValueJSCTemplate<T>::toObject()
|
||||
{
|
||||
CJSObjectJSC* _value = new CJSObjectJSC();
|
||||
_value->value = value;
|
||||
_value->context = context;
|
||||
return _value;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
CJSArray* CJSValueJSCTemplate<T>::toArray()
|
||||
{
|
||||
CJSArrayJSC* _value = new CJSArrayJSC();
|
||||
_value->value = value;
|
||||
_value->context = context;
|
||||
return _value;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
CJSTypedArray* CJSValueJSCTemplate<T>::toTypedArray()
|
||||
{
|
||||
CJSTypedArrayJSC* _value = new CJSTypedArrayJSC(context);
|
||||
_value->value = value;
|
||||
_value->context = context;
|
||||
return _value;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
CJSFunction* CJSValueJSCTemplate<T>::toFunction()
|
||||
{
|
||||
CJSFunctionJSC* _value = new CJSFunctionJSC();
|
||||
_value->value = value;
|
||||
_value->context = context;
|
||||
return _value;
|
||||
}
|
||||
}
|
||||
|
||||
namespace NSJSBase
|
||||
{
|
||||
// TRY - CATCH
|
||||
class CJSCTryCatch : public CJSTryCatch
|
||||
{
|
||||
public:
|
||||
JSContext* context;
|
||||
JSSmart<CJSContext> smartContext;
|
||||
|
||||
public:
|
||||
CJSCTryCatch() : CJSTryCatch()
|
||||
{
|
||||
smartContext = CJSContext::GetCurrent();
|
||||
context = smartContext->m_internal->context;
|
||||
}
|
||||
virtual ~CJSCTryCatch()
|
||||
{
|
||||
context = nil;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual bool Check();
|
||||
};
|
||||
}
|
||||
|
||||
inline JSSmart<NSJSBase::CJSValue> js_value(JSValue* _value)
|
||||
{
|
||||
return new NSJSBase::CJSValueJSC(_value);
|
||||
}
|
||||
inline JSSmart<NSJSBase::CJSValue> js_object(JSValue* _value)
|
||||
{
|
||||
return new NSJSBase::CJSObjectJSC(_value);
|
||||
}
|
||||
inline JSValue* js_return(JSSmart<NSJSBase::CJSValue> _value)
|
||||
{
|
||||
if (!_value.is_init())
|
||||
return nil;
|
||||
NSJSBase::CJSValueJSC* _tmp = (NSJSBase::CJSValueJSC*)(_value.operator ->());
|
||||
return _tmp->value;
|
||||
}
|
||||
|
||||
#define FUNCTION_WRAPPER_JS(NAME, NAME_EMBED) \
|
||||
-(JSValue*) NAME \
|
||||
{ \
|
||||
return js_return(m_internal->NAME_EMBED()); \
|
||||
}
|
||||
|
||||
#define FUNCTION_WRAPPER_JS_1(NAME, NAME_EMBED) \
|
||||
-(JSValue*) NAME:(JSValue*)p1 \
|
||||
{ \
|
||||
return js_return(m_internal->NAME_EMBED(js_value(p1))); \
|
||||
}
|
||||
#define FUNCTION_WRAPPER_JS_2(NAME, NAME_EMBED) \
|
||||
-(JSValue*) NAME:(JSValue*)p1 : (JSValue*)p2 \
|
||||
{ \
|
||||
return js_return(m_internal->NAME_EMBED(js_value(p1), js_value(p2))); \
|
||||
}
|
||||
#define FUNCTION_WRAPPER_JS_3(NAME, NAME_EMBED) \
|
||||
-(JSValue*) NAME:(JSValue*)p1 : (JSValue*)p2 : (JSValue*)p3 \
|
||||
{ \
|
||||
return js_return(m_internal->NAME_EMBED(js_value(p1), js_value(p2), js_value(p3))); \
|
||||
}
|
||||
#define FUNCTION_WRAPPER_JS_4(NAME, NAME_EMBED) \
|
||||
-(JSValue*) NAME:(JSValue*)p1 : (JSValue*)p2 : (JSValue*)p3 : (JSValue*)p4 \
|
||||
{ \
|
||||
return js_return(m_internal->NAME_EMBED(js_value(p1), js_value(p2), js_value(p3), js_value(p4))); \
|
||||
}
|
||||
#define FUNCTION_WRAPPER_JS_5(NAME, NAME_EMBED) \
|
||||
-(JSValue*) NAME:(JSValue*)p1 : (JSValue*)p2 : (JSValue*)p3 : (JSValue*)p4 : (JSValue*)p5 \
|
||||
{ \
|
||||
return js_return(m_internal->NAME_EMBED(js_value(p1), js_value(p2), js_value(p3), js_value(p4), js_value(p5))); \
|
||||
}
|
||||
#define FUNCTION_WRAPPER_JS_6(NAME, NAME_EMBED) \
|
||||
-(JSValue*) NAME:(JSValue*)p1 : (JSValue*)p2 : (JSValue*)p3 : (JSValue*)p4 : (JSValue*)p5 : (JSValue*)p6 \
|
||||
{ \
|
||||
return js_return(m_internal->NAME_EMBED(js_value(p1), js_value(p2), js_value(p3), js_value(p4), js_value(p5), js_value(p6))); \
|
||||
}
|
||||
#define FUNCTION_WRAPPER_JS_7(NAME, NAME_EMBED) \
|
||||
-(JSValue*) NAME:(JSValue*)p1 : (JSValue*)p2 : (JSValue*)p3 : (JSValue*)p4 : (JSValue*)p5 : (JSValue*)p6 : (JSValue*)p7 \
|
||||
{ \
|
||||
return js_return(m_internal->NAME_EMBED(js_value(p1), js_value(p2), js_value(p3), js_value(p4), js_value(p5), js_value(p6), js_value(p7))); \
|
||||
}
|
||||
|
||||
#if __has_feature(objc_arc)
|
||||
#define EMBED_OBJECT_WRAPPER_METHODS(CLASS) \
|
||||
-(id) init \
|
||||
{ \
|
||||
self = [super init]; \
|
||||
if (self) \
|
||||
m_internal = new CLASS(); \
|
||||
return self; \
|
||||
} \
|
||||
-(void) dealloc \
|
||||
{ \
|
||||
RELEASEOBJECT(m_internal); \
|
||||
} \
|
||||
- (void*) getNative \
|
||||
{ \
|
||||
return m_internal; \
|
||||
}
|
||||
#else
|
||||
#define EMBED_OBJECT_WRAPPER_METHODS(CLASS) \
|
||||
-(id) init \
|
||||
{ \
|
||||
self = [super init]; \
|
||||
if (self) \
|
||||
m_internal = new CLASS(); \
|
||||
return self; \
|
||||
} \
|
||||
-(void) dealloc \
|
||||
{ \
|
||||
RELEASEOBJECT(m_internal); \
|
||||
[super dealloc]; \
|
||||
} \
|
||||
- (void*) getNative \
|
||||
{ \
|
||||
return m_internal; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _BUILD_NATIVE_CONTROL_JSC_BASE_H_
|
||||
275
DesktopEditor/doctrenderer/js_internal/jsc/jsc_base.mm
Normal file
275
DesktopEditor/doctrenderer/js_internal/jsc/jsc_base.mm
Normal file
@ -0,0 +1,275 @@
|
||||
#import "jsc_base.h"
|
||||
|
||||
using namespace NSJSBase;
|
||||
|
||||
JSContext* NSJSBase::CJSContextPrivate::g_lockedContext = nil;
|
||||
|
||||
template<typename T>
|
||||
bool CJSValueJSCTemplate<T>::isUndefined()
|
||||
{
|
||||
return (value == nil) ? true : ([value isUndefined] == YES);
|
||||
}
|
||||
template<typename T>
|
||||
bool CJSValueJSCTemplate<T>::isNull()
|
||||
{
|
||||
return (value == nil) ? false : ([value isNull] == YES);
|
||||
}
|
||||
template<typename T>
|
||||
bool CJSValueJSCTemplate<T>::isBool()
|
||||
{
|
||||
return (value == nil) ? false : ([value isBoolean] == YES);
|
||||
}
|
||||
template<typename T>
|
||||
bool CJSValueJSCTemplate<T>::isNumber()
|
||||
{
|
||||
return (value == nil) ? false : ([value isNumber] == YES);
|
||||
}
|
||||
template<typename T>
|
||||
bool CJSValueJSCTemplate<T>::isString()
|
||||
{
|
||||
return (value == nil) ? false : ([value isString] == YES);
|
||||
}
|
||||
template<typename T>
|
||||
bool CJSValueJSCTemplate<T>::isArray()
|
||||
{
|
||||
return (value == nil) ? false : JSValueIsArray(context.JSGlobalContextRef, value.JSValueRef);
|
||||
}
|
||||
template<typename T>
|
||||
bool CJSValueJSCTemplate<T>::isTypedArray()
|
||||
{
|
||||
return (value == nil) ? false : (kJSTypedArrayTypeNone == JSValueGetTypedArrayType(context.JSGlobalContextRef, value.JSValueRef, NULL));
|
||||
}
|
||||
template<typename T>
|
||||
bool CJSValueJSCTemplate<T>::isObject()
|
||||
{
|
||||
return (value == nil) ? false : ([value isObject] == YES);
|
||||
}
|
||||
template<typename T>
|
||||
bool CJSValueJSCTemplate<T>::isFunction()
|
||||
{
|
||||
return true; // TODO!!!
|
||||
}
|
||||
template<typename T>
|
||||
void CJSValueJSCTemplate<T>::doUndefined()
|
||||
{
|
||||
value = [JSValue valueWithUndefinedInContext:context];
|
||||
}
|
||||
template<typename T>
|
||||
void CJSValueJSCTemplate<T>::doNull()
|
||||
{
|
||||
value = [JSValue valueWithNullInContext:context];
|
||||
}
|
||||
template<typename T>
|
||||
bool CJSValueJSCTemplate<T>::toBool()
|
||||
{
|
||||
return ([value toBool] == YES) ? true : false;
|
||||
}
|
||||
template<typename T>
|
||||
int CJSValueJSCTemplate<T>::toInt32()
|
||||
{
|
||||
return [value toInt32];
|
||||
}
|
||||
template<typename T>
|
||||
double CJSValueJSCTemplate<T>::toDouble()
|
||||
{
|
||||
return [value toDouble];
|
||||
}
|
||||
template<typename T>
|
||||
std::string CJSValueJSCTemplate<T>::toStringA()
|
||||
{
|
||||
return [[value toString] stdstring];
|
||||
}
|
||||
template<typename T>
|
||||
std::wstring CJSValueJSCTemplate<T>::toStringW()
|
||||
{
|
||||
return [[value toString] stdwstring];
|
||||
}
|
||||
|
||||
namespace NSJSBase
|
||||
{
|
||||
CJSContext::CJSContext()
|
||||
{
|
||||
m_internal = new CJSContextPrivate();
|
||||
}
|
||||
CJSContext::~CJSContext()
|
||||
{
|
||||
m_internal->context = nil;
|
||||
RELEASEOBJECT(m_internal);
|
||||
}
|
||||
|
||||
CJSTryCatch* CJSContext::GetExceptions()
|
||||
{
|
||||
return new CJSCTryCatch();
|
||||
}
|
||||
|
||||
void CJSContext::Initialize()
|
||||
{
|
||||
m_internal->context = [[JSContext alloc] init];
|
||||
}
|
||||
void CJSContext::Dispose()
|
||||
{
|
||||
m_internal->context = nil;
|
||||
m_internal->g_lockedContext = nil;
|
||||
NSJSBase::CJSContextPrivate::g_lockedContext = nil;
|
||||
}
|
||||
|
||||
void CJSContext::CreateContext()
|
||||
{
|
||||
// NONE
|
||||
}
|
||||
|
||||
void CJSContext::CreateGlobalForContext()
|
||||
{
|
||||
// NONE
|
||||
}
|
||||
|
||||
CJSObject* CJSContext::GetGlobal()
|
||||
{
|
||||
CJSObjectJSC* ret = new CJSObjectJSC();
|
||||
ret->context = m_internal->context;
|
||||
ret->value = [m_internal->context globalObject];
|
||||
return ret;
|
||||
}
|
||||
|
||||
CJSIsolateScope* CJSContext::CreateIsolateScope()
|
||||
{
|
||||
#if 0
|
||||
// FOR DEBUG
|
||||
[m_internal->context setExceptionHandler:^(JSContext *context, JSValue *value) {
|
||||
NSLog(@"%@", value);
|
||||
}];
|
||||
#endif
|
||||
|
||||
m_internal->g_lockedContext = m_internal->context;
|
||||
return new CJSIsolateScope();
|
||||
}
|
||||
|
||||
CJSContextScope* CJSContext::CreateContextScope()
|
||||
{
|
||||
return new CJSContextScope();
|
||||
}
|
||||
|
||||
CJSLocalScope* CJSContext::CreateLocalScope()
|
||||
{
|
||||
return new CJSLocalScope();
|
||||
}
|
||||
|
||||
CJSValue* CJSContext::createUndefined()
|
||||
{
|
||||
CJSValueJSC* _value = new CJSValueJSC();
|
||||
_value->context = _getCurrentContext();
|
||||
_value->doUndefined();
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSValue* CJSContext::createNull()
|
||||
{
|
||||
CJSValueJSC* _value = new CJSValueJSC();
|
||||
_value->context = _getCurrentContext();
|
||||
_value->doNull();
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSValue* CJSContext::createBool(const bool& value)
|
||||
{
|
||||
CJSValueJSC* _value = new CJSValueJSC();
|
||||
_value->context = _getCurrentContext();
|
||||
_value->value = [JSValue valueWithBool:(value ? YES : NO) inContext:_value->context];
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSValue* CJSContext::createInt(const int& value)
|
||||
{
|
||||
CJSValueJSC* _value = new CJSValueJSC();
|
||||
_value->context = _getCurrentContext();
|
||||
_value->value = [JSValue valueWithInt32:((int32_t) value) inContext:_value->context];
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSValue* CJSContext::createDouble(const double& value)
|
||||
{
|
||||
CJSValueJSC* _value = new CJSValueJSC();
|
||||
_value->context = _getCurrentContext();
|
||||
_value->value = [JSValue valueWithDouble:value inContext:_value->context];
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSValue* CJSContext::createString(const char* value, const int& len)
|
||||
{
|
||||
CJSValueJSC* _value = new CJSValueJSC();
|
||||
_value->context = _getCurrentContext();
|
||||
_value->value = [NSString stringWithUtf8Buffer:value
|
||||
length:(size_t)len];
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSValue* CJSContext::createString(const std::string& value)
|
||||
{
|
||||
CJSValueJSC* _value = new CJSValueJSC();
|
||||
_value->context = _getCurrentContext();
|
||||
_value->value = [NSString stringWithAString:value];
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSValue* CJSContext::createString(const std::wstring& value)
|
||||
{
|
||||
CJSValueJSC* _value = new CJSValueJSC();
|
||||
_value->context = _getCurrentContext();
|
||||
_value->value = [NSString stringWithWString:value];
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSObject* CJSContext::createObject()
|
||||
{
|
||||
CJSObjectJSC* _value = new CJSObjectJSC();
|
||||
_value->context = _getCurrentContext();
|
||||
_value->value = [JSValue valueWithNewObjectInContext:_value->context];
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSArray* CJSContext::createArray(const int& count)
|
||||
{
|
||||
CJSArrayJSC* _value = new CJSArrayJSC();
|
||||
_value->context = _getCurrentContext();
|
||||
_value->value = [JSValue valueWithNewArrayInContext:_value->context];
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSTypedArray* CJSContext::createUint8Array(BYTE* data, int count)
|
||||
{
|
||||
JSContext* _current = _getCurrentContext();
|
||||
CJSTypedArrayJSC* _value = new CJSTypedArrayJSC(_current, data, count);
|
||||
return _value;
|
||||
}
|
||||
|
||||
JSSmart<CJSValue> CJSContext::runScript(const std::string& script, JSSmart<CJSTryCatch> exception, const std::wstring& scriptPath)
|
||||
{
|
||||
CJSValueJSC* _value = new CJSValueJSC();
|
||||
_value->value = [m_internal->context evaluateScript:[NSString stringWithAString:script]];
|
||||
_value->context = m_internal->context;
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSContext* CJSContext::GetCurrent()
|
||||
{
|
||||
CJSContext* ret = new CJSContext();
|
||||
ret->m_internal->context = _getCurrentContext();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
namespace NSJSBase
|
||||
{
|
||||
bool CJSCTryCatch::Check()
|
||||
{
|
||||
JSValue* exc = [context exception];
|
||||
if (exc == nil || [exc isNull] || [exc isUndefined])
|
||||
return false;
|
||||
|
||||
NSString* pExсeption = [[context exception] toString];
|
||||
#if 1
|
||||
NSLog(@"%@", pExсeption);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
}
|
||||
303
DesktopEditor/doctrenderer/js_internal/v8/v8_base.cpp
Normal file
303
DesktopEditor/doctrenderer/js_internal/v8/v8_base.cpp
Normal file
@ -0,0 +1,303 @@
|
||||
#include "v8_base.h"
|
||||
|
||||
CV8Initializer* CV8Worker::m_pInitializer = NULL;
|
||||
|
||||
namespace NSJSBase
|
||||
{
|
||||
|
||||
class CCacheDataScript
|
||||
{
|
||||
private:
|
||||
BYTE* Data;
|
||||
int Length;
|
||||
|
||||
v8::ScriptCompiler::Source* Source;
|
||||
v8::ScriptCompiler::CachedData* CachedData;
|
||||
|
||||
std::wstring Path;
|
||||
|
||||
public:
|
||||
CCacheDataScript(const std::wstring& sPath)
|
||||
{
|
||||
Data = NULL;
|
||||
Length = 0;
|
||||
|
||||
if (!sPath.empty())
|
||||
{
|
||||
BYTE* _data = NULL;
|
||||
DWORD _data_length = 0;
|
||||
if (NSFile::CFileBinary::ReadAllBytes(sPath, &_data, _data_length))
|
||||
{
|
||||
Data = _data;
|
||||
Length = (int)_data_length;
|
||||
}
|
||||
}
|
||||
|
||||
Source = NULL;
|
||||
CachedData = NULL;
|
||||
Path = sPath;
|
||||
}
|
||||
~CCacheDataScript()
|
||||
{
|
||||
//RELEASEOBJECT(Source);
|
||||
//RELEASEOBJECT(CachedData);
|
||||
RELEASEARRAYOBJECTS(Data);
|
||||
}
|
||||
|
||||
v8::Local<v8::Script> Compile(const v8::Local<v8::Context>& _context, const v8::Local<v8::String>& source)
|
||||
{
|
||||
v8::Local<v8::Script> script;
|
||||
if (NULL == Data)
|
||||
{
|
||||
Source = new v8::ScriptCompiler::Source(source);
|
||||
script = v8::ScriptCompiler::Compile(_context, Source, v8::ScriptCompiler::kProduceCodeCache).ToLocalChecked();
|
||||
|
||||
const v8::ScriptCompiler::CachedData* _cachedData = Source->GetCachedData();
|
||||
NSFile::CFileBinary oFileTest;
|
||||
if (oFileTest.CreateFileW(Path))
|
||||
{
|
||||
oFileTest.WriteFile(_cachedData->data, (DWORD)_cachedData->length);
|
||||
oFileTest.CloseFile();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CachedData = new v8::ScriptCompiler::CachedData(Data, Length);
|
||||
Source = new v8::ScriptCompiler::Source(source, CachedData);
|
||||
script = v8::ScriptCompiler::Compile(_context, Source, v8::ScriptCompiler::kConsumeCodeCache).ToLocalChecked();
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
bool IsInit()
|
||||
{
|
||||
return Data != NULL && Length > 0;
|
||||
}
|
||||
};
|
||||
|
||||
class CJSIsolateScopeV8 : public CJSIsolateScope
|
||||
{
|
||||
public:
|
||||
v8::Isolate::Scope isolate_scope;
|
||||
v8::Locker isolate_locker;
|
||||
|
||||
public:
|
||||
CJSIsolateScopeV8(v8::Isolate* isolate) : CJSIsolateScope(),
|
||||
isolate_scope(isolate),
|
||||
isolate_locker(isolate)
|
||||
{
|
||||
}
|
||||
virtual ~CJSIsolateScopeV8()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class CJSContextScopeV8 : public CJSContextScope
|
||||
{
|
||||
public:
|
||||
v8::Context::Scope m_scope;
|
||||
|
||||
public:
|
||||
CJSContextScopeV8(v8::Local<v8::Context> context) : m_scope(context)
|
||||
{
|
||||
}
|
||||
virtual ~CJSContextScopeV8()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class CJSLocalScopeV8 : public CJSLocalScope
|
||||
{
|
||||
public:
|
||||
v8::HandleScope m_scope;
|
||||
|
||||
public:
|
||||
CJSLocalScopeV8() : m_scope(CV8Worker::GetCurrent())
|
||||
{
|
||||
}
|
||||
virtual ~CJSLocalScopeV8()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
CJSContext::CJSContext()
|
||||
{
|
||||
m_internal = new CJSContextPrivate();
|
||||
}
|
||||
CJSContext::~CJSContext()
|
||||
{
|
||||
RELEASEOBJECT(m_internal);
|
||||
}
|
||||
|
||||
CJSTryCatch* CJSContext::GetExceptions()
|
||||
{
|
||||
return new CV8TryCatch();
|
||||
}
|
||||
|
||||
void CJSContext::Initialize()
|
||||
{
|
||||
CV8Worker::Initialize();
|
||||
m_internal->m_isolate = CV8Worker::getInitializer()->CreateNew();
|
||||
}
|
||||
void CJSContext::Dispose()
|
||||
{
|
||||
m_internal->m_isolate->Dispose();
|
||||
CV8Worker::Dispose();
|
||||
}
|
||||
|
||||
void CJSContext::CreateContext()
|
||||
{
|
||||
m_internal->m_context = v8::Context::New(CV8Worker::GetCurrent(), NULL, m_internal->m_global);
|
||||
}
|
||||
|
||||
void CJSContext::CreateGlobalForContext()
|
||||
{
|
||||
m_internal->m_global = v8::ObjectTemplate::New(CV8Worker::GetCurrent());
|
||||
}
|
||||
|
||||
CJSObject* CJSContext::GetGlobal()
|
||||
{
|
||||
CJSObjectV8* ret = new CJSObjectV8();
|
||||
ret->value = m_internal->m_context->Global();
|
||||
return ret;
|
||||
}
|
||||
|
||||
CJSIsolateScope* CJSContext::CreateIsolateScope()
|
||||
{
|
||||
return new CJSIsolateScopeV8(m_internal->m_isolate);
|
||||
}
|
||||
|
||||
CJSContextScope* CJSContext::CreateContextScope()
|
||||
{
|
||||
return new CJSContextScopeV8(m_internal->m_context);
|
||||
}
|
||||
|
||||
CJSLocalScope* CJSContext::CreateLocalScope()
|
||||
{
|
||||
return new CJSLocalScopeV8();
|
||||
}
|
||||
|
||||
CJSValue* CJSContext::createUndefined()
|
||||
{
|
||||
CJSValueV8* _value = new CJSValueV8();
|
||||
_value->doUndefined();
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSValue* CJSContext::createNull()
|
||||
{
|
||||
CJSValueV8* _value = new CJSValueV8();
|
||||
_value->doNull();
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSValue* CJSContext::createBool(const bool& value)
|
||||
{
|
||||
CJSValueV8* _value = new CJSValueV8();
|
||||
_value->value = v8::Boolean::New(CV8Worker::GetCurrent(), value);
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSValue* CJSContext::createInt(const int& value)
|
||||
{
|
||||
CJSValueV8* _value = new CJSValueV8();
|
||||
_value->value = v8::Integer::New(CV8Worker::GetCurrent(), value);
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSValue* CJSContext::createDouble(const double& value)
|
||||
{
|
||||
CJSValueV8* _value = new CJSValueV8();
|
||||
_value->value = v8::Number::New(CV8Worker::GetCurrent(), value);
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSValue* CJSContext::createString(const char* value, const int& length)
|
||||
{
|
||||
CJSValueV8* _value = new CJSValueV8();
|
||||
_value->value = v8::String::NewFromUtf8(CV8Worker::GetCurrent(), value, v8::String::kNormalString, length);
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSValue* CJSContext::createString(const std::string& value)
|
||||
{
|
||||
CJSValueV8* _value = new CJSValueV8();
|
||||
_value->value = v8::String::NewFromUtf8(CV8Worker::GetCurrent(), value.c_str(), v8::String::kNormalString, (int)value.length());
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSValue* CJSContext::createString(const std::wstring& value)
|
||||
{
|
||||
std::string sReturn = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(value);
|
||||
return createString(sReturn);
|
||||
}
|
||||
|
||||
CJSObject* CJSContext::createObject()
|
||||
{
|
||||
CJSObjectV8* _value = new CJSObjectV8();
|
||||
_value->value = v8::Object::New(CV8Worker::GetCurrent());
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSArray* CJSContext::createArray(const int& count)
|
||||
{
|
||||
CJSArrayV8* _value = new CJSArrayV8();
|
||||
_value->value = v8::Array::New(CV8Worker::GetCurrent(), count);
|
||||
_value->m_count = count;
|
||||
return _value;
|
||||
}
|
||||
|
||||
CJSTypedArray* CJSContext::createUint8Array(BYTE* data, int count)
|
||||
{
|
||||
CJSTypedArrayV8* _value = new CJSTypedArrayV8(data, count);
|
||||
return _value;
|
||||
}
|
||||
|
||||
JSSmart<CJSValue> CJSContext::runScript(const std::string& script, JSSmart<CJSTryCatch> exception, const std::wstring& scriptPath)
|
||||
{
|
||||
v8::Local<v8::String> _source = v8::String::NewFromUtf8(CV8Worker::GetCurrent(), script.c_str());
|
||||
|
||||
v8::Local<v8::Script> _script;
|
||||
if(scriptPath.length() > 0)
|
||||
{
|
||||
std::wstring sCachePath = scriptPath.substr(0, scriptPath.find(L".")) + L".cache";
|
||||
CCacheDataScript oCachedScript(sCachePath);
|
||||
// if (!oCachedScript.IsInit())
|
||||
// {
|
||||
// _script = v8::Script::Compile(_source);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
_script = oCachedScript.Compile(m_internal->m_context, _source);
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
_script = v8::Script::Compile(_source);
|
||||
}
|
||||
|
||||
CJSValueV8* _return = new CJSValueV8();
|
||||
|
||||
if (exception.is_init())
|
||||
{
|
||||
if (!exception->Check())
|
||||
_return->value = _script->Run();
|
||||
}
|
||||
else
|
||||
{
|
||||
_return->value = _script->Run();
|
||||
}
|
||||
|
||||
return _return;
|
||||
}
|
||||
|
||||
CJSContext* CJSContext::GetCurrent()
|
||||
{
|
||||
CJSContext* ret = new CJSContext();
|
||||
ret->m_internal->m_isolate = CV8Worker::GetCurrent();
|
||||
ret->m_internal->m_context = ret->m_internal->m_isolate->GetCurrentContext();
|
||||
// global???
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
760
DesktopEditor/doctrenderer/js_internal/v8/v8_base.h
Normal file
760
DesktopEditor/doctrenderer/js_internal/v8/v8_base.h
Normal file
@ -0,0 +1,760 @@
|
||||
#ifndef _BUILD_NATIVE_CONTROL_V8_BASE_H_
|
||||
#define _BUILD_NATIVE_CONTROL_V8_BASE_H_
|
||||
|
||||
#include "../js_base.h"
|
||||
|
||||
#include "v8.h"
|
||||
#include "libplatform/libplatform.h"
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include <JniLogUtils.h>
|
||||
#endif
|
||||
|
||||
class MallocArrayBufferAllocator : public v8::ArrayBuffer::Allocator
|
||||
{
|
||||
public:
|
||||
virtual void* Allocate(size_t length)
|
||||
{
|
||||
void* ret = malloc(length);
|
||||
memset(ret, 0, length);
|
||||
return ret;
|
||||
}
|
||||
virtual void* AllocateUninitialized(size_t length)
|
||||
{
|
||||
return malloc(length);
|
||||
}
|
||||
virtual void Free(void* data, size_t length)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
};
|
||||
|
||||
class CV8Initializer
|
||||
{
|
||||
private:
|
||||
v8::Platform* m_platform;
|
||||
v8::ArrayBuffer::Allocator* m_pAllocator;
|
||||
|
||||
public:
|
||||
CV8Initializer()
|
||||
{
|
||||
std::wstring sPrW = NSFile::GetProcessPath();
|
||||
std::string sPrA = U_TO_UTF8(sPrW);
|
||||
|
||||
m_pAllocator = NULL;
|
||||
|
||||
v8::V8::InitializeICUDefaultLocation(sPrA.c_str());
|
||||
v8::V8::InitializeExternalStartupData(sPrA.c_str());
|
||||
m_platform = v8::platform::CreateDefaultPlatform();
|
||||
v8::V8::InitializePlatform(m_platform);
|
||||
v8::V8::Initialize();
|
||||
}
|
||||
~CV8Initializer()
|
||||
{
|
||||
v8::V8::Dispose();
|
||||
v8::V8::ShutdownPlatform();
|
||||
delete m_platform;
|
||||
if (m_pAllocator)
|
||||
delete m_pAllocator;
|
||||
}
|
||||
|
||||
v8::ArrayBuffer::Allocator* getAllocator()
|
||||
{
|
||||
return m_pAllocator;
|
||||
}
|
||||
|
||||
v8::Isolate* CreateNew()
|
||||
{
|
||||
v8::Isolate::CreateParams create_params;
|
||||
m_pAllocator = v8::ArrayBuffer::Allocator::NewDefaultAllocator();
|
||||
create_params.array_buffer_allocator = m_pAllocator;
|
||||
return v8::Isolate::New(create_params);
|
||||
}
|
||||
};
|
||||
|
||||
class CV8Worker
|
||||
{
|
||||
private:
|
||||
static CV8Initializer* m_pInitializer;
|
||||
|
||||
public:
|
||||
CV8Worker() {}
|
||||
~CV8Worker() {}
|
||||
|
||||
static void Initialize()
|
||||
{
|
||||
if (NULL == m_pInitializer)
|
||||
m_pInitializer = new CV8Initializer();
|
||||
}
|
||||
|
||||
static void Dispose()
|
||||
{
|
||||
if (NULL != m_pInitializer)
|
||||
delete m_pInitializer;
|
||||
m_pInitializer = NULL;
|
||||
}
|
||||
|
||||
static CV8Initializer* getInitializer()
|
||||
{
|
||||
if (NULL == m_pInitializer)
|
||||
{
|
||||
m_pInitializer = new CV8Initializer();
|
||||
}
|
||||
|
||||
return CV8Worker::m_pInitializer;
|
||||
}
|
||||
|
||||
static v8::Isolate* GetCurrent()
|
||||
{
|
||||
return v8::Isolate::GetCurrent();
|
||||
}
|
||||
};
|
||||
|
||||
namespace NSJSBase
|
||||
{
|
||||
|
||||
template<typename V, typename B>
|
||||
class CJSValueV8Template : public B
|
||||
{
|
||||
public:
|
||||
v8::Local<V> value;
|
||||
|
||||
CJSValueV8Template()
|
||||
{
|
||||
}
|
||||
|
||||
CJSValueV8Template(const v8::Local<V>& _value)
|
||||
{
|
||||
value = _value;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
virtual ~CJSValueV8Template()
|
||||
{
|
||||
value.Clear();
|
||||
}
|
||||
|
||||
virtual bool isUndefined()
|
||||
{
|
||||
return value.IsEmpty() ? false : value->IsUndefined();
|
||||
}
|
||||
virtual bool isNull()
|
||||
{
|
||||
return value.IsEmpty() ? false : value->IsNull();
|
||||
}
|
||||
virtual bool isBool()
|
||||
{
|
||||
return value.IsEmpty() ? false : value->IsBoolean();
|
||||
}
|
||||
virtual bool isNumber()
|
||||
{
|
||||
return value.IsEmpty() ? false : value->IsNumber();
|
||||
}
|
||||
virtual bool isString()
|
||||
{
|
||||
return value.IsEmpty() ? false : value->IsString();
|
||||
}
|
||||
virtual bool isArray()
|
||||
{
|
||||
return value.IsEmpty() ? false : value->IsArray();
|
||||
}
|
||||
virtual bool isTypedArray()
|
||||
{
|
||||
return value.IsEmpty() ? false : value->IsTypedArray();
|
||||
}
|
||||
virtual bool isObject()
|
||||
{
|
||||
return value.IsEmpty() ? false : value->IsObject();
|
||||
}
|
||||
virtual bool isFunction()
|
||||
{
|
||||
return value.IsEmpty() ? false : value->IsFunction();
|
||||
}
|
||||
|
||||
virtual void doUndefined()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void doNull()
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool toBool()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual int toInt32()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual double toDouble()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual std::string toStringA()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::wstring toStringW()
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
|
||||
virtual CJSObject* toObject();
|
||||
virtual CJSArray* toArray();
|
||||
virtual CJSTypedArray* toTypedArray();
|
||||
virtual CJSFunction* toFunction();
|
||||
};
|
||||
|
||||
class CJSValueV8TemplatePrimitive : public CJSValueV8Template<v8::Value, CJSValue>
|
||||
{
|
||||
public:
|
||||
CJSValueV8TemplatePrimitive()
|
||||
{
|
||||
}
|
||||
CJSValueV8TemplatePrimitive(const v8::Local<v8::Value>& _value) : CJSValueV8Template<v8::Value, CJSValue>(_value)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~CJSValueV8TemplatePrimitive()
|
||||
{
|
||||
value.Clear();
|
||||
}
|
||||
|
||||
virtual void doUndefined()
|
||||
{
|
||||
value = v8::Undefined(CV8Worker::GetCurrent());
|
||||
}
|
||||
|
||||
virtual void doNull()
|
||||
{
|
||||
value = v8::Null(CV8Worker::GetCurrent());
|
||||
}
|
||||
|
||||
virtual bool toBool()
|
||||
{
|
||||
return value.IsEmpty() ? false : value->BooleanValue();
|
||||
}
|
||||
|
||||
virtual int toInt32()
|
||||
{
|
||||
return value.IsEmpty() ? 0 : value->Int32Value();
|
||||
}
|
||||
|
||||
virtual double toDouble()
|
||||
{
|
||||
return value.IsEmpty() ? 0 : value->NumberValue();
|
||||
}
|
||||
|
||||
virtual std::string toStringA()
|
||||
{
|
||||
if (value.IsEmpty())
|
||||
return "";
|
||||
|
||||
v8::String::Utf8Value data(value);
|
||||
if (NULL == *data)
|
||||
return "";
|
||||
|
||||
return std::string((char*)(*data), data.length());
|
||||
}
|
||||
|
||||
virtual std::wstring toStringW()
|
||||
{
|
||||
if (value.IsEmpty())
|
||||
return L"";
|
||||
|
||||
v8::String::Utf8Value data(value);
|
||||
if (NULL == *data)
|
||||
return L"";
|
||||
|
||||
return NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)(*data), data.length());
|
||||
}
|
||||
};
|
||||
|
||||
typedef CJSValueV8TemplatePrimitive CJSValueV8;
|
||||
|
||||
class CJSObjectV8 : public CJSValueV8Template<v8::Object, CJSObject>
|
||||
{
|
||||
public:
|
||||
CJSObjectV8()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~CJSObjectV8()
|
||||
{
|
||||
value.Clear();
|
||||
}
|
||||
|
||||
virtual CJSValue* get(const char* name)
|
||||
{
|
||||
CJSValueV8* _value = new CJSValueV8();
|
||||
v8::Local<v8::String> _name = v8::String::NewFromUtf8(CV8Worker::GetCurrent(), name, v8::String::kNormalString, -1);
|
||||
_value->value = value->Get(_name);
|
||||
return _value;
|
||||
}
|
||||
|
||||
virtual void set(const char* name, CJSValue* value_param)
|
||||
{
|
||||
CJSValueV8* _value = static_cast<CJSValueV8*>(value_param);
|
||||
v8::Local<v8::String> _name = v8::String::NewFromUtf8(CV8Worker::GetCurrent(), name, v8::String::kNormalString, -1);
|
||||
value->Set(_name, _value->value);
|
||||
}
|
||||
|
||||
virtual void set(const char* name, const int& _value)
|
||||
{
|
||||
v8::Isolate* isolate = CV8Worker::GetCurrent();
|
||||
v8::Local<v8::String> _name = v8::String::NewFromUtf8(isolate, name, v8::String::kNormalString, -1);
|
||||
value->Set(_name, v8::Integer::New(isolate, _value));
|
||||
}
|
||||
|
||||
virtual void set(const char* name, const double& _value)
|
||||
{
|
||||
v8::Isolate* isolate = CV8Worker::GetCurrent();
|
||||
v8::Local<v8::String> _name = v8::String::NewFromUtf8(isolate, name, v8::String::kNormalString, -1);
|
||||
value->Set(_name, v8::Number::New(isolate, _value));
|
||||
}
|
||||
|
||||
virtual CJSEmbedObject* getNative()
|
||||
{
|
||||
v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(value->GetInternalField(0));
|
||||
return (CJSEmbedObject*)field->Value();
|
||||
}
|
||||
|
||||
virtual JSSmart<CJSValue> call_func(const char* name, const int argc = 0, JSSmart<CJSValue> argv[] = NULL)
|
||||
{
|
||||
v8::Local<v8::String> _name = v8::String::NewFromUtf8(CV8Worker::GetCurrent(), name, v8::String::kNormalString, -1);
|
||||
v8::Handle<v8::Value> _func = value->Get(_name);
|
||||
|
||||
CJSValueV8* _return = new CJSValueV8();
|
||||
if (_func->IsFunction())
|
||||
{
|
||||
v8::Handle<v8::Function> _funcN = v8::Handle<v8::Function>::Cast(_func);
|
||||
|
||||
if (0 == argc)
|
||||
{
|
||||
_return->value = _funcN->Call(value, 0, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
v8::Local<v8::Value>* args = new v8::Local<v8::Value>[argc];
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
CJSValueV8* _value_arg = static_cast<CJSValueV8*>(argv[i].operator ->());
|
||||
args[i] = _value_arg->value;
|
||||
}
|
||||
_return->value = _funcN->Call(value, argc, args);
|
||||
RELEASEARRAYOBJECTS(args);
|
||||
}
|
||||
}
|
||||
|
||||
JSSmart<CJSValue> _ret = _return;
|
||||
return _ret;
|
||||
}
|
||||
|
||||
virtual JSSmart<CJSValue> toValue()
|
||||
{
|
||||
CJSValueV8* _value = new CJSValueV8();
|
||||
_value->value = value;
|
||||
return _value;
|
||||
}
|
||||
};
|
||||
|
||||
class CJSArrayV8 : public CJSValueV8Template<v8::Array, CJSArray>
|
||||
{
|
||||
public:
|
||||
int m_count;
|
||||
public:
|
||||
CJSArrayV8()
|
||||
{
|
||||
m_count = 0;
|
||||
}
|
||||
virtual ~CJSArrayV8()
|
||||
{
|
||||
value.Clear();
|
||||
}
|
||||
|
||||
virtual int getCount()
|
||||
{
|
||||
return value->Length();
|
||||
}
|
||||
|
||||
virtual JSSmart<CJSValue> get(const int& index)
|
||||
{
|
||||
CJSValueV8* _value = new CJSValueV8();
|
||||
_value->value = value->Get(index);
|
||||
return _value;
|
||||
}
|
||||
|
||||
virtual void set(const int& index, CJSValue* value_param)
|
||||
{
|
||||
CJSValueV8* _value = static_cast<CJSValueV8*>(value_param);
|
||||
value->Set(index, _value->value);
|
||||
}
|
||||
|
||||
virtual void add(CJSValue* value_param)
|
||||
{
|
||||
CJSValueV8* _value = static_cast<CJSValueV8*>(value_param);
|
||||
value->Set(getCount(), _value->value);
|
||||
}
|
||||
|
||||
virtual void set(const int& index, const bool& _value)
|
||||
{
|
||||
value->Set(index, v8::Boolean::New(CV8Worker::GetCurrent(), _value));
|
||||
}
|
||||
|
||||
virtual void set(const int& index, const int& _value)
|
||||
{
|
||||
value->Set(index, v8::Integer::New(CV8Worker::GetCurrent(), _value));
|
||||
}
|
||||
|
||||
virtual void set(const int& index, const double& _value)
|
||||
{
|
||||
value->Set(index, v8::Number::New(CV8Worker::GetCurrent(), _value));
|
||||
}
|
||||
|
||||
virtual void add_null()
|
||||
{
|
||||
value->Set(m_count++, v8::Null(CV8Worker::GetCurrent()));
|
||||
}
|
||||
|
||||
virtual void add_undefined()
|
||||
{
|
||||
value->Set(m_count++, v8::Undefined(CV8Worker::GetCurrent()));
|
||||
}
|
||||
|
||||
virtual void add_bool(const bool& _value)
|
||||
{
|
||||
value->Set(m_count++, v8::Boolean::New(CV8Worker::GetCurrent(), _value));
|
||||
}
|
||||
|
||||
virtual void add_byte(const BYTE& _value)
|
||||
{
|
||||
value->Set(m_count++, v8::Integer::New(CV8Worker::GetCurrent(), (int)_value));
|
||||
}
|
||||
|
||||
virtual void add_int(const int& _value)
|
||||
{
|
||||
value->Set(m_count++, v8::Integer::New(CV8Worker::GetCurrent(), _value));
|
||||
}
|
||||
|
||||
virtual void add_double(const double& _value)
|
||||
{
|
||||
value->Set(m_count++, v8::Number::New(CV8Worker::GetCurrent(), _value));
|
||||
}
|
||||
|
||||
virtual void add_stringa(const std::string& _value)
|
||||
{
|
||||
value->Set(m_count++, v8::String::NewFromUtf8(CV8Worker::GetCurrent(), _value.c_str(), v8::String::kNormalString, (int)_value.length()));
|
||||
}
|
||||
|
||||
virtual void add_string(const std::wstring& _value)
|
||||
{
|
||||
std::string sReturn = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(_value);
|
||||
add_stringa(sReturn);
|
||||
}
|
||||
|
||||
virtual JSSmart<CJSValue> toValue()
|
||||
{
|
||||
CJSValueV8* _value = new CJSValueV8();
|
||||
_value->value = value;
|
||||
return _value;
|
||||
}
|
||||
};
|
||||
|
||||
class CJSTypedArrayV8 : public CJSValueV8Template<v8::Uint8Array, CJSTypedArray>
|
||||
{
|
||||
public:
|
||||
CJSTypedArrayV8(BYTE* data = NULL, int count = 0)
|
||||
{
|
||||
if (0 < count)
|
||||
{
|
||||
v8::Local<v8::ArrayBuffer> _buffer = v8::ArrayBuffer::New(CV8Worker::GetCurrent(), (void*)data, (size_t)count);
|
||||
value = v8::Uint8Array::New(_buffer, 0, (size_t)count);
|
||||
}
|
||||
}
|
||||
virtual ~CJSTypedArrayV8()
|
||||
{
|
||||
value.Clear();
|
||||
}
|
||||
|
||||
virtual int getCount()
|
||||
{
|
||||
return (int)value->ByteLength();
|
||||
}
|
||||
|
||||
virtual const BYTE* getData()
|
||||
{
|
||||
return (BYTE*)value->Buffer()->Externalize().Data();
|
||||
}
|
||||
};
|
||||
|
||||
class CJSFunctionV8 : public CJSValueV8Template<v8::Function, CJSFunction>
|
||||
{
|
||||
public:
|
||||
CJSFunctionV8()
|
||||
{
|
||||
}
|
||||
virtual ~CJSFunctionV8()
|
||||
{
|
||||
value.Clear();
|
||||
}
|
||||
|
||||
virtual CJSValue* Call(CJSValue* recv, int argc, JSSmart<CJSValue> argv[])
|
||||
{
|
||||
CJSValueV8* _value = static_cast<CJSValueV8*>(recv);
|
||||
CJSValueV8* _return = new CJSValueV8();
|
||||
if (0 == argc)
|
||||
{
|
||||
_return->value = value->Call(_value->value, 0, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
v8::Local<v8::Value>* args = new v8::Local<v8::Value>[argc];
|
||||
for (int i = 0; i < argc; ++i)
|
||||
{
|
||||
CJSValueV8* _value_arg = static_cast<CJSValueV8*>(argv[i].operator ->());
|
||||
args[i] = _value_arg->value;
|
||||
}
|
||||
_return->value = value->Call(_value->value, argc, args);
|
||||
RELEASEARRAYOBJECTS(args);
|
||||
}
|
||||
return _return;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename V, typename B>
|
||||
CJSObject* CJSValueV8Template<V, B>::toObject()
|
||||
{
|
||||
CJSObjectV8* _value = new CJSObjectV8();
|
||||
_value->value = value->ToObject();
|
||||
return _value;
|
||||
}
|
||||
|
||||
template<typename V, typename B>
|
||||
CJSArray* CJSValueV8Template<V, B>::toArray()
|
||||
{
|
||||
CJSArrayV8* _value = new CJSArrayV8();
|
||||
_value->value = v8::Local<v8::Array>::Cast(value);
|
||||
return _value;
|
||||
}
|
||||
|
||||
template<typename V, typename B>
|
||||
CJSTypedArray* CJSValueV8Template<V, B>::toTypedArray()
|
||||
{
|
||||
CJSTypedArrayV8* _value = new CJSTypedArrayV8();
|
||||
_value->value = v8::Local<v8::Uint8Array>::Cast(value);
|
||||
return _value;
|
||||
}
|
||||
|
||||
template<typename V, typename B>
|
||||
CJSFunction* CJSValueV8Template<V, B>::toFunction()
|
||||
{
|
||||
CJSFunctionV8* _value = new CJSFunctionV8();
|
||||
_value->value = v8::Local<v8::Function>::Cast(value);
|
||||
return _value;
|
||||
}
|
||||
}
|
||||
|
||||
namespace NSJSBase
|
||||
{
|
||||
// TRY - CATCH
|
||||
class CV8TryCatch : public CJSTryCatch
|
||||
{
|
||||
private:
|
||||
v8::TryCatch try_catch;
|
||||
|
||||
public:
|
||||
CV8TryCatch() : CJSTryCatch(), try_catch()
|
||||
{
|
||||
}
|
||||
virtual ~CV8TryCatch()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual bool Check()
|
||||
{
|
||||
if (try_catch.HasCaught())
|
||||
{
|
||||
int nLineNumber = try_catch.Message()->GetLineNumber();
|
||||
|
||||
JSSmart<CJSValueV8> _line = new CJSValueV8();
|
||||
_line->value = try_catch.Message()->GetSourceLine();
|
||||
|
||||
JSSmart<CJSValueV8> _exception = new CJSValueV8();
|
||||
_exception->value = try_catch.Message()->Get();
|
||||
|
||||
std::string strCode = _line->toStringA();
|
||||
std::string strException = _exception->toStringA();
|
||||
|
||||
#if 0 && !defined(__ANDROID__)
|
||||
FILE* f = fopen("D:\\errors.txt", "a+");
|
||||
fprintf(f, "error: ");
|
||||
fprintf(f, strCode.c_str());
|
||||
fprintf(f, "\n");
|
||||
fprintf(f, strException.c_str());
|
||||
fprintf(f, "\n");
|
||||
fclose(f);
|
||||
#endif
|
||||
|
||||
#ifdef __ANDROID__
|
||||
LOGE("NSJSBase::CV8TryCatch::Check() - error:");
|
||||
LOGE(std::to_string(nLineNumber).c_str());
|
||||
LOGE(strCode.c_str());
|
||||
LOGE(strException.c_str());
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace NSJSBase
|
||||
{
|
||||
class CJSContextPrivate
|
||||
{
|
||||
public:
|
||||
CV8Worker m_oWorker;
|
||||
v8::Isolate* m_isolate;
|
||||
|
||||
v8::Local<v8::ObjectTemplate> m_global;
|
||||
v8::Local<v8::Context> m_context;
|
||||
|
||||
public:
|
||||
CJSContextPrivate() : m_oWorker(), m_isolate(NULL)
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace NSV8Objects
|
||||
{
|
||||
static void Template_Set(v8::Local<v8::ObjectTemplate>& obj, const char* name, v8::FunctionCallback callback)
|
||||
{
|
||||
v8::Isolate* current = CV8Worker::GetCurrent();
|
||||
obj->Set(v8::String::NewFromUtf8(current, name), v8::FunctionTemplate::New(current, callback));
|
||||
}
|
||||
}
|
||||
|
||||
inline NSJSBase::CJSEmbedObject* unwrap_native(const v8::Local<v8::Object>& value)
|
||||
{
|
||||
v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(value->GetInternalField(0));
|
||||
return (NSJSBase::CJSEmbedObject*)field->Value();
|
||||
}
|
||||
inline NSJSBase::CJSEmbedObject* unwrap_native2(const v8::Local<v8::Value>& value)
|
||||
{
|
||||
v8::Local<v8::Object> _obj = value->ToObject();
|
||||
v8::Handle<v8::External> field = v8::Handle<v8::External>::Cast(_obj->GetInternalField(0));
|
||||
return (NSJSBase::CJSEmbedObject*)field->Value();
|
||||
}
|
||||
|
||||
inline JSSmart<NSJSBase::CJSValue> js_value(const v8::Local<v8::Value>& value)
|
||||
{
|
||||
return new NSJSBase::CJSValueV8(value);
|
||||
}
|
||||
inline JSSmart<NSJSBase::CJSValue> js_object(const v8::Local<v8::Object>& value)
|
||||
{
|
||||
NSJSBase::CJSObjectV8* _ret = new NSJSBase::CJSObjectV8();
|
||||
_ret->value = value;
|
||||
return _ret;
|
||||
}
|
||||
inline void js_return(const v8::FunctionCallbackInfo<v8::Value>& args, JSSmart<NSJSBase::CJSValue>& value)
|
||||
{
|
||||
if (value.is_init())
|
||||
{
|
||||
NSJSBase::CJSValueV8* _value = (NSJSBase::CJSValueV8*)(value.operator ->());
|
||||
args.GetReturnValue().Set(_value->value);
|
||||
}
|
||||
}
|
||||
|
||||
#define FUNCTION_WRAPPER_V8(NAME, NAME_EMBED) \
|
||||
void NAME(const v8::FunctionCallbackInfo<v8::Value>& args) \
|
||||
{ \
|
||||
CURRENTWRAPPER* _this = (CURRENTWRAPPER*)unwrap_native(args.This()); \
|
||||
JSSmart<CJSValue> ret = _this->NAME_EMBED(); \
|
||||
js_return(args, ret); \
|
||||
}
|
||||
|
||||
#define FUNCTION_WRAPPER_V8_1(NAME, NAME_EMBED) \
|
||||
void NAME(const v8::FunctionCallbackInfo<v8::Value>& args) \
|
||||
{ \
|
||||
CURRENTWRAPPER* _this = (CURRENTWRAPPER*)unwrap_native(args.This()); \
|
||||
JSSmart<CJSValue> ret = _this->NAME_EMBED(js_value(args[0])); \
|
||||
js_return(args, ret); \
|
||||
}
|
||||
#define FUNCTION_WRAPPER_V8_2(NAME, NAME_EMBED) \
|
||||
void NAME(const v8::FunctionCallbackInfo<v8::Value>& args) \
|
||||
{ \
|
||||
CURRENTWRAPPER* _this = (CURRENTWRAPPER*)unwrap_native(args.This()); \
|
||||
JSSmart<CJSValue> ret = _this->NAME_EMBED(js_value(args[0]), js_value(args[1])); \
|
||||
js_return(args, ret); \
|
||||
}
|
||||
#define FUNCTION_WRAPPER_V8_3(NAME, NAME_EMBED) \
|
||||
void NAME(const v8::FunctionCallbackInfo<v8::Value>& args) \
|
||||
{ \
|
||||
CURRENTWRAPPER* _this = (CURRENTWRAPPER*)unwrap_native(args.This()); \
|
||||
JSSmart<CJSValue> ret = _this->NAME_EMBED(js_value(args[0]), js_value(args[1]), js_value(args[2])); \
|
||||
js_return(args, ret); \
|
||||
}
|
||||
#define FUNCTION_WRAPPER_V8_4(NAME, NAME_EMBED) \
|
||||
void NAME(const v8::FunctionCallbackInfo<v8::Value>& args) \
|
||||
{ \
|
||||
CURRENTWRAPPER* _this = (CURRENTWRAPPER*)unwrap_native(args.This()); \
|
||||
JSSmart<CJSValue> ret = _this->NAME_EMBED(js_value(args[0]), js_value(args[1]), js_value(args[2]), js_value(args[3])); \
|
||||
js_return(args, ret); \
|
||||
}
|
||||
#define FUNCTION_WRAPPER_V8_5(NAME, NAME_EMBED) \
|
||||
void NAME(const v8::FunctionCallbackInfo<v8::Value>& args) \
|
||||
{ \
|
||||
CURRENTWRAPPER* _this = (CURRENTWRAPPER*)unwrap_native(args.This()); \
|
||||
JSSmart<CJSValue> ret = _this->NAME_EMBED(js_value(args[0]), js_value(args[1]), js_value(args[2]), js_value(args[3]), js_value(args[4])); \
|
||||
js_return(args, ret); \
|
||||
}
|
||||
#define FUNCTION_WRAPPER_V8_6(NAME, NAME_EMBED) \
|
||||
void NAME(const v8::FunctionCallbackInfo<v8::Value>& args) \
|
||||
{ \
|
||||
CURRENTWRAPPER* _this = (CURRENTWRAPPER*)unwrap_native(args.This()); \
|
||||
JSSmart<CJSValue> ret = _this->NAME_EMBED(js_value(args[0]), js_value(args[1]), js_value(args[2]), js_value(args[3]), js_value(args[4]), js_value(args[5])); \
|
||||
js_return(args, ret); \
|
||||
}
|
||||
#define FUNCTION_WRAPPER_V8_7(NAME, NAME_EMBED) \
|
||||
void NAME(const v8::FunctionCallbackInfo<v8::Value>& args) \
|
||||
{ \
|
||||
CURRENTWRAPPER* _this = (CURRENTWRAPPER*)unwrap_native(args.This()); \
|
||||
JSSmart<CJSValue> ret = _this->NAME_EMBED(js_value(args[0]), js_value(args[1]), js_value(args[2]), js_value(args[3]), js_value(args[4]), \
|
||||
js_value(args[5]), js_value(args[6])); \
|
||||
js_return(args, ret); \
|
||||
}
|
||||
#define FUNCTION_WRAPPER_V8_8(NAME, NAME_EMBED) \
|
||||
void NAME(const v8::FunctionCallbackInfo<v8::Value>& args) \
|
||||
{ \
|
||||
CURRENTWRAPPER* _this = (CURRENTWRAPPER*)unwrap_native(args.This()); \
|
||||
JSSmart<CJSValue> ret = _this->NAME_EMBED(js_value(args[0]), js_value(args[1]), js_value(args[2]), js_value(args[3]), js_value(args[4]), \
|
||||
js_value(args[5]), js_value(args[6]), js_value(args[7])); \
|
||||
js_return(args, ret); \
|
||||
}
|
||||
#define FUNCTION_WRAPPER_V8_10(NAME, NAME_EMBED) \
|
||||
void NAME(const v8::FunctionCallbackInfo<v8::Value>& args) \
|
||||
{ \
|
||||
CURRENTWRAPPER* _this = (CURRENTWRAPPER*)unwrap_native(args.This()); \
|
||||
JSSmart<CJSValue> ret = _this->NAME_EMBED(js_value(args[0]), js_value(args[1]), js_value(args[2]), js_value(args[3]), js_value(args[4]), js_value(args[5]), \
|
||||
js_value(args[6]), js_value(args[7]), js_value(args[8]), js_value(args[9])); \
|
||||
js_return(args, ret); \
|
||||
}
|
||||
#define FUNCTION_WRAPPER_V8_13(NAME, NAME_EMBED) \
|
||||
void NAME(const v8::FunctionCallbackInfo<v8::Value>& args) \
|
||||
{ \
|
||||
CURRENTWRAPPER* _this = (CURRENTWRAPPER*)unwrap_native(args.This()); \
|
||||
JSSmart<CJSValue> ret = _this->NAME_EMBED(js_value(args[0]), js_value(args[1]), js_value(args[2]), js_value(args[3]), js_value(args[4]), js_value(args[5]), \
|
||||
js_value(args[6]), js_value(args[7]), js_value(args[8]), js_value(args[9]), js_value(args[10]), js_value(args[11]), \
|
||||
js_value(args[12])); \
|
||||
js_return(args, ret); \
|
||||
}
|
||||
|
||||
#endif // _BUILD_NATIVE_CONTROL_V8_BASE_H_
|
||||
@ -1,277 +0,0 @@
|
||||
#ifndef CJSGRAPHICS_H
|
||||
#define CJSGRAPHICS_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "../../common/Types.h"
|
||||
#include "../../../Common/3dParty/v8/v8/include/v8.h"
|
||||
#include "../../../Common/3dParty/v8/v8/include/libplatform/libplatform.h"
|
||||
|
||||
struct CFont
|
||||
{
|
||||
std::string Name;
|
||||
int FontSize;
|
||||
bool Bold;
|
||||
bool Italic;
|
||||
|
||||
CFont() : Name(""), FontSize(10), Bold(false), Italic(false) {}
|
||||
};
|
||||
|
||||
struct CLastFontOriginInfo
|
||||
{
|
||||
std::string Name;
|
||||
v8::Local<v8::Value>* Replace;
|
||||
|
||||
CLastFontOriginInfo() : Name(""), Replace(nullptr) {}
|
||||
};
|
||||
|
||||
class CJSGraphics
|
||||
{
|
||||
private:
|
||||
v8::Local<v8::Value>* m_oContext;
|
||||
double m_dWidthMM;
|
||||
double m_dHeightMM;
|
||||
double m_lWidthPix;
|
||||
double m_lHeightPix;
|
||||
double m_dDpiX;
|
||||
double m_dDpiY;
|
||||
bool m_bIsBreak;
|
||||
|
||||
v8::Local<v8::Value>* m_oPen;
|
||||
bool m_bPenColorInit;
|
||||
v8::Local<v8::Value>* m_oBrush;
|
||||
bool m_bBrushColorInit;
|
||||
|
||||
v8::Local<v8::Value>* m_oFontManager;
|
||||
|
||||
v8::Local<v8::Value>* m_oCoordTransform;
|
||||
v8::Local<v8::Value>* m_oBaseTransform;
|
||||
v8::Local<v8::Value>* m_oTransform;
|
||||
v8::Local<v8::Value>* m_oFullTransform;
|
||||
v8::Local<v8::Value>* m_oInvertFullTransform;
|
||||
|
||||
v8::Local<v8::Value>* ArrayPoints;
|
||||
|
||||
CFont m_oCurFont;
|
||||
|
||||
v8::Local<v8::Value>* m_oTextPr;
|
||||
v8::Local<v8::Value>* m_oGrFonts;
|
||||
v8::Local<v8::Value>* m_oLastFont;
|
||||
|
||||
CLastFontOriginInfo LastFontOriginInfo;
|
||||
|
||||
bool m_bIntegerGrid;
|
||||
|
||||
v8::Local<v8::Value>* ClipManager;
|
||||
|
||||
int TextureFillTransformScaleX;
|
||||
int TextureFillTransformScaleY;
|
||||
bool IsThumbnail;
|
||||
|
||||
bool IsDemonstrationMode;
|
||||
|
||||
v8::Local<v8::Value>* GrState;
|
||||
|
||||
int globalAlpha;
|
||||
|
||||
v8::Local<v8::Value>* TextClipRect;
|
||||
bool IsClipContext;
|
||||
|
||||
bool IsUseFonts2;
|
||||
v8::Local<v8::Value>* m_oFontManager2;
|
||||
v8::Local<v8::Value>* m_oLastFont2;
|
||||
|
||||
bool ClearMode;
|
||||
bool IsRetina;
|
||||
|
||||
v8::Local<v8::Value>* dash_no_smart;
|
||||
public:
|
||||
CJSGraphics();
|
||||
~CJSGraphics();
|
||||
|
||||
void init(v8::Local<v8::Value>* context, double width_px, double height_px, double width_mm, double height_mm);
|
||||
void EndDraw() {}
|
||||
void put_GlobalAlpha(bool enable, int globalAlpha);
|
||||
void Start_GlobalAlpha() {}
|
||||
void End_GlobalAlpha();
|
||||
// pen methods
|
||||
void p_color(int r, int g, int b, int a);
|
||||
void p_width(int w);
|
||||
void p_dash(const v8::Local<v8::Value>& params);
|
||||
// brush methods
|
||||
void b_color1(int r, int g, int b, int a);
|
||||
void b_color2(int r, int g, int b, int a);
|
||||
void transform(double sx, double shy, double shx, double sy, double tx, double ty);
|
||||
void CalculateFullTransform(bool isInvertNeed);
|
||||
// path commands
|
||||
void _s();
|
||||
void _e();
|
||||
void _z();
|
||||
void _m(double x, double y);
|
||||
void _l(double x, double y);
|
||||
void _c(double x1, double y1, double x2, double y2, double x3, double y3);
|
||||
void _c2(double x1, double y1, double x2, double y2);
|
||||
void ds();
|
||||
void df();
|
||||
// canvas state
|
||||
void save();
|
||||
void restore();
|
||||
void clip();
|
||||
void reset();
|
||||
void transform3(const v8::Local<v8::Value>& m, bool isNeedInvert);
|
||||
void FreeFont();
|
||||
void ClearLastFont();
|
||||
// images
|
||||
void drawImage2(const v8::Local<v8::Value>& img, double x, double y, double w, double h, int alpha, const v8::Local<v8::Value>& srcRect);
|
||||
void drawImage(const v8::Local<v8::Value>& img, double x, double y, double w, double h, int alpha, const v8::Local<v8::Value>& srcRect, const v8::Local<v8::Value>& nativeImage);
|
||||
// text
|
||||
CFont GetFont();
|
||||
void font(unsigned int font_id, int font_size);
|
||||
void SetFont(const v8::Local<v8::Value>& font);
|
||||
void SetTextPr(const v8::Local<v8::Value>& textPr, const v8::Local<v8::Value>& theme);
|
||||
void SetFontSlot(const v8::Local<v8::Value>& slot, double fontSizeKoef);
|
||||
v8::Local<v8::Value> GetTextPr();
|
||||
void FillText(double x, double y, const v8::Local<v8::Value>& text);
|
||||
void t(const v8::Local<v8::Value>& text, double x, double y, bool isBounds);
|
||||
void FillText2(double x, double y, const v8::Local<v8::Value>& text, double cropX, double cropW);
|
||||
void t2(const v8::Local<v8::Value>& text, double x, double y, double cropX, double cropW);
|
||||
void FillTextCode(double x, double y, const v8::Local<v8::Value>& lUnicode);
|
||||
void tg(const v8::Local<v8::Value>& text, double x, double y);
|
||||
void charspace(const v8::Local<v8::Value>& space) {}
|
||||
// private methods
|
||||
void private_FillGlyph(const v8::Local<v8::Value>& pGlyph, const v8::Local<v8::Value>& _bounds);
|
||||
void private_FillGlyphC(const v8::Local<v8::Value>& pGlyph, double cropX, double cropW);
|
||||
void private_FillGlyph2(const v8::Local<v8::Value>& pGlyph);
|
||||
void SetIntegerGrid(bool param);
|
||||
bool GetIntegerGrid();
|
||||
void DrawStringASCII(const std::string& name, int size, bool bold, bool italic, const v8::Local<v8::Value>& text, double x, double y, bool bIsHeader);
|
||||
void DrawStringASCII2(const std::string& name, int size, bool bold, bool italic, const v8::Local<v8::Value>& text, double x, double y, bool bIsHeader);
|
||||
void DrawHeaderEdit(double yPos, const v8::Local<v8::Value>& lock_type, int sectionNum, bool bIsRepeat, const v8::Local<v8::Value>& type);
|
||||
void DrawFooterEdit(double yPos, const v8::Local<v8::Value>& lock_type, int sectionNum, bool bIsRepeat, const v8::Local<v8::Value>& type);
|
||||
void DrawLockParagraph(const v8::Local<v8::Value>& lock_type, double x, double y1, double y2);
|
||||
void DrawLockObjectRect(const v8::Local<v8::Value>& lock_type, double x, double y, double w, double h);
|
||||
void DrawEmptyTableLine(double x1, double y1, double x2, double y2);
|
||||
void DrawSpellingLine(double y0, double x0, double x1, double w);
|
||||
// smart methods for horizontal / vertical lines
|
||||
void drawHorLine(int align, double y, double x, double r, int penW);
|
||||
void drawHorLine2(int align, double y, double x, double r, int penW);
|
||||
void drawVerLine(int align, double x, double y, double b, int penW);
|
||||
// мега крутые функции для таблиц
|
||||
void drawHorLineExt(int align, double y, double x, double r, int penW, double leftMW, double rightMW);
|
||||
void rect(double x, double y, double w, double h);
|
||||
void TableRect(double x, double y, double w, double h);
|
||||
// функции клиппирования
|
||||
void AddClipRect(double x, double y, double w, double h);
|
||||
void RemoveClipRect() {}
|
||||
void SetClip(const v8::Local<v8::Value>& r);
|
||||
void RemoveClip();
|
||||
void drawCollaborativeChanges(double x, double y, double w, double h, const v8::Local<v8::Value>& Color);
|
||||
void drawMailMergeField(double x, double y, double w, double h);
|
||||
void drawSearchResult(double x, double y, double w, double h);
|
||||
void drawFlowAnchor(double x, double y);
|
||||
void SavePen();
|
||||
void RestorePen();
|
||||
void SaveBrush();
|
||||
void RestoreBrush();
|
||||
void SavePenBrush();
|
||||
void RestorePenBrush();
|
||||
void SaveGrState();
|
||||
void RestoreGrState();
|
||||
void StartClipPath() {}
|
||||
void EndClipPath();
|
||||
void StartCheckTableDraw();
|
||||
void EndCheckTableDraw(bool bIsRestore);
|
||||
void SetTextClipRect(double _l, double _t, double _r, double _b);
|
||||
void AddSmartRect(double x, double y, double w, double h, int pen_w);
|
||||
void CheckUseFonts2(const v8::Local<v8::Value>& _transform);
|
||||
void UncheckUseFonts2();
|
||||
void Drawing_StartCheckBounds(double x, double y, double w, double h) {}
|
||||
void Drawing_EndCheckBounds() {}
|
||||
void DrawPresentationComment(const v8::Local<v8::Value>& type, double x, double y, double w, double h);
|
||||
void DrawPolygon(const v8::Local<v8::Value>& oPath, int lineWidth, double shift);
|
||||
void DrawFootnoteRect(double x, double y, double w, double h);
|
||||
|
||||
v8::Local<v8::Value>* m_oContext_get() { return m_oContext; }
|
||||
v8::Local<v8::Value>* m_oPen_get() { return m_oPen; }
|
||||
v8::Local<v8::Value>* m_oBrush_get() { return m_oBrush; }
|
||||
v8::Local<v8::Value>* m_oFontManager_get() { return m_oFontManager; }
|
||||
v8::Local<v8::Value>* m_oCoordTransform_get() { return m_oCoordTransform; }
|
||||
v8::Local<v8::Value>* m_oBaseTransform_get() { return m_oBaseTransform; }
|
||||
v8::Local<v8::Value>* m_oTransform_get() { return m_oTransform; }
|
||||
v8::Local<v8::Value>* m_oFullTransform_get() { return m_oFullTransform; }
|
||||
v8::Local<v8::Value>* m_oInvertFullTransform_get() { return m_oInvertFullTransform; }
|
||||
v8::Local<v8::Value>* ArrayPoints_get() { return ArrayPoints; }
|
||||
v8::Local<v8::Value>* m_oTextPr_get() { return m_oTextPr; }
|
||||
v8::Local<v8::Value>* m_oGrFonts_get() { return m_oGrFonts; }
|
||||
v8::Local<v8::Value>* m_oLastFont_get() { return m_oLastFont; }
|
||||
v8::Local<v8::Value>* ClipManager_get() { return ClipManager; }
|
||||
v8::Local<v8::Value>* GrState_get() { return GrState; }
|
||||
v8::Local<v8::Value>* TextClipRect_get() { return TextClipRect; }
|
||||
v8::Local<v8::Value>* m_oFontManager2_get() { return m_oFontManager2; }
|
||||
v8::Local<v8::Value>* m_oLastFont2_get() { return m_oLastFont2; }
|
||||
v8::Local<v8::Value>* dash_no_smart_get() { return dash_no_smart; }
|
||||
double m_dWidthMM_get() { return m_dWidthMM; }
|
||||
double m_dHeightMM_get() { return m_dHeightMM; }
|
||||
double m_lWidthPix_get() { return m_lWidthPix; }
|
||||
double m_lHeightPix_get() { return m_lHeightPix; }
|
||||
double m_dDpiX_get() { return m_dDpiX; }
|
||||
double m_dDpiY_get() { return m_dDpiY; }
|
||||
bool m_bIsBreak_get() { return m_bIsBreak; }
|
||||
bool m_bPenColorInit_get() { return m_bPenColorInit; }
|
||||
bool m_bBrushColorInit_get() { return m_bBrushColorInit; }
|
||||
bool m_bIntegerGrid_get() { return m_bIntegerGrid; }
|
||||
bool IsThumbnail_get() { return IsThumbnail; }
|
||||
bool IsDemonstrationMode_get() { return IsDemonstrationMode; }
|
||||
bool IsClipContext_get() { return IsClipContext; }
|
||||
bool IsUseFonts2_get() { return IsUseFonts2; }
|
||||
bool ClearMode_get() { return ClearMode; }
|
||||
bool IsRetina_get() { return IsRetina; }
|
||||
CFont m_oCurFont_get() { return m_oCurFont; }
|
||||
CLastFontOriginInfo LastFontOriginInfo_get() { return LastFontOriginInfo; }
|
||||
int TextureFillTransformScaleX_get() { return TextureFillTransformScaleX; }
|
||||
int TextureFillTransformScaleY_get() { return TextureFillTransformScaleY; }
|
||||
int globalAlpha_get() { return globalAlpha; }
|
||||
|
||||
void m_oContext_set (v8::Local<v8::Value>* a) { m_oContext = a; }
|
||||
void m_oPen_set (v8::Local<v8::Value>* a) { m_oPen = a; }
|
||||
void m_oBrush_set (v8::Local<v8::Value>* a) { m_oBrush = a; }
|
||||
void m_oFontManager_set (v8::Local<v8::Value>* a) { m_oFontManager = a; }
|
||||
void m_oCoordTransform_set (v8::Local<v8::Value>* a) { m_oCoordTransform = a; }
|
||||
void m_oBaseTransform_set (v8::Local<v8::Value>* a) { m_oBaseTransform = a; }
|
||||
void m_oTransform_set (v8::Local<v8::Value>* a) { m_oTransform = a; }
|
||||
void m_oFullTransform_set (v8::Local<v8::Value>* a) { m_oFullTransform = a; }
|
||||
void m_oInvertFullTransform_set(v8::Local<v8::Value>* a) { m_oInvertFullTransform = a; }
|
||||
void ArrayPoints_set (v8::Local<v8::Value>* a) { ArrayPoints = a; }
|
||||
void m_oTextPr_set (v8::Local<v8::Value>* a) { m_oTextPr = a; }
|
||||
void m_oGrFonts_set (v8::Local<v8::Value>* a) { m_oGrFonts = a; }
|
||||
void m_oLastFont_set (v8::Local<v8::Value>* a) { m_oLastFont = a; }
|
||||
void ClipManager_set (v8::Local<v8::Value>* a) { ClipManager = a; }
|
||||
void GrState_set (v8::Local<v8::Value>* a) { GrState = a; }
|
||||
void TextClipRect_set (v8::Local<v8::Value>* a) { TextClipRect = a; }
|
||||
void m_oFontManager2_set (v8::Local<v8::Value>* a) { m_oFontManager2 = a; }
|
||||
void m_oLastFont2_set (v8::Local<v8::Value>* a) { m_oLastFont2 = a; }
|
||||
void dash_no_smart_set (v8::Local<v8::Value>* a) { dash_no_smart = a; }
|
||||
void m_dWidthMM_set (double a) { m_dWidthMM = a; }
|
||||
void m_dHeightMM_set (double a) { m_dHeightMM = a; }
|
||||
void m_lWidthPix_set (double a) { m_lWidthPix = a; }
|
||||
void m_lHeightPix_set (double a) { m_lHeightPix = a; }
|
||||
void m_dDpiX_set (double a) { m_dDpiX = a; }
|
||||
void m_dDpiY_set (double a) { m_dDpiY = a; }
|
||||
void m_bIsBreak_set (bool a) { m_bIsBreak = a; }
|
||||
void m_bPenColorInit_set (bool a) { m_bPenColorInit = a; }
|
||||
void m_bBrushColorInit_set (bool a) { m_bBrushColorInit = a; }
|
||||
void m_bIntegerGrid_set (bool a) { m_bIntegerGrid = a; }
|
||||
void IsThumbnail_set (bool a) { IsThumbnail = a; }
|
||||
void IsDemonstrationMode_set(bool a) { IsDemonstrationMode = a; }
|
||||
void IsClipContext_set (bool a) { IsClipContext = a; }
|
||||
void IsUseFonts2_set (bool a) { IsUseFonts2 = a; }
|
||||
void ClearMode_set (bool a) { ClearMode = a; }
|
||||
void IsRetina_set (bool a) { IsRetina = a; }
|
||||
void m_oCurFont_set (CFont a) { m_oCurFont = a; }
|
||||
void LastFontOriginInfo_set(CLastFontOriginInfo a) { LastFontOriginInfo = a; }
|
||||
void TextureFillTransformScaleX_set(int a) { TextureFillTransformScaleX = a; }
|
||||
void TextureFillTransformScaleY_set(int a) { TextureFillTransformScaleY = a; }
|
||||
void globalAlpha_set (int a) { globalAlpha = a; }
|
||||
};
|
||||
|
||||
#endif // CJSGRAPHICS_H
|
||||
@ -1,190 +0,0 @@
|
||||
#include "graphics.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
double to_double(const v8::Local<v8::Value>& v);
|
||||
bool to_bool (const v8::Local<v8::Value>& v);
|
||||
int to_int (const v8::Local<v8::Value>& v);
|
||||
unsigned int to_uint (const v8::Local<v8::Value>& v);
|
||||
std::string to_string(const v8::Local<v8::Value>& v);
|
||||
|
||||
CJSGraphics* unwrap_Graphics (v8::Handle<v8::Object> obj);
|
||||
CFont* unwrap_Font (v8::Handle<v8::Object> obj);
|
||||
CLastFontOriginInfo* unwrap_LastFontOriginInfo(v8::Handle<v8::Object> obj);
|
||||
|
||||
void init_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void EndDraw_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void put_GlobalAlpha_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void Start_GlobalAlpha_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void End_GlobalAlpha_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void p_color_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void p_width_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void p_dash_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void b_color1_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void b_color2_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void transform_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void CalculateFullTransform_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void _s_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void _e_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void _z_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void _m_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void _l_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void _c_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void _c2_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void ds_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void df_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void save_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void restore_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void clip_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void reset_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void transform3_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void FreeFont_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void ClearLastFont_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void drawImage2_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void drawImage_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void GetFont_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void font_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void SetFont_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void SetTextPr_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void SetFontSlot_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void GetTextPr_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void FillText_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void t_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void FillText2_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void t2_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void FillTextCode_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void tg_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void charspace_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void private_FillGlyph_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void private_FillGlyphC_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void private_FillGlyph2_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void SetIntegerGrid_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void GetIntegerGrid_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void DrawStringASCII_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void DrawStringASCII2_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void DrawHeaderEdit_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void DrawFooterEdit_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void DrawLockParagraph_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void DrawLockObjectRect_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void DrawEmptyTableLine_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void DrawSpellingLine_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void drawHorLine_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void drawHorLine2_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void drawVerLine_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void drawHorLineExt_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void rect_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void TableRect_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void AddClipRect_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void RemoveClipRect_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void SetClip_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void RemoveClip_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void drawCollaborativeChanges_w(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void drawMailMergeField_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void drawSearchResult_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void drawFlowAnchor_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void SavePen_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void RestorePen_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void SaveBrush_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void RestoreBrush_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void SavePenBrush_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void RestorePenBrush_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void SaveGrState_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void RestoreGrState_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void StartClipPath_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void EndClipPath_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void StartCheckTableDraw_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void EndCheckTableDraw_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void SetTextClipRect_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void AddSmartRect_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void CheckUseFonts2_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void UncheckUseFonts2_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void Drawing_StartCheckBounds_w(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void Drawing_EndCheckBounds_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void DrawPresentationComment_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void DrawPolygon_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
void DrawFootnoteRect_w (const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
|
||||
void m_oContext_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_dWidthMM_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_dHeightMM_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_lWidthPix_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_lHeightPix_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_dDpiX_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_dDpiY_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_bIsBreak_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_oPen_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_bPenColorInit_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_oBrush_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_bBrushColorInit_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_oFontManager_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_oCoordTransform_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_oBaseTransform_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_oTransform_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_oFullTransform_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_oInvertFullTransform_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void ArrayPoints_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_oCurFont_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_oTextPr_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_oGrFonts_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_oLastFont_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void LastFontOriginInfo_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_bIntegerGrid_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void ClipManager_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void TextureFillTransformScaleX_get_w(v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void TextureFillTransformScaleY_get_w(v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void IsThumbnail_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void IsDemonstrationMode_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void GrState_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void globalAlpha_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void TextClipRect_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void IsClipContext_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void IsUseFonts2_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_oFontManager2_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void m_oLastFont2_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void ClearMode_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void IsRetina_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
void dash_no_smart_get_w (v8::Local<v8::String> _name, const v8::PropertyCallbackInfo<v8::Value>& info);
|
||||
|
||||
void m_oContext_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_dWidthMM_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_dHeightMM_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_lWidthPix_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_lHeightPix_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_dDpiX_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_dDpiY_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_bIsBreak_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_oPen_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_bPenColorInit_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_oBrush_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_bBrushColorInit_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_oFontManager_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_oCoordTransform_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_oBaseTransform_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_oTransform_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_oFullTransform_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_oInvertFullTransform_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void ArrayPoints_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_oCurFont_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_oTextPr_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_oGrFonts_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_oLastFont_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void LastFontOriginInfo_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_bIntegerGrid_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void ClipManager_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void TextureFillTransformScaleX_set_w(v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void TextureFillTransformScaleY_set_w(v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void IsThumbnail_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void IsDemonstrationMode_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void GrState_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void globalAlpha_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void TextClipRect_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void IsClipContext_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void IsUseFonts2_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_oFontManager2_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void m_oLastFont2_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void ClearMode_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void IsRetina_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
void dash_no_smart_set_w (v8::Local<v8::String> _name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info);
|
||||
|
||||
v8::Handle<v8::ObjectTemplate> CreateGraphicsTemplate(v8::Isolate* isolate);
|
||||
void CreateGraphics(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
Reference in New Issue
Block a user