Beispiel #1
0
        public void Write(BinaryReaderWriter bw, int iCodepage)
        {
            bw.Write(Options);
            XBitmapDay.WriteAsPoi(bw);
            if (WithNightXpm)
            {
                XBitmapNight.WriteAsPoi(bw);
            }
            if (WithString)
            {
                Text.Write(bw, iCodepage);
            }
            if (WithExtendedOptions)
            {
                bw.Write(ExtOptions);
                switch (FontColType)
                {
                case FontColours.Day:
                    BinaryColor.WriteColor(bw, colFontColour[0]);
                    break;

                case FontColours.Night:
                    BinaryColor.WriteColor(bw, colFontColour[1]);
                    break;

                case FontColours.DayAndNight:
                    BinaryColor.WriteColorTable(bw, colFontColour);
                    break;
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// liefert das Bitmap (falls vorhanden)
 /// </summary>
 /// <param name="b4Day">für Tag oder Nacht</param>
 /// <param name="bExt">auch "bitmaplose" Polygone als Bitmap 32 x 32</param>
 /// <returns></returns>
 public override Bitmap AsBitmap(bool b4Day, bool bExt)
 {
     if (b4Day)
     {
         if (XBitmapDay != null)
         {
             return(XBitmapDay.AsBitmap());
         }
         else
         {
             return(GetDummyXPixMap(BitmapColorMode.POLY1TR, true, null).AsBitmap());
         };
     }
     else
     {
         if (XBitmapNight != null)
         {
             return(XBitmapNight.AsBitmap());
         }
         else
         {
             return(GetDummyXPixMap(BitmapColorMode.POLY1TR, false, null).AsBitmap());
         };
     }
 }
Beispiel #3
0
        /// <summary>
        /// vertauscht (wenn möglich) die Farben bzw. die Transparenz
        /// </summary>
        /// <param name="b4Day"></param>
        public void SwapColors(bool b4Day)
        {
            Color tmp;

            if (b4Day)
            {
                switch (Colortype)
                {
                case Polygone.ColorType.Day1:
                case Polygone.ColorType.Day1_Night1:
                    break;

                case Polygone.ColorType.BM_Day1:
                case Polygone.ColorType.BM_Day1_Night2:
                case Polygone.ColorType.BM_Day1_Night1:
                    XBitmapDay.InvertBits();
                    break;

                case Polygone.ColorType.BM_Day2_Night1:
                case Polygone.ColorType.BM_Day2:
                case Polygone.ColorType.BM_Day2_Night2:
                    tmp       = DayColor1;
                    DayColor1 = DayColor2;
                    DayColor2 = tmp;
                    break;
                }
            }
            else
            {
                switch (Colortype)
                {
                case Polygone.ColorType.Day1:
                case Polygone.ColorType.BM_Day1:
                case Polygone.ColorType.BM_Day2:
                case Polygone.ColorType.Day1_Night1:
                    break;

                case Polygone.ColorType.BM_Day1_Night1:
                case Polygone.ColorType.BM_Day2_Night1:
                    XBitmapNight.InvertBits();
                    break;

                case Polygone.ColorType.BM_Day1_Night2:
                case Polygone.ColorType.BM_Day2_Night2:
                    tmp       = DayColor1;
                    DayColor1 = DayColor2;
                    DayColor2 = tmp;
                    break;
                }
            }
        }
Beispiel #4
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Polyline=[Typ=0x");
            sb.Append(Type.ToString("x2"));
            if (Type >= 0x100)
            {
                sb.Append(Subtype.ToString("x2"));
            }
            sb.Append(" " + Polylinetype.ToString() + " ");
            switch (Polylinetype)
            {
            case PolylineType.Day2:
                sb.Append(colDayColor[0].ToString());
                sb.Append(" " + colDayColor[1].ToString());
                break;

            case PolylineType.Day2_Night2:
                sb.Append(colDayColor[0].ToString());
                sb.Append(" " + colDayColor[1].ToString());
                sb.Append(" " + colNightColor[0].ToString());
                sb.Append(" " + colNightColor[1].ToString());
                break;

            case PolylineType.Day1_Night2:
                sb.Append(colDayColor[0].ToString());
                sb.Append(" " + colNightColor[0].ToString());
                sb.Append(" " + colNightColor[1].ToString());
                break;

            case PolylineType.NoBorder_Day2_Night1:
                sb.Append(colDayColor[0].ToString());
                sb.Append(" " + colDayColor[1].ToString());
                sb.Append(" " + colNightColor[0].ToString());
                break;

            case PolylineType.NoBorder_Day1:
                sb.Append(colDayColor[0].ToString());
                break;

            case PolylineType.NoBorder_Day1_Night1:
                sb.Append(colDayColor[0].ToString());
                sb.Append(" " + colNightColor[0].ToString());
                break;
            }
            if (BitmapHeight > 0)
            {
                sb.Append(" " + XBitmapDay.ToString());
            }
            if (InnerWidth > 0)
            {
                sb.Append(" Width=" + InnerWidth.ToString());
                if (BorderWidth > 0)
                {
                    sb.Append(" Border=" + BorderWidth.ToString());
                }
            }
            if (FontType != Fontdata.Default)
            {
                sb.Append(" Fonttyp=[" + FontType.ToString() + "]");
            }
            if (FontColType != FontColours.No)
            {
                sb.Append(" CustomColours=[");
                switch (FontColType)
                {
                case FontColours.Day:
                    sb.Append("Day=" + colFontColour[0].ToString());
                    break;

                case FontColours.Night:
                    sb.Append("Night=" + colFontColour[1].ToString());
                    break;

                case FontColours.DayAndNight:
                    sb.Append("Day=" + colFontColour[0].ToString());
                    sb.Append(" Night=" + colFontColour[0].ToString());
                    break;
                }
                sb.Append("]");
            }
            if (WithString)
            {
                sb.Append(" " + Text.ToString());
            }
            sb.Append(" ]");
            return(sb.ToString());
        }
Beispiel #5
0
        public void Write(BinaryReaderWriter bw, int iCodepage)
        {
            bw.Write(Options);
            bw.Write(Options2);
            switch (Polylinetype)
            {
            case PolylineType.Day2:
                BinaryColor.WriteColorTable(bw, colDayColor);
                break;

            case PolylineType.Day2_Night2:
                BinaryColor.WriteColorTable(bw, colDayColor);
                BinaryColor.WriteColorTable(bw, colNightColor);
                break;

            case PolylineType.Day1_Night2:
                BinaryColor.WriteColor(bw, colDayColor[0]);
                BinaryColor.WriteColorTable(bw, colNightColor);
                break;

            case PolylineType.NoBorder_Day2_Night1:
                BinaryColor.WriteColorTable(bw, colDayColor);
                BinaryColor.WriteColor(bw, colNightColor[0]);
                break;

            case PolylineType.NoBorder_Day1:
                BinaryColor.WriteColor(bw, colDayColor[0]);
                break;

            case PolylineType.NoBorder_Day1_Night1:
                BinaryColor.WriteColor(bw, colDayColor[0]);
                BinaryColor.WriteColor(bw, colNightColor[0]);
                break;
            }

            if (BitmapHeight == 0) // Linien- und Randbreite ermitteln
            {
                switch (Polylinetype)
                {
                case PolylineType.Day2:
                case PolylineType.Day2_Night2:
                case PolylineType.Day1_Night2:
                    bw.Write((byte)InnerWidth);
                    if (InnerWidth > 0)
                    {
                        bw.Write((byte)(2 * BorderWidth + InnerWidth));
                    }
                    break;

                case PolylineType.NoBorder_Day2_Night1:
                case PolylineType.NoBorder_Day1:
                case PolylineType.NoBorder_Day1_Night1:
                    bw.Write((byte)InnerWidth);
                    break;
                }
            }
            else
            {
                XBitmapDay.WriteRawdata(bw);
            }

            if (WithString)
            {
                Text.Write(bw, iCodepage);
            }

            if (WithExtendedOptions)   // es folgen weitere (max. 2) Farben
            {
                bw.Write(ExtOptions);
                switch (FontColType)
                {
                case FontColours.Day:
                    BinaryColor.WriteColor(bw, colFontColour[0]);
                    break;

                case FontColours.Night:
                    BinaryColor.WriteColor(bw, colFontColour[1]);
                    break;

                case FontColours.DayAndNight:
                    BinaryColor.WriteColorTable(bw, colFontColour);
                    break;
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// vertauscht (wenn möglich) die Farben
        /// </summary>
        /// <param name="b4Day"></param>
        public void SwapColors(bool b4Day)
        {
            Color tmp;

            if (WithDayBitmap)      // durch Bitmap definiert
            {
                if (b4Day)
                {
                    switch (Polylinetype)
                    {
                    case PolylineType.Day2:
                    case PolylineType.Day2_Night2:
                    case PolylineType.NoBorder_Day2_Night1:
                        tmp       = DayColor1;
                        DayColor1 = DayColor2;
                        DayColor2 = tmp;
                        break;

                    case PolylineType.Day1_Night2:
                    case PolylineType.NoBorder_Day1:
                    case PolylineType.NoBorder_Day1_Night1:
                        XBitmapDay.InvertBits();            // wegen Transparenz
                        break;
                    }
                }
                else
                {
                    switch (Polylinetype)
                    {
                    case PolylineType.Day1_Night2:
                    case PolylineType.Day2_Night2:
                        tmp         = NightColor1;
                        NightColor1 = NightColor2;
                        NightColor2 = tmp;
                        break;

                    case PolylineType.NoBorder_Day1_Night1:
                    case PolylineType.NoBorder_Day2_Night1:
                        XBitmapDay.InvertBits();
                        break;
                    }
                }
            }
            else                 // kein Bitmap
            {
                if (b4Day)
                {
                    switch (Polylinetype)
                    {
                    case PolylineType.Day2:
                    case PolylineType.Day2_Night2:
                    case PolylineType.NoBorder_Day2_Night1:    // eigentlich nicht möglich (?)
                        tmp       = DayColor1;
                        DayColor1 = DayColor2;
                        DayColor2 = tmp;
                        break;
                    }
                }
                else
                {
                    switch (Polylinetype)
                    {
                    case PolylineType.Day1_Night2:
                    case PolylineType.Day2_Night2:
                        tmp         = NightColor1;
                        NightColor1 = NightColor2;
                        NightColor2 = tmp;
                        break;
                    }
                }
            }
        }
Beispiel #7
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Polygone=[Typ=0x");
            sb.Append(Type.ToString("x2"));
            if (Type >= 0x100)
            {
                sb.Append(Subtype.ToString("x2"));
            }
            sb.Append(" " + Colortype.ToString() + " ");
            switch (Colortype)
            {
            case ColorType.Day1:
                sb.Append(colDayColor.ToString());
                break;

            case ColorType.Day1_Night1:
                sb.Append(colDayColor.ToString());
                sb.Append(colNightColor.ToString());
                break;

            case ColorType.BM_Day1_Night1:
                sb.Append(colDayColor[0].ToString());
                sb.Append(colNightColor[0].ToString());
                sb.Append(XBitmapDay.ToString());
                break;

            case ColorType.BM_Day1_Night2:
                sb.Append(colDayColor[0].ToString());
                sb.Append(colNightColor[0].ToString());
                sb.Append(colNightColor[1].ToString());
                sb.Append(XBitmapDay.ToString());
                break;

            case ColorType.BM_Day2_Night2:
                sb.Append(colDayColor[0].ToString());
                sb.Append(colDayColor[1].ToString());
                sb.Append(colNightColor[0].ToString());
                sb.Append(colNightColor[1].ToString());
                sb.Append(XBitmapDay.ToString());
                break;

            case ColorType.BM_Day2:
                sb.Append(colDayColor[0].ToString());
                sb.Append(colDayColor[1].ToString());
                sb.Append(XBitmapDay.ToString());
                break;

            case ColorType.BM_Day2_Night1:
                sb.Append(colDayColor[0].ToString());
                sb.Append(colDayColor[1].ToString());
                sb.Append(colNightColor[0].ToString());
                sb.Append(XBitmapDay.ToString());
                break;

            case ColorType.BM_Day1:
                sb.Append(colDayColor[0].ToString());
                sb.Append(XBitmapDay.ToString());
                break;
            }
            if (WithExtendedOptions)
            {
                sb.Append(" Options=[" + FontType.ToString() + "|" + FontColType.ToString() + "]");
            }
            if (WithString)
            {
                sb.Append(" " + Text.ToString());
            }
            sb.Append(" ]");
            return(sb.ToString());
        }
Beispiel #8
0
        public void Write(BinaryReaderWriter bw, int iCodepage)
        {
            bw.Write(Options);

            switch (Colortype)
            {
            case ColorType.Day1:
                BinaryColor.WriteColor(bw, colDayColor[0]);
                break;

            case ColorType.Day1_Night1:
                BinaryColor.WriteColor(bw, colDayColor[0]);
                BinaryColor.WriteColor(bw, colNightColor[0]);
                break;

            case ColorType.BM_Day2:
                XBitmapDay.WriteColorTable(bw);
                XBitmapDay.WriteRawdata(bw);
                break;

            case ColorType.BM_Day2_Night2:
                BinaryColor.WriteColorTable(bw, colDayColor);
                BinaryColor.WriteColorTable(bw, colNightColor);
                XBitmapDay.WriteRawdata(bw);
                break;

            case ColorType.BM_Day1_Night2:
                BinaryColor.WriteColor(bw, colDayColor[0]);
                BinaryColor.WriteColorTable(bw, colNightColor);
                XBitmapDay.WriteRawdata(bw);
                break;

            case ColorType.BM_Day2_Night1:
                BinaryColor.WriteColorTable(bw, colDayColor);
                BinaryColor.WriteColor(bw, colNightColor[0]);
                XBitmapDay.WriteRawdata(bw);
                break;

            case ColorType.BM_Day1:
                BinaryColor.WriteColor(bw, colDayColor[0]);
                XBitmapDay.WriteRawdata(bw);
                break;

            case ColorType.BM_Day1_Night1:
                BinaryColor.WriteColor(bw, colDayColor[0]);
                BinaryColor.WriteColor(bw, colNightColor[0]);
                XBitmapDay.WriteRawdata(bw);
                break;
            }
            if (WithString)
            {
                Text.Write(bw, iCodepage);
            }
            if (WithExtendedOptions)   // es folgen weitere (max. 2) Farben
            {
                bw.Write(ExtOptions);
                switch (FontColType)
                {
                case FontColours.Day:
                    BinaryColor.WriteColor(bw, colFontColour[0]);
                    break;

                case FontColours.Night:
                    BinaryColor.WriteColor(bw, colFontColour[1]);
                    break;

                case FontColours.DayAndNight:
                    BinaryColor.WriteColorTable(bw, colFontColour);
                    break;
                }
            }
        }