0

I am making an app in C# using Mono and I am referencing system.Drawing library which is giving me an error.

Error CS0433 The type 'Color' exists in both 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' and 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

I tried to use

using color2 = Android.Graphics;
using Color1 = System.Drawing;

but The error still exists. this code :

 public static Color1.Bitmap FromDoublesToGrayscal(double[,] doubles)
        {
            var result = new Color1.Bitmap(doubles.GetLength(0), doubles.GetLength(1));
            for (int x = 0; x < result.Width; x++)
                for (int y = 0; y < result.Height; y++)
                {
                    int level = (int)Math.Round(doubles[x, y] * 255);
                    if (level > 255) level = 255; // just to be sure
                    if (level < 0) level = 0; // just to be sure
                    result.SetPixel(x, y, Color1.Color.FromArgb(level, level,level));
                }
            return result;
        }
galal
  • 3
  • 2
  • 3
    don't use System.Drawing in an Android app, use the Android.Graphics namespace – Jason Feb 14 '19 at 21:02
  • What exactly are you trying to achieve here? – FreakyAli Feb 15 '19 at 05:28
  • you could refer to this : https://stackoverflow.com/questions/13511661/create-bitmap-from-double-two-dimentional-array – Leo Zhu Feb 15 '19 at 06:03
  • I want to convert array to bitmap of system.drawing for use it in another function ,the function accept bitmap of system.drawing just. – galal Feb 15 '19 at 06:40
  • I want to covert bitmap of android.Graphics to bitmap Of system.drawing . – galal Feb 15 '19 at 06:43
  • @galal https://social.msdn.microsoft.com/Forums/en-US/daa808be-ae08-43cc-980f-fdddcd9f7981/convert-2d-double-array-to-image?forum=csharplanguage refer this – Leo Zhu Feb 15 '19 at 08:03

0 Answers0