Пример #1
0
        private PixMap GetDummyXPixMap(BitmapColorMode bcm, bool b4Day, PixMap old)
        {
            if (old != null)
            {
                if (old.Colormode != bcm)
                {
                    switch (old.Colormode)
                    {
                    case BitmapColorMode.POLY1TR:
                        old.ChangeColorMode(BitmapColorMode.POLY2);
                        old.InvertBits();
                        old.SetNewColors(new Color[] { old.GetColor(0), Color.White });     // 2. Farbe einfach Weiß
                        break;

                    case BitmapColorMode.POLY2:
                        old.ChangeColorMode(BitmapColorMode.POLY1TR);
                        old.InvertBits();
                        old.SetNewColors(new Color[] { old.GetColor(0) });
                        break;
                    }
                }
                return(old);
            }

            PixMap pic = new PixMap(32, 32, 2, bcm);

            if (b4Day)
            {
                pic.SetNewColor(0, DayColor1);
                if (bcm == BitmapColorMode.POLY2)
                {
                    pic.SetNewColor(1, DayColor2);
                }
            }
            else
            {
                pic.SetNewColor(0, NightColor1);
                if (bcm == BitmapColorMode.POLY2)
                {
                    pic.SetNewColor(1, NightColor2);
                }
            }
            return(pic);
        }
Пример #2
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);
 }