Beispiel #1
0
        public void FillRectTexture(int x, int y, Texture2D fillTexture, BitmapDataChannel channels = BitmapDataChannel.ALL)
        {
            byte[]    textureBytes = GetTextureBytes(fillTexture);
            Rectangle rect         = new Rectangle(x, y, fillTexture.width, fillTexture.height);

            FillRectTexture(rect, textureBytes, fillTexture.width, 0, 0, channels);
        }
Beispiel #2
0
 public void copyChannel(BitmapData sourceBitmapData, Rectangle sourceRectangle, Point destination,
     BitmapDataChannel sourceChannel, BitmapDataChannel destinationChannel)
 {
     return;
 }
Beispiel #3
0
 public void perlinNoise(float baseX, float baseY, uint numOctaves, int randomSeed, bool stitch, bool fractalNoise,
     BitmapDataChannel channelOptions)
 {
     return;
 }
Beispiel #4
0
 public void noise(int randomSeed, uint low, uint high, BitmapDataChannel channelOptions)
 {
     return;
 }
Beispiel #5
0
 public void FillRectTexture(Rectangle rect, Texture2D fillTexture, BitmapDataChannel channels = BitmapDataChannel.ALL)
 {
     byte[] textureBytes = GetTextureBytes(fillTexture);
     FillRectTexture(rect, textureBytes, fillTexture.width, 0, 0, channels);
 }
Beispiel #6
0
        public void FillRectTexture(Rectangle rect, byte[] textureBytes, int fillTextureWidth, int textureX, int textureY, BitmapDataChannel channels = BitmapDataChannel.ALL)
        {
            if (rect.x + rect.width > this.width)
            {
                rect.width = this.width - rect.x;
            }
            if (rect.y + rect.height > this.height)
            {
                rect.height = this.height - rect.y;
            }
            if (rect.x < 0)
            {
                rect.width = rect.width + rect.x;
                textureX   = textureX - rect.x;
                rect.x     = 0;
            }
            if (rect.y < 0)
            {
                rect.height = rect.height + rect.y;
                textureY    = textureY - rect.y;
                rect.y      = 0;
            }

            int w = this.width;

            if (rect.x >= 0 && rect.y >= 0 && (rect.x + rect.width <= this.width) && (rect.y + rect.height <= this.height))
            {
                for (int y = 0; y < rect.height; y++)
                {
                    for (int x = 0; x < rect.width; x++)
                    {
                        int  txIndex = (((y + textureY) * fillTextureWidth + (x + textureX))) * 4;
                        byte r       = textureBytes[txIndex + 0];
                        byte g       = textureBytes[txIndex + 1];
                        byte b       = textureBytes[txIndex + 2];
                        byte a       = textureBytes[txIndex + 3];

                        // new
                        int index = ((y + rect.y) * w + (x + rect.x)) * 4;
                        if ((channels & BitmapDataChannel.RED) != 0)
                        {
                            this._data[index + 0] = r;                           //Rnew
                        }
                        if ((channels & BitmapDataChannel.GREEN) != 0)
                        {
                            this._data[index + 1] = g;                           //Gnew
                        }
                        if ((channels & BitmapDataChannel.BLUE) != 0)
                        {
                            this._data[index + 2] = b;                           //Bnew
                        }
                        if ((channels & BitmapDataChannel.ALPHA) != 0)
                        {
                            this._data[index + 3] = a;                           //Anew
                        }
                    }
                }
            }
        }