Color tC;
Bitmap tBitmap ;
tBitmap = new Bitmap(100,100);
BitmapDrawLine(tBitmap, new Point(49,49), new Point(51,51), Color.Gold, 3.0);
tC =tBitmap.GetPixel(50, 50);
// right
if (tC.ToArgb() == Color.Gold.ToArgb()){
Console.Out.WriteLine("Find Gold");
// if( tC.Equals( Color.Gold) ){;}
// This will not work
//but currently don't know why
}
public void BitmapDrawLine(Bitmap bM, Point sPoint, Point ePoint, Color lineColor,float lineThickness)
{
Graphics g = Graphics.FromImage(bM);
Pen myPen = new Pen(lineColor, lineThickness);
myPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
myPen.SetLineCap(System.Drawing.Drawing2D.LineCap.Round, System.Drawing.Drawing2D.LineCap.Round, System.Drawing.Drawing2D.DashCap.Round);
g.DrawLine(myPen, sPoint, ePoint);
}
Comments