Ejemplo n.º 1
0
        private LinearGradientBrush RefreshFalseColorLinearGradient(uint alpha = 255, bool replace = true)
        {
            if (UseDefaultBackColor)
            {
                return(RefreshFalseColorLinearGradientDefault(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), FalseColor, FalseColor);
            UInt32 shadowColor  = alphaMask | (0x888888 & (UInt32)FalseColor.ToArgb());
            Color  myFalseColor = Color.FromArgb((int)alpha, FalseColor);

            br1.AddPosition(0).AddColor(myFalseColor)
            .AddPosition(0.40).AddColor(myFalseColor)
            .AddPosition(1).AddColor(shadowColor);
            ret = br1.Build();
            if (replace)
            {
                if (_FalseColorLinearGradient != null)
                {
                    _FalseColorLinearGradient.Dispose();
                    _FalseColorLinearGradient = null;
                }
                _FalseColorLinearGradient = ret;
            }
            return(ret);
        }
Ejemplo n.º 2
0
        private LinearGradientBrush RefreshFalseColorLinearGradientDefault(uint alpha = 255, bool replace = true)
        {
            LinearGradientBrush ret;

            SDLMMSharp.SDLMMControl.LinearGradientBrushBuilder br1 = new SDLMMSharp.SDLMMControl.LinearGradientBrushBuilder(new Point(0, SliderRect.Top), new Point(0, SliderRect.Bottom), FalseColor, FalseColor);
            uint   alphaMask   = 0x01000000 * alpha;
            UInt32 shadowColor = 0xff000000 | 0xff888888 & (UInt32)FalseColor.ToArgb();

            br1.AddPosition(0).AddColor(0x7c7c7c | alphaMask)
            .AddPosition(0.40).AddColor(0xa0a0a0 | alphaMask)
            .AddPosition(1).AddColor(0xa0a0a0 | alphaMask);
            ret = br1.Build();
            if (replace)
            {
                if (_FalseColorLinearGradient != null)
                {
                    _FalseColorLinearGradient.Dispose();
                    _FalseColorLinearGradient = null;
                }
                _FalseColorLinearGradient = ret;
            }
            return(ret);
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
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());
             }
         }
     }
 }