using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;

namespace bbiwarg.DataSource
{
    class ColorImage
    {
        private int width, height;
        private byte[] data;

        public ColorImage(int width, int height, byte[] data)
        {
            this.width = width;
            this.height = height;
            this.data = data;
        }

        public int getWidth()
        {
            return width;
        }

        public int getHeight()
        {
            return height;
        }

        public Color getColor(int x, int y)
        {
            int offset = 4 * (y * width + x);
            byte alpha = data[offset + 3];
            byte red = data[offset + 2];
            byte green = data[offset + 1];
            byte blue = data[offset + 0];

            return Color.FromArgb(alpha, red, green, blue);
        }
    }
}