Beispiel #1
0
 /// <summary>
 /// liefert das Bitmap
 /// </summary>
 /// <param name="b4Day">für Tag oder Nacht</param>
 /// <returns></returns>
 public Bitmap AsBitmap(bool b4Day)
 {
     if (b4Day && XBitmapDay != null)
     {
         PixMap tmp = new PixMap(XBitmapDay);
         if (tmp.Colors > 0)
         {
             tmp.InvertBits();
         }
         return(tmp.AsBitmap());
     }
     if (!b4Day && XBitmapNight != null)
     {
         PixMap tmp = new PixMap(XBitmapNight);
         if (tmp.Colors > 0)
         {
             tmp.InvertBits();
         }
         return(tmp.AsBitmap());
     }
     return(null);
 }
Beispiel #2
0
        /// <summary>
        /// liefert das Bitmap (falls vorhanden)
        /// </summary>
        /// <param name="b4Day">für Tag oder Nacht</param>
        /// <param name="bExt">auch "bitmaplose" Linie als Bitmap 32 x n</param>
        /// <returns></returns>
        public override Bitmap AsBitmap(bool b4Day, bool bExt)
        {
            Bitmap bm = null;

            if (WithDayBitmap)
            {
                PixMap tmp = new PixMap(XBitmapDay);
                // Das Bitmap hat bisher nur eine Dummyfarbe. Jetzt müßen noch die richtigen Farben gesetzt werden.
                if (b4Day)
                {
                    switch (Polylinetype)
                    {
                    case PolylineType.Day2:
                    case PolylineType.Day2_Night2:
                    case PolylineType.NoBorder_Day2_Night1:
                        tmp.SetNewColors(colDayColor);
                        break;

                    case PolylineType.Day1_Night2:
                    case PolylineType.NoBorder_Day1:
                    case PolylineType.NoBorder_Day1_Night1:
                        tmp.SetNewColor(0, colDayColor[0]);
                        break;
                    }
                }
                else
                {
                    switch (Polylinetype)
                    {
                    case PolylineType.Day2:
                    case PolylineType.NoBorder_Day1:
                        tmp = null;
                        break;

                    case PolylineType.Day1_Night2:
                    case PolylineType.Day2_Night2:
                        tmp.SetNewColors(colNightColor);
                        break;

                    case PolylineType.NoBorder_Day2_Night1:
                    case PolylineType.NoBorder_Day1_Night1:
                        tmp.SetNewColor(0, colNightColor[0]);
                        break;
                    }
                }
                if (tmp != null)
                {
                    bm = tmp.AsBitmap();
                }
            }
            else
            {
                if (bExt)
                {
                    bm = new Bitmap(32, (int)(InnerWidth + 2 * BorderWidth));
                    for (int y = 0; y < bm.Height; y++)
                    {
                        bool  bBorder = y < BorderWidth || y >= (InnerWidth + BorderWidth);
                        Color col;
                        if (b4Day)
                        {
                            col = bBorder ? colDayColor[1] : colDayColor[0];
                        }
                        else
                        {
                            col = bBorder ? colNightColor[1] : colNightColor[0];
                        }
                        for (int x = 0; x < bm.Width; x++)
                        {
                            bm.SetPixel(x, y, col);
                        }
                    }
                }
            }
            return(bm);
        }