Пример #1
0
    public void BlitWithPalette(FURegion region, int x, int y, Color32[] palette)
    {
        int w = region.width;
        int h = region.height;

        if (x + region.width > this.width - 1)
        {
            w = (this.width - x);
        }

        if (y + region.height > this.height - 1)
        {
            h = (this.height - y);
        }

        for (int i = y; i < y + h; i++)
        {
            for (int j = x; j < x + w; j++)
            {
                if (region.indexedPixels != null)
                {
                    Color32 col = palette[region.indexedPixels[(i - y) * region.width + (j - x)]];
                    this.pixels[i * this.width + j] = col;
                }
            }
        }
    }
Пример #2
0
    public void BlitTransparent(FURegion region, int x, int y, Color32 transparent)
    {
        int w = region.width;
        int h = region.height;

        if (x + region.width > this.width - 1)
        {
            w = (this.width - x);
        }

        if (y + region.height > this.height - 1)
        {
            h = (this.height - y);
        }

        for (int i = y; i < y + h; i++)
        {
            for (int j = x; j < x + w; j++)
            {
                Color32 col = region.pixels[(i - y) * region.width + (j - x)];

                if (col.r != transparent.r || col.g != transparent.g || col.b != transparent.b)
                {
                    this.pixels[i * this.width + j] = col;
                }
            }
        }
    }
Пример #3
0
    public void Blit(FURegion region, int x, int y)
    {
        int w = region.width;
        int h = region.height;

        if (x + region.width > this.width - 1)
        {
            w = (this.width - x);
        }

        if (y + region.height > this.height - 1)
        {
            h = (this.height - y);
        }

        for (int i = y; i < y + h; i++)
        {
            for (int j = x; j < x + w; j++)
            {
                this.pixels[i * this.width + j] = region.pixels[(i - y) * region.width + (j - x)];
            }
        }
    }
Пример #4
0
    public FURegion(FURegion fromRegion, int ul_x, int ul_y, int width, int height)
    {
        this.pixels = new Color32[width * height];
        if (fromRegion.indexedPixels != null)
        {
            this.indexedPixels = new uint[width * height];
        }

        this.width  = width;
        this.height = height;

        for (int i = ul_y; i < ul_y + height; i++)
        {
            for (int j = ul_x; j < ul_x + width; j++)
            {
                this.pixels[(i - ul_y) * this.width + (j - ul_x)] = fromRegion.pixels[i * fromRegion.width + j];
                if (fromRegion.indexedPixels != null)
                {
                    this.indexedPixels[(i - ul_y) * this.width + (j - ul_x)] = fromRegion.indexedPixels[i * fromRegion.width + j];
                }
            }
        }
    }
Пример #5
0
 public void BlitWithPalette(FURegion region, int x, int y)
 {
     this.BlitWithPalette(region, x, y, this.palette);
 }
Пример #6
0
 public void BlitWithPalette( FURegion region, int x, int y )
 {
     this.BlitWithPalette( region, x, y, this.palette );
 }
Пример #7
0
    public void BlitWithPalette( FURegion region, int x, int y, Color32[] palette )
    {
        int w = region.width;
        int h = region.height;

        if( x + region.width > this.width - 1 )
            w = (this.width - x);

        if( y + region.height > this.height - 1 )
            h = (this.height - y);

        for( int i = y; i < y + h; i++ ) {
            for( int j = x; j < x + w; j++ ) {

                if( region.indexedPixels != null ) {
                    Color32 col = palette[ region.indexedPixels[ (i-y) * region.width + (j-x) ] ];
                    this.pixels[ i * this.width + j ] = col;
                }

            }
        }
    }
Пример #8
0
    public void BlitTransparent( FURegion region, int x, int y, Color32 transparent )
    {
        int w = region.width;
        int h = region.height;

        if( x + region.width > this.width - 1 )
            w = (this.width - x);

        if( y + region.height > this.height - 1 )
            h = (this.height - y);

        for( int i = y; i < y + h; i++ ) {
            for( int j = x; j < x + w; j++ ) {
                Color32 col = region.pixels[ (i-y) * region.width + (j-x) ];

                if( col.r != transparent.r || col.g != transparent.g || col.b != transparent.b )
                    this.pixels[ i * this.width + j ] = col;
            }
        }
    }
Пример #9
0
    public void Blit( FURegion region, int x, int y )
    {
        int w = region.width;
        int h = region.height;

        if( x + region.width > this.width - 1 )
            w = (this.width - x);

        if( y + region.height > this.height - 1 )
            h = (this.height - y);

        for( int i = y; i < y + h; i++ ) {
            for( int j = x; j < x + w; j++ ) {
                this.pixels[ i * this.width + j ] = region.pixels[ (i-y) * region.width + (j-x) ];
            }
        }
    }