Update() публичный Метод

public Update ( byte bitmap, int mipMap ) : void
bitmap byte
mipMap int
Результат void
Пример #1
0
 public void Draw()
 {
     if (Width <= 0 || Height <= 0)
     {
         return;
     }
     if (lastRedrawInfo.Item1 != Fill || lastRedrawInfo.Item2 != Width ||
         lastRedrawInfo.Item3 != Height || lastRedrawInfo.Item4 != Color) // redraw
     {
         if (Fill)
         {
             Utils.FillRectangle(cachedTexture, Vector2.Zero, new Vector2(cachedTexture.Width, cachedTexture.Height), Color);
         }
         else
         {
             // top
             Utils.DrawLinearLine(cachedTexture, Vector2.Zero, Color, Width, false);
             // bottom
             Utils.DrawLinearLine(cachedTexture, new Vector2(0, cachedTexture.Height - 1), Color, Width, false);
             // left
             Utils.DrawLinearLine(cachedTexture, Vector2.Zero, Color, Height, true);
             // right
             Utils.DrawLinearLine(cachedTexture, new Vector2(cachedTexture.Width - 1, 0), Color, Height, true);
         }
         lastRedrawInfo = Tuple.Create(Fill, Width, Height, Color);
         cachedTexture.Update();
     }
     DrawTexture(cachedTexture);
 }
Пример #2
0
        public Texture Clone()
        {
            var go = new Texture(Linear, currentRepeatX, currentRepeatY, MipMap)
            {
                Bitmap = Bitmap.ToArray(),
                width  = width, height = height
            };

            go.cleanBitmap = go.Bitmap;
            if (CurrentOpacity != 1f)
            {
                go.SetOpacity(CurrentOpacity);
            }
            else
            {
                go.Update();
            }
            return(go);
        }
Пример #3
0
        /// <summary>
        /// Allow to draw a <see cref="RenderTexture"/> object.
        /// </summary>
        /// <param name="rt">the render texture to draw</param>
        public void DrawRenderTexture(RenderTexture rt)
        {
            /* This is a WORKAROUND to address the issue:
             * https://github.com/aiv01/aiv-fast2d/issues/53
             *
             * It's a workaround because the only way found to avoid the "artifacts" problem
             * is to download from GPU the RenderTexture data and then utilize a temporary
             * Texture to upload data and draw them properly.
             * During this data migration, data need to be flipped, otherwise will be shown upside down
             *
             * In order to avoid to create multiple temporary texture during each Draw pass,
             * we make sure to create just one.
             */
            if (workaroundForRenderTexture == null)
            {
                workaroundForRenderTexture         = new Texture(rt.Width, rt.Height);
                workaroundForRenderTexture.flipped = true;
            }

            byte[] data = rt.Download();
            workaroundForRenderTexture.Update(data);

            DrawTexture(workaroundForRenderTexture);
        }