linear gradient is now working.
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Progrart.Core.Graphics
|
||||
public virtual void Render(RenderContext context)
|
||||
{
|
||||
}
|
||||
public virtual void LoadProperties() { }
|
||||
public virtual void LoadProperties(RenderContext context) { }
|
||||
public virtual void SetupProperties(Engine engine) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
}
|
||||
public override void LoadProperties()
|
||||
public override void LoadProperties(RenderContext context)
|
||||
{
|
||||
if (__object is not null)
|
||||
{
|
||||
@@ -54,13 +54,13 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
if (__object.Get("Shader") is JsObject shaderObj)
|
||||
shader = ProgrartConversion.ObtainFromJsObject(shaderObj);
|
||||
shader = ProgrartConversion.ObtainFromJsObject(context,shaderObj);
|
||||
}
|
||||
}
|
||||
public override void Render(RenderContext context)
|
||||
{
|
||||
base.Render(context);
|
||||
LoadProperties();
|
||||
LoadProperties(context);
|
||||
SKPoint pos = context.TranslatePoint(Position);
|
||||
float Size = context.TranslateSize(this.Size);
|
||||
context.DrawingCore.canvas.DrawCircle(
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
}
|
||||
public override void LoadProperties()
|
||||
public override void LoadProperties(RenderContext context)
|
||||
{
|
||||
if (__object is not null)
|
||||
{
|
||||
@@ -61,13 +61,13 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
if (__object.Get("Shader") is JsObject shaderObj)
|
||||
shader = ProgrartConversion.ObtainFromJsObject(shaderObj);
|
||||
shader = ProgrartConversion.ObtainFromJsObject(context, shaderObj);
|
||||
}
|
||||
}
|
||||
public override void Render(RenderContext context)
|
||||
{
|
||||
base.Render(context);
|
||||
LoadProperties();
|
||||
LoadProperties(context);
|
||||
SKPoint FinalStartPos = context.TranslatePoint(Start);
|
||||
SKPoint FinalEndPos = context.TranslatePoint(End);
|
||||
context.canvas.DrawLine(
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
}
|
||||
public override void LoadProperties()
|
||||
public override void LoadProperties(RenderContext context)
|
||||
{
|
||||
if (__object is not null)
|
||||
{
|
||||
@@ -64,13 +64,13 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
if (__object.Get("Shader") is JsObject shaderObj)
|
||||
shader = ProgrartConversion.ObtainFromJsObject(shaderObj);
|
||||
shader = ProgrartConversion.ObtainFromJsObject(context,shaderObj);
|
||||
}
|
||||
}
|
||||
public override void Render(RenderContext context)
|
||||
{
|
||||
base.Render(context);
|
||||
LoadProperties();
|
||||
LoadProperties(context);
|
||||
SKPoint FinalStartPos = context.TranslatePoint(Position);
|
||||
SKPoint FinalEndPos = context.TranslatePoint(Size);
|
||||
context.canvas.DrawOval(
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Progrart.Core.Graphics
|
||||
__object.Set("Color", ProgrartFunctions.color(engine, 1, 1, 1, 1));
|
||||
}
|
||||
}
|
||||
public override void LoadProperties()
|
||||
public override void LoadProperties(RenderContext context)
|
||||
{
|
||||
if (__object is not null)
|
||||
{
|
||||
@@ -33,13 +33,13 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
if (__object.Get("Shader") is JsObject shaderObj)
|
||||
shader = ProgrartConversion.ObtainFromJsObject(shaderObj);
|
||||
shader = ProgrartConversion.ObtainFromJsObject(context, shaderObj);
|
||||
}
|
||||
}
|
||||
public override void Render(RenderContext context)
|
||||
{
|
||||
base.Render(context);
|
||||
LoadProperties();
|
||||
LoadProperties(context);
|
||||
foreach (var item in this.Children)
|
||||
{
|
||||
if (item is Path p)
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
}
|
||||
public override void LoadProperties()
|
||||
public override void LoadProperties(RenderContext context)
|
||||
{
|
||||
if (__object is not null)
|
||||
{
|
||||
@@ -84,7 +84,7 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
if (__object.Get("Shader") is JsObject shaderObj)
|
||||
shader = ProgrartConversion.ObtainFromJsObject(shaderObj);
|
||||
shader = ProgrartConversion.ObtainFromJsObject(context, shaderObj);
|
||||
|
||||
if (__object.Get("Source") is JsString source)
|
||||
this.imgFile = source.AsString();
|
||||
@@ -93,7 +93,7 @@ namespace Progrart.Core.Graphics
|
||||
public override void Render(RenderContext context)
|
||||
{
|
||||
base.Render(context);
|
||||
LoadProperties();
|
||||
LoadProperties(context);
|
||||
SKPoint FinalStartPos = context.TranslatePoint(Start);
|
||||
SKPoint Size = context.TranslatePoint(this.Size);
|
||||
if (imgFile == null) return;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
}
|
||||
public override void LoadProperties()
|
||||
public override void LoadProperties(RenderContext context)
|
||||
{
|
||||
if (__object is not null)
|
||||
{
|
||||
@@ -65,13 +65,13 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
if (__object.Get("Shader") is JsObject shaderObj)
|
||||
shader = ProgrartConversion.ObtainFromJsObject(shaderObj);
|
||||
shader = ProgrartConversion.ObtainFromJsObject(context, shaderObj);
|
||||
}
|
||||
}
|
||||
public override void Render(RenderContext context)
|
||||
{
|
||||
base.Render(context);
|
||||
LoadProperties();
|
||||
LoadProperties(context);
|
||||
SKPoint FinalStartPos = context.TranslatePoint(Start);
|
||||
SKPoint FinalEndPos = context.TranslatePoint(Size);
|
||||
context.canvas.DrawRect(
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Diagnostics;
|
||||
|
||||
namespace Progrart.Core.Graphics
|
||||
{
|
||||
public class RoundRectangle : BaseElement
|
||||
public class RoundRectangle : BaseElement
|
||||
{
|
||||
|
||||
float StrokeWidth;
|
||||
@@ -43,7 +43,7 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
}
|
||||
public override void LoadProperties()
|
||||
public override void LoadProperties(RenderContext context)
|
||||
{
|
||||
if (__object is not null)
|
||||
{
|
||||
@@ -71,15 +71,15 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
if (__object.Get("Shader") is JsObject shaderObj)
|
||||
shader = ProgrartConversion.ObtainFromJsObject(shaderObj);
|
||||
shader = ProgrartConversion.ObtainFromJsObject(context, shaderObj);
|
||||
}
|
||||
}
|
||||
public override void Render(RenderContext context)
|
||||
{
|
||||
base.Render(context);
|
||||
LoadProperties();
|
||||
LoadProperties(context);
|
||||
SKPoint Position = context.TranslatePoint(Start);
|
||||
SKPoint Size = context.TranslatePoint(this.Size);
|
||||
SKPoint Size = context.TranslatePoint(this.Size);
|
||||
float rx = context.TranslateSize(this.rx);
|
||||
float ry = context.TranslateSize(this.ry);
|
||||
Trace.WriteLine($"Draw Rectangle from {Position} to {Size} using {Color} with size of {StrokeWidth}.");
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
}
|
||||
public override void LoadProperties()
|
||||
public override void LoadProperties(RenderContext context)
|
||||
{
|
||||
if (__object is not null)
|
||||
{
|
||||
@@ -61,7 +61,7 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
if (__object.Get("Shader") is JsObject shaderObj)
|
||||
shader = ProgrartConversion.ObtainFromJsObject(shaderObj);
|
||||
shader = ProgrartConversion.ObtainFromJsObject(context, shaderObj);
|
||||
if (__object.Get("Font") is JsString fontObj)
|
||||
fontFamily = fontObj.AsString();
|
||||
}
|
||||
@@ -69,7 +69,7 @@ namespace Progrart.Core.Graphics
|
||||
public override void Render(RenderContext context)
|
||||
{
|
||||
base.Render(context);
|
||||
LoadProperties();
|
||||
LoadProperties(context);
|
||||
SKPoint pos = context.TranslatePoint(Position);
|
||||
float Size = context.TranslateSize(this.Size);
|
||||
SKTextAlign align = alignment.ToLower() switch
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
}
|
||||
public override void LoadProperties()
|
||||
public override void LoadProperties(RenderContext context)
|
||||
{
|
||||
if (__object is not null)
|
||||
{
|
||||
@@ -77,13 +77,13 @@ namespace Progrart.Core.Graphics
|
||||
}
|
||||
|
||||
if (__object.Get("Shader") is JsObject shaderObj)
|
||||
shader = ProgrartConversion.ObtainFromJsObject(shaderObj);
|
||||
shader = ProgrartConversion.ObtainFromJsObject(context, shaderObj);
|
||||
}
|
||||
}
|
||||
public override void Render(RenderContext context)
|
||||
{
|
||||
base.Render(context);
|
||||
LoadProperties();
|
||||
LoadProperties(context);
|
||||
var v0 = context.TranslatePoint(Vertex0);
|
||||
var v1 = context.TranslatePoint(Vertex1);
|
||||
var v2 = context.TranslatePoint(Vertex2);
|
||||
|
||||
@@ -38,9 +38,9 @@ namespace Progrart.Core.Graphics
|
||||
context.canvas.RotateDegrees(-rotate, context.DrawingCore.Width / 2, context.DrawingCore.Height / 2);
|
||||
context.canvas.Translate(-tx, -ty);
|
||||
}
|
||||
public override void LoadProperties()
|
||||
public override void LoadProperties(RenderContext context)
|
||||
{
|
||||
base.LoadProperties();
|
||||
base.LoadProperties(context);
|
||||
if (__object is null) return;
|
||||
{
|
||||
if (__object.Get("Translate") is JsObject translate)
|
||||
@@ -61,7 +61,7 @@ namespace Progrart.Core.Graphics
|
||||
public override void Render(RenderContext context)
|
||||
{
|
||||
base.Render(context);
|
||||
this.LoadProperties();
|
||||
this.LoadProperties(context);
|
||||
Transform(context);
|
||||
foreach (var item in Children)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user