public void Render(SKImage [] images, ColorLinesNG skiaView, SKCanvas canvas)
        {
            var    destRect = CLReEntity.VirtualToSkiaCoords(this.Verticies, skiaView);
            SKRect?srcRect  = null;

//			if (this.textureCoords != null)
//				srcRect = CLReEntity.VirtualToSkiaCoords(this.Verticies, skiaView, this.textureCoords);

            if (this.Angle != 0.0f)
            {
                canvas.Save();
                canvas.RotateDegrees(this.Angle, destRect.MidX, destRect.MidY);
            }
            if (this.TextureId >= 0)
            {
                if (images[this.TextureId] == null)
                {
                    if (!loadingTextures.Contains(this.TextureId))
                    {
                        loadingTextures.Add(this.TextureId);
                        Task.Run(async() => {
                            images[this.TextureId] = await skiaView.LoadTexture(this.TextureId);
//							loadingTextures.Remove(this.TextureId);
                        });
                    }
                    if (this.Angle != 0.0f)
                    {
                        canvas.Restore();
                    }
                    return;
                }
                if (this.Grayscale)
                {
                    CLReEntity.CanvasDrawImage(canvas, images[this.TextureId], destRect, srcRect, paintGrayscale);
                }
                else if (this.Fill != null)
                {
                    using (texturePaint.ColorFilter = SKColorFilter.CreateBlendMode(CLReEntity.ColorToSKColor((Color)this.Fill), SKBlendMode.Modulate)) {
                        CLReEntity.CanvasDrawImage(canvas, images[this.TextureId], destRect, srcRect, texturePaint);
                    }
                }
                else
                {
                    CLReEntity.CanvasDrawImage(canvas, images[this.TextureId], destRect);
                }
            }
            else
            {
                rectPaint.Color = CLReEntity.ColorToSKColor((Color)this.Fill);
                canvas.DrawRect(destRect, rectPaint);
            }
            if (this.Angle != 0.0f)
            {
                canvas.Restore();
            }
        }
Exemple #2
0
        public void Render()
        {
            CLReEntity r = rentities;

            for (; r != null; r = r.next)
            {
                r.Render();
            }
            this.Clear();
        }
Exemple #3
0
        private void Clear()
        {
            CLReEntity r = rentities;

            while (r != null)
            {
                r         = r.next;
                rentities = null;
                rentities = r;
            }
        }
        private static void ClearEntities()
        {
            CLReEntity next;

            while (rentities != null)
            {
                next           = rentities.Next;
                rentities.Next = null;
                rentities      = next;
            }
        }
Exemple #5
0
        public static void AddToQueue(CLReEntity rentity)
        {
            if (rentities == null)
            {
                rentities = rentity;
                return;
            }
            CLReEntity r = rentities;

            while (r.next != null)
            {
                r = r.next;
            }
            r.next = rentity;
        }
        public void Render(ColorLinesNG skiaView, SKCanvas canvas)
        {
            CLReEntity r = rentities;
            int        renderSpecialBgTexture = 0;

            for (; r != null; r = r.Next)
            {
                r.Render(this.images, skiaView, canvas);
                if (Device.Idiom != TargetIdiom.Desktop ||
                    renderSpecialBgTexture != 0 ||
                    this.specialBgTextureIds == null ||
                    this.specialBgTextureIds.Length < 2)
                {
                    continue;
                }
                if (r.TextureId == this.specialBgTextureIds[0])
                {
                    renderSpecialBgTexture = 1;
                }
                else if (r.TextureId == this.specialBgTextureIds[1])
                {
                    renderSpecialBgTexture = 2;
                }
            }
            if (renderSpecialBgTexture == 1)
            {
                CLReQueue.RenderFadingCircle(canvas, skiaView);
            }
            else if (renderSpecialBgTexture == 2)
            {
                CLReQueue.RenderFades(canvas, skiaView, false);
                CLReQueue.RenderFades(canvas, skiaView, true);
                CLReQueue.RenderFadingCircle(canvas, skiaView);
            }
            CLReViewEntity v = ventities;

            for (; v != null; v = v.Next)
            {
                v.Render(this.mainLayout, skiaView);
            }
            CLReViewEntity vre = ventitiesToRelease;

            for (; vre != null; vre = vre.Next)
            {
                vre.Release(this.mainLayout);
            }
        }
Exemple #7
0
 public CLReEntity(float [] verticies, Color fill, Color border, float [] textureCoords, All type = All.TriangleStrip, int textureId = -1, bool hasTexture = false)
 {
     this.Verticies  = verticies;
     this.Fill       = fill;
     this.Border     = border;
     this.type       = type;
     this.textureId  = textureId;
     this.hasTexture = hasTexture;
     this.next       = null;
     if (textureCoords == null)
     {
         this.textureCoords = defaultTextureCoords;
     }
     else
     {
         this.textureCoords = textureCoords;
     }
 }