otitemeditor.SpriteItem.getRGBData C# (CSharp) Method

getRGBData() public method

public getRGBData ( ) : byte[]
return byte[]
        public byte[] getRGBData()
        {
            return spriteList[0].getRGBData();
        }

Same methods

SpriteItem::getRGBData ( int frameIndex ) : byte[]

Usage Example

コード例 #1
0
        private void drawSprite(ref Bitmap canvas, SpriteItem spriteItem)
        {
            Graphics g = Graphics.FromImage(canvas);

            //draw sprite
            for (int frame = 0; frame < spriteItem.frames; frame++)
            {
                for (int cy = 0; cy < spriteItem.height; ++cy)
                {
                    for (int cx = 0; cx < spriteItem.width; ++cx)
                    {
                        int    frameIndex = cx + cy * spriteItem.width + frame * spriteItem.width * spriteItem.height;
                        Bitmap bmp        = ImageUtils.getBitmap(spriteItem.getRGBData(frameIndex), PixelFormat.Format24bppRgb, 32, 32);

                        if (canvas.Width == 32)
                        {
                            g.DrawImage(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
                        }
                        else
                        {
                            g.DrawImage(bmp, new Rectangle(Math.Max(32 - cx * 32, 0), Math.Max(32 - cy * 32, 0), bmp.Width, bmp.Height));
                        }
                    }
                }
            }

            g.Save();
        }
All Usage Examples Of otitemeditor.SpriteItem::getRGBData