Exemplo n.º 1
0
 public void PasteBitmap(int X, int Y, RagePixelBitmap bitmap)
 {
     for(int y = Mathf.Max(Y, 0); (y - Y) < bitmap.Height() && y < H; y++)
     {
         for(int x = Mathf.Max(X, 0); (x - X) < bitmap.Width() && x < W; x++)
         {
             pixels[y * W + x] = bitmap.pixels[(y - Y) * bitmap.Width() + (x - X)];
             //SetPixel(x, y, bitmap.GetPixel(x - X, y - Y));
         }
     }
 }
Exemplo n.º 2
0
 public void PasteBitmap(int X, int Y, RagePixelBitmap bitmap)
 {
     for (int y = Mathf.Max(Y, 0); (y - Y) < bitmap.Height() && y < H; y++)
     {
         for (int x = Mathf.Max(X, 0); (x - X) < bitmap.Width() && x < W; x++)
         {
             pixels[y * W + x] = bitmap.pixels[(y - Y) * bitmap.Width() + (x - X)];
             //SetPixel(x, y, bitmap.GetPixel(x - X, y - Y));
         }
     }
 }
Exemplo n.º 3
0
    public void PasteBitmapAlpha(int X, int Y, RagePixelBitmap bitmap)
    {
        for(int y = Mathf.Max(Y, 0); (y - Y) < bitmap.Height() && y < H; y++)
        {
            for(int x = Mathf.Max(X, 0); (x - X) < bitmap.Width() && x < W; x++)
            {
                Color src = bitmap.pixels[(y - Y) * bitmap.Width() + (x - X)];

                pixels[y * W + x] = (1f - src.a) * pixels[y * W + x] + src.a * src;
            }
        }
    }
Exemplo n.º 4
0
    public void PasteBitmapAlpha(int X, int Y, RagePixelBitmap bitmap)
    {
        for (int y = Mathf.Max(Y, 0); (y - Y) < bitmap.Height() && y < H; y++)
        {
            for (int x = Mathf.Max(X, 0); (x - X) < bitmap.Width() && x < W; x++)
            {
                Color src = bitmap.pixels[(y - Y) * bitmap.Width() + (x - X)];

                pixels[y * W + x] = (1f - src.a) * pixels[y * W + x] + src.a * src;
            }
        }
    }
    public void PasteBitmapToSpritesheetAlpha(RagePixelTexel position, Rect spriteUV, RagePixelBitmap bitmap)
    {
        for (int y = Mathf.Max(position.Y, 0); y < position.Y + bitmap.Height() && y < (int)(spriteUV.height * spritesheetTexture.height); y++)
        {
            for (int x = Mathf.Max(position.X, 0); x < position.X + bitmap.Width() && x < (int)(spriteUV.width * spritesheetTexture.width); x++)
            {
                Color src = bitmap.GetPixel(x - position.X, y - position.Y);
                Color trg = spritesheetTexture.GetPixel((int)(spriteUV.x * spritesheetTexture.width) + x, (int)(spriteUV.y * spritesheetTexture.height) + y);

                spritesheetTexture.SetPixel(
                    (int)(spriteUV.x * spritesheetTexture.width) + x,
                    (int)(spriteUV.y * spritesheetTexture.height) + y,
                    src + (1f-src.a) * trg
                    );
            }
        }
    }
 public void PasteBitmapToSpritesheet(RagePixelTexel position, Rect spriteUV, RagePixelBitmap bitmap)
 {
     for (int y = Mathf.Max(position.Y, 0); y < position.Y + bitmap.Height() && y < (int)(spriteUV.height * spritesheetTexture.height); y++)
     {
         for (int x = Mathf.Max(position.X, 0); x < position.X + bitmap.Width() && x < (int)(spriteUV.width * spritesheetTexture.width); x++)
         {
             spritesheetTexture.SetPixel(
                 (int)(spriteUV.x * spritesheetTexture.width) + x,
                 (int)(spriteUV.y * spritesheetTexture.height) + y,
                 bitmap.GetPixel(x - position.X, y - position.Y)
                 );
         }
     }
 }