Example #1
0
        public static IMAGE ToImageSharp(this Bitmap image)
        {
            var dst = new IMAGE(image.Width, image.Height);

            for (int y = 0; y < dst.Height; ++y)
            {
                for (int x = 0; x < dst.Width; ++x)
                {
                    dst[x, y] = new SixLabors.ImageSharp.Rgba32(image[x, y]);
                }
            }

            return(dst);
        }
Example #2
0
        public static SixLabors.ImageSharp.Rgba32 GetColor(int paran)
        {
            SixLabors.ImageSharp.Rgba32 result = SixLabors.ImageSharp.Rgba32.Black;

            SixLabors.ImageSharp.Rgba32 a = SixLabors.ImageSharp.Rgba32.Black;

            var mst = from c in a.GetType().GetFields()
                      where c.FieldType == typeof(SixLabors.ImageSharp.Rgba32)
                      select c;

            var b = (SixLabors.ImageSharp.Rgba32) typeof(SixLabors.ImageSharp.Rgba32).InvokeMember(
                mst.ToArray()[paran].Name,
                BindingFlags.GetField, null, null, new object[] { });

            result = b;

            return(result);
        }
Example #3
0
        public static Color FromHex(string hex)
        {
            Rgba32 rgba = Rgba32.FromHex(hex);

            return(new Color(rgba));
        }
Example #4
0
 private static bool IsBlack(this Rgba32 rgba)
 {
     return(rgba.R == 0 && rgba.G == 0 && rgba.B == 0);
 }
Example #5
0
        public static Color ParseHex(string hex)
        {
            var rgba = Rgba32.ParseHex(hex);

            return(new Color(rgba));
        }