Commit d6beb4d7 authored by Oleg Korshul's avatar Oleg Korshul

watermark: slides

parent 6f0b3862
......@@ -3187,6 +3187,7 @@
this.transparent = 0.3;
this.zoom = 1;
this.calculatezoom = -1;
this.CheckParams = function(api)
{
......@@ -3195,6 +3196,11 @@
this.Generate = function()
{
if (this.zoom == this.calculatezoom)
return;
this.calculatezoom = this.zoom;
var content = this.inputContentSrc;
for (var key in this.replaceMap)
{
......@@ -3238,7 +3244,14 @@
this.StartRenderer = function()
{
this.imageBase64 = this.image.toDataURL("image/png");
var canvasTransparent = document.createElement("canvas");
canvasTransparent.width = this.image.width;
canvasTransparent.height = this.image.height;
var ctx = canvasTransparent.getContext("2d");
ctx.globalAlpha = this.transparent;
ctx.drawImage(this.image, 0, 0);
this.imageBase64 = canvasTransparent.toDataURL("image/png");
canvasTransparent = null;
};
this.EndRenderer = function()
{
......
......@@ -1161,10 +1161,15 @@ function CDrawingDocument()
}
this.ToRendererPart = function()
{
var watermark = this.m_oWordControl.m_oApi.watermarkDraw;
var pagescount = this.SlidesCount;
if (-1 == this.m_lCurrentRendererPage)
{
if (watermark)
watermark.StartRenderer();
this.m_oDocRenderer = new AscCommon.CDocumentRenderer();
this.m_oDocRenderer.VectorMemoryForPrint = new AscCommon.CMemory();
this.m_lCurrentRendererPage = 0;
......@@ -1185,6 +1190,9 @@ function CDrawingDocument()
renderer.BeginPage(this.m_oLogicDocument.Width, this.m_oLogicDocument.Height);
this.m_oLogicDocument.DrawPage(i, renderer);
renderer.EndPage();
if (watermark)
watermark.DrawOnRenderer(renderer, this.m_oLogicDocument.Width, this.m_oLogicDocument.Height);
}
if (end == -1)
......@@ -1197,6 +1205,9 @@ function CDrawingDocument()
if (this.m_lCurrentRendererPage >= pagescount)
{
if (watermark)
watermark.EndRenderer();
this.m_lCurrentRendererPage = -1;
this.m_oDocRenderer = null;
this.m_oWordControl.m_oApi.ShowParaMarks = this.m_bOldShowMarks;
......@@ -5489,6 +5500,9 @@ function CSlideDrawer()
h_px = this.CachedCanvas.height;
outputCtx.drawImage(this.CachedCanvas, 0, 0, w_px, h_px, (_x >> 0) - this.SlideEps, (_y >> 0) - this.SlideEps, w_px, h_px);
if (this.m_oWordControl.m_oApi.watermarkDraw)
this.m_oWordControl.m_oApi.watermarkDraw.Draw(outputCtx, w_px, h_px);
}
else
{
......@@ -5503,6 +5517,9 @@ function CSlideDrawer()
h_px_src = this.CachedCanvas.height;
outputCtx.drawImage(this.CachedCanvas, 0, 0, w_px_src, h_px_src, (_x >> 0) - this.SlideEps, (_y >> 0) - this.SlideEps, w_px, h_px);
if (this.m_oWordControl.m_oApi.watermarkDraw)
this.m_oWordControl.m_oApi.watermarkDraw.Draw(outputCtx, w_px, h_px);
}
}
else
......@@ -5531,6 +5548,9 @@ function CSlideDrawer()
g.IsNoDrawingEmptyPlaceholderText = true;
this.m_oWordControl.m_oLogicDocument.DrawPage(slideNum, g);
if (this.m_oWordControl.m_oApi.watermarkDraw)
this.m_oWordControl.m_oApi.watermarkDraw.Draw(outputCtx, w_px, h_px);
}
}
}
......
......@@ -3145,6 +3145,12 @@ function CEditorPage(api)
if (this.MobileTouchManager)
this.MobileTouchManager.Resize();
if (this.m_oApi.watermarkDraw)
{
this.m_oApi.watermarkDraw.zoom = this.m_nZoomValue / 100;
this.m_oApi.watermarkDraw.Generate();
}
};
this.CheckCalculateDocumentSize = function(_bounds)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment