コード例 #1
0
        private LinearGradientBrush RefreshTrueColorLinearGradient(uint alpha = 255, bool replace = true)
        {
            if (UseDefaultBackColor)
            {
                return(RefreshTrueColorLinearGradientDefault(alpha, replace));
            }
            LinearGradientBrush ret;
            uint alphaMask = 0x01000000 * alpha;

            SDLMMSharp.SDLMMControl.LinearGradientBrushBuilder br1 = new SDLMMSharp.SDLMMControl.LinearGradientBrushBuilder(new Point(0, SliderRect.Top), new Point(0, SliderRect.Bottom), TrueColor, TrueColor);
            Color  myTrueColor = Color.FromArgb((int)alpha, TrueColor);
            UInt32 shadowColor = alphaMask | (0x888888 & (UInt32)TrueColor.ToArgb());

            br1.AddPosition(0).AddColor(myTrueColor)
            .AddPosition(0.40).AddColor(myTrueColor)
            .AddPosition(1).AddColor(shadowColor);
            ret = br1.Build();
            if (replace)
            {
                if (_TrueColorLinearGradient != null)
                {
                    _TrueColorLinearGradient.Dispose();
                    _TrueColorLinearGradient = null;
                }
                _TrueColorLinearGradient = ret;
            }
            return(ret);
        }
コード例 #2
0
 public Window(string title, TrueColor backgroundColor = new TrueColor()) :
     base(defaultVideoMode, title, Styles.Default, new ContextSettings())
 {
     Text = new Text
     {
         Font          = defaultFont,
         CharacterSize = Configuration.DefaultTextCharacterSize
     };
     this.BackgroundColor = backgroundColor;
     this.SetVisible(true);
 }
コード例 #3
0
        public void DisplayText(string chars, TrueColor color, Vec2 <uint> where)
        {
            Text.DisplayedString = chars;
            Text.FillColor       = color.ConvertToSFMLColorType();

            var textSize = Text.GetLocalBounds();

            Vec2 <uint> middle = new Vec2 <uint>((uint)(textSize.Width / 2), (uint)(textSize.Height / 2));

            Vec2 <uint> adjustedPos = where - middle;

            Text.Position = new Vector2f(adjustedPos.X, adjustedPos.Y);

            Draw(Text);
        }
コード例 #4
0
ファイル: Window.cs プロジェクト: AJLeuer/Chess.NET
 public void setBackgroundColor(TrueColor color)
 {
     this.backgroundColor = color;
 }
コード例 #5
0
        /// <summary>
        /// 生成下装文件
        /// </summary>
        /// <param oldName="pageArrayBin">下装配置文件</param>
        /// <param oldName="serialize">序列化对象</param>
        public void make(ref PageArrayBin pageArrayBin, ref SVSerialize serialize)
        {
            UInt32 pageCount   = pageArrayBin.pageCount;
            UInt32 binaryCount = pageArrayBin.pageArray[pageCount].binaryNum++;

            if (pageArrayBin.pageArray[pageCount].m_binary == null)
            {
                pageArrayBin.pageArray[pageCount].m_binary = new BinaryBin[SVLimit.PAGE_BOOL_MAXNUM];
            }

            BinaryBin binaryBin = pageArrayBin.pageArray[pageCount].m_binary[binaryCount];

            binaryBin.id      = ID;
            binaryBin.rect.sX = (UInt16)Rect.X;
            binaryBin.rect.sY = (UInt16)Rect.Y;
            binaryBin.rect.eX = (UInt16)(Rect.Width + binaryBin.rect.sX);
            binaryBin.rect.eY = (UInt16)(Rect.Height + binaryBin.rect.sY);

            binaryBin.font = (Byte)_font.Size;
            binaryBin.type = _type;

            ///存放字符串相关的属性和文本信息
            if (_type == 0)
            {
                binaryBin.trueClr        = (UInt32)TrueColor.ToArgb();
                binaryBin.trueBgClr      = (UInt32)TrueBgColor.ToArgb();
                binaryBin.falseClr       = (UInt32)FalseColor.ToArgb();
                binaryBin.falseBgClr     = (UInt32)FalseBgColor.ToArgb();
                binaryBin.vinfoInvalid   = (UInt32)ExceptionColor.ToArgb();
                binaryBin.vinfoInvalidBg = (UInt32)ExceptionBgColor.ToArgb();

                binaryBin.trueText = new Byte[SVLimit.BINARY_MAX_LEN];
                if (CustomTrueText != null)
                {
                    copyDestByteArray(Encoding.Unicode.GetBytes(CustomTrueText), binaryBin.trueText);
                }

                binaryBin.falseText = new Byte[SVLimit.BINARY_MAX_LEN];
                if (CustomFlaseText != null)
                {
                    copyDestByteArray(Encoding.Unicode.GetBytes(CustomFlaseText), binaryBin.falseText);
                }
            }
            else ///存放与背景图片有关的信息
            {
                ///为真的图片地址
                var trueAddress = this.TruePicture.bitmap8Data(Rect.Width, Rect.Height);
                if (trueAddress != null)
                {
                    binaryBin.trueClr = (UInt32)serialize.ToArray().Length;
                    serialize.pack(trueAddress);
                }

                ///为假的图片地址
                var falseAddress = this.FlasePicture.bitmap8Data(Rect.Width, Rect.Height);
                if (falseAddress != null)
                {
                    binaryBin.falseClr = (UInt32)serialize.ToArray().Length;
                    serialize.pack(falseAddress);
                }

                ///异常的图片地址
                var exAddress = this.ExPicture.bitmap8Data(Rect.Width, Rect.Height);
                if (exAddress != null)
                {
                    binaryBin.vinfoInvalid = (UInt32)serialize.ToArray().Length;
                    serialize.pack(exAddress);
                }
            }

            ///根据名称来获取地址
            var varInstance = SVVaribleType.instance();

            binaryBin.addrOffset = varInstance.strToAddress(_var.VarName, _var.VarBlockType);
            binaryBin.varType    = (Byte)varInstance.strToType(_var.VarName, _var.VarBlockType);

            pageArrayBin.pageArray[pageCount].m_binary[binaryCount] = binaryBin;
        }
コード例 #6
0
 private void DrawBackgroundOnNoBitmap()
 {
     if (Transforming)
     {
         if (!Checked)
         {
             if (UseGradient)
             {
                 using (LinearGradientBrush br2 = RefreshTrueColorLinearGradient(Math.Min(255, (uint)(255 * Progress)), false))
                 {
                     CurrentRenderTarget.fillRoundRect(SliderRect.X, SliderRect.Y + (BackgroundHeightOffset / 2), SliderRect.Width, BackgroundHeight, BackgroundHeight / 2, FalseColorLinearGradient);
                     CurrentRenderTarget.fillRoundRect(SliderRect.X, SliderRect.Y + (BackgroundHeightOffset / 2), SliderRect.Width, BackgroundHeight, BackgroundHeight / 2, br2);
                 }
             }
             else
             {
                 CurrentRenderTarget.fillRoundRect(SliderRect.X, SliderRect.Y + (BackgroundHeightOffset / 2), SliderRect.Width, BackgroundHeight, BackgroundHeight / 2, FalseColor.ToArgb());
                 CurrentRenderTarget.fillRoundRect(SliderRect.X, SliderRect.Y + (BackgroundHeightOffset / 2), SliderRect.Width, BackgroundHeight, BackgroundHeight / 2, Color.FromArgb((int)(255 * Progress) & 0xff, TrueColor).ToArgb());
             }
         }
         else
         {
             if (UseGradient)
             {
                 using (LinearGradientBrush br2 = RefreshFalseColorLinearGradient(Math.Min(255, (uint)(255 * Progress)), false))
                 {
                     CurrentRenderTarget.fillRoundRect(SliderRect.X, SliderRect.Y + (BackgroundHeightOffset / 2), SliderRect.Width, BackgroundHeight, BackgroundHeight / 2, TrueColorLinearGradient);
                     CurrentRenderTarget.fillRoundRect(SliderRect.X, SliderRect.Y + (BackgroundHeightOffset / 2), SliderRect.Width, BackgroundHeight, BackgroundHeight / 2, br2);
                 }
             }
             else
             {
                 CurrentRenderTarget.fillRoundRect(SliderRect.X, SliderRect.Y + (BackgroundHeightOffset / 2), SliderRect.Width, BackgroundHeight, BackgroundHeight / 2, TrueColor.ToArgb());
                 CurrentRenderTarget.fillRoundRect(SliderRect.X, SliderRect.Y + (BackgroundHeightOffset / 2), SliderRect.Width, BackgroundHeight, BackgroundHeight / 2, Color.FromArgb((int)(255 * Progress) & 0xff, FalseColor).ToArgb());
             }
         }
     }
     else
     {
         if (!Checked)
         {
             if (UseGradient)
             {
                 CurrentRenderTarget.fillRoundRect(SliderRect.X, SliderRect.Y + (BackgroundHeightOffset / 2), SliderRect.Width, BackgroundHeight, BackgroundHeight / 2, FalseColorLinearGradient);
             }
             else
             {
                 CurrentRenderTarget.fillRoundRect(SliderRect.X, SliderRect.Y + (BackgroundHeightOffset / 2), SliderRect.Width, BackgroundHeight, BackgroundHeight / 2, FalseColor.ToArgb());
             }
         }
         else
         {
             if (UseGradient)
             {
                 CurrentRenderTarget.fillRoundRect(SliderRect.X, SliderRect.Y + (BackgroundHeightOffset / 2), SliderRect.Width, BackgroundHeight, BackgroundHeight / 2, TrueColorLinearGradient);
             }
             else
             {
                 CurrentRenderTarget.fillRoundRect(SliderRect.X, SliderRect.Y + (BackgroundHeightOffset / 2), SliderRect.Width, BackgroundHeight, BackgroundHeight / 2, TrueColor.ToArgb());
             }
         }
     }
 }