示例#1
0
 public void SetProperty(TransferCanvasProperty transferCanvasProperty)
 {
     if (_JsInteropExecutionMode == 0)
     {
         string key   = canvasID + transferCanvasProperty.propertyName;
         string value = string.Empty;
         if (PropertiesDictionary.TryGetValue(canvasID + transferCanvasProperty.propertyName, out value))
         {
             if (!value.Equals(transferCanvasProperty.propertyValue, StringComparison.InvariantCultureIgnoreCase))
             {
                 PropertiesDictionary[key] = transferCanvasProperty.propertyValue;
                 BCCCJsInterop.Set_Property(canvasID, transferCanvasProperty);
             }
         }
         else
         {
             PropertiesDictionary.Add(key, transferCanvasProperty.propertyValue);
             BCCCJsInterop.Set_Property(canvasID, transferCanvasProperty);
         }
     }
     else
     {
         SB_Append("ctx1[\"" + transferCanvasProperty.propertyName + "\"] = \"" + transferCanvasProperty.propertyValue + "\";");
     }
 }
示例#2
0
 public void Rotate(float angle)
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Rotate(canvasID, angle);
     }
     else
     {
         SB_Append("ctx1.rotate(" + angle + ");");
     }
 }
示例#3
0
 public void Fill()
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Fill(canvasID);
     }
     else
     {
         SB_Append("ctx1.fill();");
     }
 }
示例#4
0
 public void Stroke()
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Stroke(canvasID);
     }
     else
     {
         SB_Append("ctx1.stroke();");
     }
 }
示例#5
0
 public void Begin_Path()
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Begin_Path(canvasID);
     }
     else
     {
         SB_Append("ctx1.beginPath();");
     }
 }
示例#6
0
 public void Fill_Text(TransferFillTextParameters transferFillTextParameters)
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Fill_Text(canvasID, transferFillTextParameters);
     }
     else
     {
         SB_Append("ctx1.fillText(\"" + transferFillTextParameters.text + "\"," + transferFillTextParameters.x + "," + transferFillTextParameters.y + ");");
     }
 }
示例#7
0
 public void SaveState()
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Save_State(canvasID);
     }
     else
     {
         SB_Append("ctx1.saveState();");
     }
 }
示例#8
0
 public void Translate(float x, float y)
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Translate(canvasID, x, y);
     }
     else
     {
         SB_Append("ctx1.translate(" + x + ", " + y + ");");
     }
 }
示例#9
0
 public void SetTransform()
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Set_Transform(canvasID);
     }
     else
     {
         SB_Append(" ctx1.setTransform(1, 0, 0, 1, 0, 0);");
     }
 }
示例#10
0
 public void Move_To(float x, float y)
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Move_To(canvasID, x, y);
     }
     else
     {
         SB_Append("ctx1.moveTo(\"" + x + "\", \"" + y + "\");");
     }
 }
示例#11
0
 public void RestoreState()
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Restore_State(canvasID);
     }
     else
     {
         SB_Append("ctx1.restoreState();");
     }
 }
示例#12
0
 public void GradientAddColorStop(double stop, string color)
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Gradient_Add_Color_Stop((float)stop, color);
     }
     else
     {
         SB_Append(" grad.addColorStop(" + stop + ", \"" + color + "\");");
     }
 }
示例#13
0
 public void RenderToUI()
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Render_To_UI(canvasID);
     }
     else
     {
         SB_Append("ctx(\"" + canvasID + "\", true).drawImage(ctx1.canvas, 0, 0);");
     }
 }
示例#14
0
 public void ClearCanvas()
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Clear_Canvas(canvasID);
     }
     else
     {
         SB_Append(" ctx1.setTransform(1, 0, 0, 1, 0, 0);");
         SB_Append(" ctx1.clearRect(0, 0, ctx1.canvas.clientWidth, ctx1.canvas.clientHeight);");
     }
 }
示例#15
0
 public void DrawFullSizeRect(string color)
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Draw_Full_Size_Rect(canvasID, color);
     }
     else
     {
         SB_Append(" ctx1.beginPath();");
         SB_Append(" ctx1.fillStyle = \"" + color + "\";");
         SB_Append(" ctx1.fillRect(0, 0, ctx1.canvas.clientWidth, ctx1.canvas.clientHeight);");
     }
 }
示例#16
0
 public void Draw_Image(string imgName, TransferImageParameters transferImageParameters)
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Draw_Image(canvasID, imgName, transferImageParameters);
     }
     else
     {
         SB_Append(" ctx1.drawImage(img_Corner_Shape," + transferImageParameters.x + ","
                   + transferImageParameters.y + ","
                   + transferImageParameters.width + ","
                   + transferImageParameters.height + ");");
     }
 }
示例#17
0
 public void StrokeRect(TransferRectParameters transferRectParameters)
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Stroke_Rect(canvasID, transferRectParameters);
     }
     else
     {
         SB_Append("ctx1.strokeRect(" + transferRectParameters.x +
                   "," + transferRectParameters.y +
                   "," + transferRectParameters.w +
                   "," + transferRectParameters.h + ");");
     }
 }
示例#18
0
 public void FillCircle(TransferParameters transferParameters)
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Draw_Circle(canvasID, transferParameters);
     }
     else
     {
         SB_Append(" ctx1.arc(" + transferParameters.x +
                   ", " + transferParameters.y +
                   ", " + transferParameters.r +
                   ", " + transferParameters.sAngle +
                   ", " + transferParameters.eAngle + ");");
     }
 }
示例#19
0
 public void CreateRadialGradient(TransferRadialGradientParameters transferRadialGradientParameters)
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Create_Radial_Gradient(canvasID, transferRadialGradientParameters);
     }
     else
     {
         SB_Append(" grad =  ctx1.createRadialGradient(" + transferRadialGradientParameters.x0 +
                   ", " + transferRadialGradientParameters.y0 +
                   ", " + transferRadialGradientParameters.r0 +
                   ", " + transferRadialGradientParameters.x1 +
                   ", " + transferRadialGradientParameters.y1 +
                   ", " + transferRadialGradientParameters.r1 + ");");
     }
 }
示例#20
0
 public void GradientSetStokeOrFillStyle(bool StrokeOrFill)
 {
     if (_JsInteropExecutionMode == 0)
     {
         BCCCJsInterop.Gradient_Set_Stoke_Or_Fill_Style(canvasID, StrokeOrFill);
     }
     else
     {
         if (StrokeOrFill)
         {
             SB_Append(" ctx1.strokeStyle = grad;");
         }
         else
         {
             SB_Append(" ctx1.fillStyle = grad;");
         }
     }
 }
示例#21
0
        public void FillGauge(string color, TransferParameters transferParameters)
        {
            if (_JsInteropExecutionMode == 0)
            {
                BCCCJsInterop.Draw_Gauge(canvasID, color, transferParameters);
            }
            else
            {
                SB_Append(" var gradient = ctx1.createRadialGradient(0, 0, 0, 0, 0, " + transferParameters.r + ");");
                SB_Append(" gradient.addColorStop(0, 'white');");
                SB_Append(" gradient.addColorStop(1, \"" + color + "\");");

                SB_Append(" ctx1.beginPath();");
                SB_Append(" ctx1.moveTo(0, 0);");
                SB_Append(" ctx1.arc(" + transferParameters.x + ", "
                          + transferParameters.y + ", "
                          + transferParameters.r + ", "
                          + transferParameters.sAngle +
                          ", " + transferParameters.eAngle + ");");
                SB_Append(" ctx1.fillStyle = gradient;");
                SB_Append(" ctx1.closePath();");
                SB_Append(" ctx1.fill();");
            }
        }
 async Task <string> Preload_Image()
 {
     return(await BCCCJsInterop.Preload_Image());
 }
示例#23
0
 public void SB_Execute()
 {
     BCCCJsInterop.Execute_Dynamic_Script(sb.ToString());
     SB_Clear();
 }
示例#24
0
 public void Log_Canvas_Array()
 {
     BCCCJsInterop.Log_Canvas_Array();
 }
示例#25
0
 public void Remove_Canvas()
 {
     BCCCJsInterop.Remove_Canvas(FgCanvasID);
 }
示例#26
0
 public void Add_Canvas()
 {
     BCCCJsInterop.Add_Canvas(FgCanvasID, BgCanvasID, TopCanvasID);
 }