Example #1
0
        private void RebuildImage(StandardColouredBlock Source)
        {
            Image AcquiredImage;

            StandardColouredBlock.ColouredBlockGummyIndexData IndexData;

            {
                IndexData = new StandardColouredBlock.ColouredBlockGummyIndexData(Source.BlockColor, Source.InnerColor, Source.InnerColor != Source.BlockColor);
                if (!GummyBitmaps.ContainsKey(IndexData))
                {
                    if (Source.DisplayStyle != StandardColouredBlock.BlockStyle.Style_Gummy)
                    {
                        AcquiredImage = GetBevelImage(Source);
                    }
                    else
                    {
                        AcquiredImage = GummyImage.GetGummyImage(Source.BlockColor, Source.InnerColor, new Size(256, 256));
                    }

                    GummyBitmaps.Add(IndexData, AcquiredImage);
                }

                Source.GummyBitmap       = GummyBitmaps[IndexData];
                Source._RotationImagesSK = new SKImage[] { SkiaSharp.Views.Desktop.Extensions.ToSKImage(new Bitmap(Source.GummyBitmap)) };
                Source.CurrentImageHash  = IndexData.GetHashCode();
            }
        }
Example #2
0
 public void Render(IStateOwner pOwner, Graphics pRenderTarget, StandardColouredBlock Source, TetrisBlockDrawParameters Element)
 {
     if (Source.DisplayStyle == StandardColouredBlock.BlockStyle.Style_Custom)
     {
         base.Render(pOwner, pRenderTarget, Source, Element);
     }
     else
     {
         StandardColouredBlock.ColouredBlockGummyIndexData gummydata = new StandardColouredBlock.ColouredBlockGummyIndexData(Source.BlockColor, Source.InnerColor, Source.InnerColor != Source.BlockColor);
         if (Source.CurrentImageHash != gummydata.GetHashCode())
         {
             RebuildImage(Source);
         }
         base.Render(pOwner, pRenderTarget, Source, Element);
     }
 }