Beispiel #1
0
        public float getValue(Vector3 cubeWorldPosition)
        {
            this.frequency   = 0.5f;
            this.lacunarity  = 2;
            this.offset      = 1;
            this.gain        = 2;
            this.exponent    = 1f;
            this.octaveCount = 4f;

            this.gradient  = GradientColors.Grayscale;
            this.quality   = PrimitiveModule.DefaultQuality;
            this.primitive = NoisePrimitive.ImprovedPerlin;
            this.filter    = NoiseFilter.MultiFractal;

            this.pModule = new ImprovedPerlin();

            this.pModule.Quality = quality;
            this.pModule.Seed    = seed;

            this.fModule = new MultiFractal();

            this.scale = new ScaleBias(fModule, 1f, -0.8f);

            this.fModule.Frequency   = frequency;
            this.fModule.Lacunarity  = lacunarity;
            this.fModule.OctaveCount = octaveCount;
            this.fModule.Offset      = offset;
            this.fModule.Gain        = gain;
            this.fModule.Primitive3D = (IModule3D)pModule;

            this.finalModule = scale;

            return(this.finalModule.GetValue(cubeWorldPosition.X, cubeWorldPosition.Y, cubeWorldPosition.Z));
        }
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("BackColor", BackColor.ToArgb().ToString());
            info.AddValue("Clip", Clip);
            info.AddValue("GradientMode", Convert.ToInt32(GradientMode).ToString());
            info.AddValue("GradientColor", GradientColor.ToArgb().ToString());
            info.AddValue("DrawGradient", DrawGradient);
            info.AddValue("DrawBorder", DrawBorder);
            info.AddValue("DrawBackground", DrawBackground);
            info.AddValue("Location", Serialize.AddPointF(Location));
            info.AddValue("InternalRectangle", Serialize.AddRectangleF(InternalRectangle));

            if (Label != null)
            {
                info.AddValue("Label", Label);
            }
            if (Image != null)
            {
                info.AddValue("Image", Image);
            }
            if (StencilItem != null)
            {
                info.AddValue("StencilItem", StencilItem);
            }
            if (Rotation != 0)
            {
                info.AddValue("Rotation", Rotation);
            }

            base.GetObjectData(info, context);
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            int      w = this.BorderWidth > 0 ? this.BorderWidth : 0;
            Graphics g = e.Graphics;

            //缓冲
            //BufferedGraphicsContext currentContext = BufferedGraphicsManager.Current;
            //BufferedGraphics myBuffer = currentContext.Allocate(e.Graphics, e.ClipRectangle);
            //Graphics g = myBuffer.Graphics;

            GDIHelper.InitializeGraphics(g);
            GradientColor  color     = new GradientColor(this._BackBeginColor, this._BackEndColor, null, null);
            Rectangle      rect      = new Rectangle(0, 0, this.Size.Width - 1, this.Size.Height - 1);
            RoundRectangle roundRect = new RoundRectangle(rect, new CornerRadius(this._CornerRadius));

            GDIHelper.FillRectangle(g, roundRect, color);
            if (this._BorderWidth > 0)
            {
                rect.X     += this._BorderWidth - 1; rect.Y += this._BorderWidth - 1;
                rect.Width -= this._BorderWidth - 1; rect.Height -= this._BorderWidth - 1;

                GDIHelper.DrawPathBorder(g, new RoundRectangle(rect, new CornerRadius(this._CornerRadius)), this._BorderColor, this.BorderWidth);
                // 上容器的边框
                Rectangle rectPanel1 = new Rectangle(0, 0, this.Panel1.Width - 1, this.Panel1.Height - 1);
                GDIHelper.DrawPathBorder(g, new RoundRectangle(rectPanel1, new CornerRadius(0)), this._BorderColor, this.BorderWidth);
            }

            //g.SmoothingMode = SmoothingMode.HighQuality;
            //g.PixelOffsetMode = PixelOffsetMode.HighSpeed;
            //myBuffer.Render(e.Graphics);
            //g.Dispose();
            //myBuffer.Dispose();//释放资源
        }
Beispiel #4
0
 public bool IsDefault()
 {
     return(Color.IsEmpty() &&
            GradientColor.IsEmpty() &&
            GradientRotation.IsDefault() &&
            Image.IsEmpty());
 }
Beispiel #5
0
        internal SLLinePropertiesType Clone()
        {
            var lpt = new SLLinePropertiesType(listThemeColors);

            lpt.bUseNoLine          = bUseNoLine;
            lpt.bUseSolidLine       = bUseSolidLine;
            lpt.SolidColor          = SolidColor.Clone();
            lpt.bUseGradientLine    = bUseGradientLine;
            lpt.GradientColor       = GradientColor.Clone();
            lpt.vDashType           = vDashType;
            lpt.HasDashType         = HasDashType;
            lpt.vJoinType           = vJoinType;
            lpt.HasJoinType         = HasJoinType;
            lpt.HeadEndType         = HeadEndType;
            lpt.HeadEndSize         = HeadEndSize;
            lpt.TailEndType         = TailEndType;
            lpt.TailEndSize         = TailEndSize;
            lpt.decWidth            = decWidth;
            lpt.HasWidth            = HasWidth;
            lpt.vCapType            = vCapType;
            lpt.HasCapType          = HasCapType;
            lpt.vCompoundLineType   = vCompoundLineType;
            lpt.HasCompoundLineType = HasCompoundLineType;
            lpt.Alignment           = Alignment;

            return(lpt);
        }
Beispiel #6
0
        internal SLFill Clone()
        {
            var fill = new SLFill(listThemeColors);

            fill.Type                   = Type;
            fill.SolidColor             = SolidColor.Clone();
            fill.GradientColor          = GradientColor.Clone();
            fill.BlipFileName           = BlipFileName;
            fill.BlipRelationshipID     = BlipRelationshipID;
            fill.BlipTile               = BlipTile;
            fill.decBlipLeftOffset      = decBlipLeftOffset;
            fill.decBlipRightOffset     = decBlipRightOffset;
            fill.decBlipTopOffset       = decBlipTopOffset;
            fill.decBlipBottomOffset    = decBlipBottomOffset;
            fill.decBlipOffsetX         = decBlipOffsetX;
            fill.decBlipOffsetY         = decBlipOffsetY;
            fill.decBlipScaleX          = decBlipScaleX;
            fill.decBlipScaleY          = decBlipScaleY;
            fill.BlipAlignment          = BlipAlignment;
            fill.BlipMirrorType         = BlipMirrorType;
            fill.decBlipTransparency    = decBlipTransparency;
            fill.BlipDpi                = BlipDpi;
            fill.BlipRotateWithShape    = BlipRotateWithShape;
            fill.PatternPreset          = PatternPreset;
            fill.PatternForegroundColor = PatternForegroundColor.Clone();
            fill.PatternBackgroundColor = PatternBackgroundColor.Clone();

            return(fill);
        }
Beispiel #7
0
 //----------------------------------------------------------
 //--------------------- CONSTRUCTEURS ----------------------
 //----------------------------------------------------------
 public WidgetTabBar(string name, CoronaLayer layerParent)
     : base(name, WidgetType.tabBar, layerParent)
 {
     Buttons                  = new List <TabBarButton>();
     GradientForTup           = new GradientColor();
     GradientForTup.isEnabled = false;
 }
 protected override void EnableProperties()
 {
     Segments.IsVisibleWhen(SegmentColors, s => s.CurrentValue);
     GradientColor.IsVisibleWhen(ColorType, c => c.BaseValue == ColorMappingType.Gradient);
     MainColor.IsVisibleWhen(ColorType, c => c.BaseValue == ColorMappingType.Simple);
     SecondaryColor.IsVisibleWhen(ColorType, c => c.BaseValue == ColorMappingType.Simple);
 }
        /// <summary>
        /// Moves the gradient control point to the given position
        /// </summary>
        /// <param name="index">Index of the control point</param>
        /// <param name="position">Position to move the control point to</param>
        /// <returns>The new index of the control point that was moved</returns>
        public int SetPosition(int index, double position)
        {
            GradientColor gc = colors[index];

            gc.Position   = position;
            colors[index] = gc;

            while (index + 1 < Count && position > colors[index + 1].Position)
            {
                GradientColor t = colors[index];
                colors[index]     = colors[index + 1];
                colors[index + 1] = t;
                index++;
            }

            while (index - 1 >= 0 && position < colors[index - 1].Position)
            {
                GradientColor t = colors[index];
                colors[index]     = colors[index - 1];
                colors[index - 1] = t;
                index--;
            }

            return(index);
        }
Beispiel #10
0
 //----------------------------------------------------------
 //--------------------- CONSTRUCTEURS ----------------------
 //----------------------------------------------------------
 public WidgetTabBar(string name,CoronaLayer layerParent)
     : base(name,WidgetType.tabBar,layerParent)
 {
     Buttons = new List<TabBarButton>();
     GradientForTup = new GradientColor();
     GradientForTup.isEnabled = false;
 }
Beispiel #11
0
        public PlayfieldMapRender()
        {
            GradientColor gradient = new GradientColor();

            gradient.AddGradientPoint(0, new LibNoise.Renderer.Color(0, 0, 0xc0));
            gradient.AddGradientPoint(20, new LibNoise.Renderer.Color(0, 0, 0xff));
            gradient.AddGradientPoint(21, new LibNoise.Renderer.Color(0xa0, 0xa0, 0));
            gradient.AddGradientPoint(30, new LibNoise.Renderer.Color(0xc0, 0xc0, 0));
            gradient.AddGradientPoint(40, new LibNoise.Renderer.Color(0, 0x80, 0));
            gradient.AddGradientPoint(100, new LibNoise.Renderer.Color(0x40, 0xa0, 0x40));
            gradient.AddGradientPoint(150, new LibNoise.Renderer.Color(0x60, 0x60, 0));
            gradient.AddGradientPoint(200, new LibNoise.Renderer.Color(0x80, 0x80, 0x80));
            gradient.AddGradientPoint(300, new LibNoise.Renderer.Color(0xa0, 0xa0, 0xa0));
            gradient.AddGradientPoint(320, new LibNoise.Renderer.Color(0xc0, 0xc0, 0xc0));
            gradient.AddGradientPoint(500, new LibNoise.Renderer.Color(0xff, 0xff, 0xff));
            gradient.AddGradientPoint(510, new LibNoise.Renderer.Color(0x80, 0x80, 0x80));
            gradient.AddGradientPoint(1000, new LibNoise.Renderer.Color(0xa0, 0xa0, 0xa0));

            this.Renderer.Gradient = gradient;

            this.Renderer.LightEnabled = false;
            //this.Renderer.LightBrightness = 2;
            //this.Renderer.LightContrast = 3;
            //this.Renderer.WrapEnabled = true;
        }
Beispiel #12
0
 private void OK_btn_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(themeName_tbx.Text))
     {
         foreach (var item in themeNames)
         {
             if (themeName_tbx.Text == item)//to check if the theme name already exists
             {
                 Common.CustomMessageBox.Show("Theme name already exists");
                 return;
             }
         }
         GradientColor valuesDic = new GradientColor();
         valuesDic.Color1            = Color1;
         valuesDic.Color2            = Color2;
         valuesDic.FontForeColor     = FontColor;
         valuesDic.ColorAngle        = (float)SweepAngle_nud.Value;
         valuesDic.GradientColorName = themeName_tbx.Text;
         gradientColorChangeEvent(valuesDic);
         isOk = true;
         this.Close();
     }
     else
     {
         Common.CustomMessageBox.Show("Theme name should not be empty", "Warning", Common.CustomMessageBoxButtons.OK);
     }
 }
        /// <summary>
        /// Construct a <see cref="GradientColor"/> from the properties in a <see cref="IDictionary"/>
        /// </summary>
        /// <param name="context">designer context</param>
        /// <param name="propertyValues">The "serialized" values for the <see cref="GradientColor"/></param>
        /// <returns>
        /// A <see cref="GradientColor"/>
        /// </returns>
        public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
        {
            GradientColor gradientColor = new GradientColor();

            gradientColor.Start = (System.Drawing.Color)propertyValues["Start"];
            gradientColor.End   = (System.Drawing.Color)propertyValues["End"];
            return((object)gradientColor);
        }
Beispiel #14
0
        /// <summary>
        /// Draw a preview of the <see cref="GradientColor"/>
        /// </summary>
        /// <param name="e">The paint event args providing the <see cref="Graphics"/> and bounding
        /// rectangle</param>
        public override void PaintValue(PaintValueEventArgs e)
        {
            GradientColor gradientColor = (GradientColor)e.Value;

            using (LinearGradientBrush b = gradientColor.GetBrush(e.Bounds, LinearGradientMode.Horizontal))
            {
                e.Graphics.FillRectangle(b, e.Bounds);
            }
        }
Beispiel #15
0
 public RowTemplate()
 {
     this.m_CellTemplates = new CellCollection(this);
     this.m_BackColor = SystemColors.ControlLightLight;
     this.m_ForeColor = SystemColors.ControlText;
     this.m_gradientBackColor = new GradientColor();
     this.m_gradientBackColor.PropertyChanged += new EventHandler(this.m_gradientBackColor_PropertyChanged);
     this.m_iHeight = 0x10;
 }
Beispiel #16
0
 public void SetColor(int index, ColorBgra color)
 {
     if (index >= 0 && index < Count)
     {
         GradientColor gc = colors[index];
         gc.Color      = color;
         colors[index] = gc;
     }
 }
 /// <summary>
 /// 使用渐变色渲染一个图形区域
 /// </summary>
 /// <param name="g">The g.</param>
 /// <param name="path">The path.</param>
 /// <param name="rect">The rect.</param>
 /// <param name="color">The color.</param>
 /// User:Ryan  CreateTime:2012-8-6 21:27.
 public static void FillPath(Graphics g, GraphicsPath path, Rectangle rect, GradientColor color)
 {
     using (LinearGradientBrush brush = new LinearGradientBrush(rect, color.First, color.Second, LinearGradientMode.Vertical))
     {
         brush.Blend.Factors   = color.Factors;
         brush.Blend.Positions = color.Positions;
         g.FillPath(brush, path);
     }
 }
Beispiel #18
0
 public static ObjectId AddHatch(ObjectIdCollection[] objIds, int gradientType, Color hColor1, Color hColor2, string gradientName, double gradientAngle)
 {
     checked
     {
         ObjectId result;
         try
         {
             Hatch hatch = new Hatch();
             hatch.HatchObjectType = 1;
             Database workingDatabase = HostApplicationServices.WorkingDatabase;
             ObjectId objectId;
             using (Transaction transaction = workingDatabase.TransactionManager.StartTransaction())
             {
                 BlockTable       blockTable       = (BlockTable)transaction.GetObject(workingDatabase.BlockTableId, 0);
                 BlockTableRecord blockTableRecord = (BlockTableRecord)transaction.GetObject(blockTable[BlockTableRecord.ModelSpace], 1);
                 objectId = blockTableRecord.AppendEntity(hatch);
                 transaction.AddNewlyCreatedDBObject(hatch, true);
                 GradientColor gradientColor;
                 gradientColor..ctor(hColor1, 0f);
                 GradientColor gradientColor2;
                 gradientColor2..ctor(hColor2, 1f);
                 GradientColor[] gradientColors = new GradientColor[]
                 {
                     gradientColor,
                     gradientColor2
                 };
                 hatch.SetGradientColors(gradientColors);
                 hatch.SetGradient(gradientType, gradientName);
                 hatch.GradientAngle = gradientAngle;
                 hatch.Associative   = true;
                 int num  = 0;
                 int num2 = objIds.Length - 1;
                 int num3 = num;
                 for (;;)
                 {
                     int num4 = num3;
                     int num5 = num2;
                     if (num4 > num5)
                     {
                         break;
                     }
                     hatch.InsertLoopAt(num3, 0, objIds[num3]);
                     num3++;
                 }
                 transaction.Commit();
             }
             result = objectId;
         }
         catch (Exception ex)
         {
             ObjectId @null = ObjectId.Null;
             result = @null;
         }
         return(result);
     }
 }
Beispiel #19
0
        public override string ToString()
        {
            string result = "Fill " + FillColor.ToString();

            if (Mode != FillMode.Solid)
            {
                result += " " + Mode.ToString() + " " + GradientColor.ToString();
            }
            return(result);
        }
Beispiel #20
0
 public void Reverse()
 {
     for (int i = 0; i < Count; i++)
     {
         GradientColor gc = colors[i];
         gc.Position = 1 - gc.Position;
         colors[i]   = gc;
     }
     colors.Reverse();
 }
Beispiel #21
0
        /// <summary>
        /// Evenly spaces all of the colors.
        /// </summary>
        public void Spread()
        {
            if (Count <= 1)
            {
                return;
            }

            double space = 1.0 / (Count - 1);

            for (int i = 0; i < Count; i++)
            {
                colors[i] = new GradientColor(i * space, colors[i].Color);
            }
        }
        /// <summary>
        /// 渲染一个矩形区域(渐变色)
        /// Fills the rectangle.
        /// </summary>
        /// <param name="g">The g.</param>
        /// <param name="rect">The rect.</param>
        /// <param name="color">The color.</param>
        /// User:Ryan  CreateTime:2012-8-3 21:25.
        public static void FillRectangle(Graphics g, Rectangle rect, GradientColor color)
        {
            if (rect.Width <= 0 || rect.Height <= 0 || g == null)
            {
                return;
            }

            using (LinearGradientBrush brush = new LinearGradientBrush(rect, color.First, color.Second, LinearGradientMode.Vertical))
            {
                brush.Blend.Factors   = color.Factors;
                brush.Blend.Positions = color.Positions;
                g.FillRectangle(brush, rect);
            }
        }
Beispiel #23
0
        /// <summary>
        /// Lấy màu radiant
        /// </summary>
        /// <param name="gradientStops"></param>
        /// <param name="msoGradientStyle"></param>
        /// <returns></returns>
        private GradientColor GetRadialColor(GradientStops gradientStops, MsoGradientStyle msoGradientStyle)
        {
            GradientColor gradientColor = new GradientColor();

            gradientColor.Type = GradientColorType.Radial;
            for (int i = 1; i <= gradientStops.Count; i++)
            {
                gradientColor.LinearElements.Add(new LinearElement()
                {
                    Color = ConvertColor(gradientStops[i].Color.RGB), SpecialName = GetSpecialName(gradientStops[i].Color.ObjectThemeColor), Brightness = gradientStops[i].Color.Brightness, Offset = gradientStops[i].Position
                });
            }
            gradientColor.LinearElements = gradientColor.LinearElements.OrderBy(s => s.Offset).ToList();
            return(gradientColor);
        }
Beispiel #24
0
        public DisplayObject(CoronaSpriteSet spriteSet, Point location, CoronaObject coronaObjectParent)
        {
            this.type      = "SPRITE";
            Alpha          = 1.0F;
            this.SpriteSet = spriteSet;
            this.SpriteSet.DisplayObjectParent = this;

            this.surfaceRect = new Rectangle(location, new Size(50, 50));


            InitialRect             = this.surfaceRect;
            this.CoronaObjectParent = coronaObjectParent;
            this.GradientColor      = new GradientColor();

            this.CurrentFrame = SpriteSet.indexFrameDep;
        }
Beispiel #25
0
        /// <summary>
        /// グラデーションの設定を作成して返す
        /// </summary>
        /// <param name="gradientColor">グラデーションのタイプ</param>
        /// <returns>グラデーションの設定</returns>
        public GradientModel CreateGradientModel(GradientColor gradientColor)
        {
            switch (gradientColor)
            {
            case GradientColor.Transparent:
                // 透明色の場合はnullを返す
                return(null);

            case GradientColor.DarkRed:
                return(new GradientModel()
                {
                    Colors = new SKColor[] { SKColors.Red, SKColors.DarkRed },
                    ColorPos = new float[] { 0, 1 }
                });

            case GradientColor.LightBlue:
                return(new GradientModel()
                {
                    Colors = new SKColor[] { SKColors.AliceBlue, SKColors.LightBlue },
                    ColorPos = new float[] { 0, 1 }
                });

            case GradientColor.DarkYellow:
                return(new GradientModel()
                {
                    Colors = new SKColor[] { Color.FromHex("#FFFFA500").ToSKColor(), Color.FromHex("#FF90B000").ToSKColor() },
                    ColorPos = new float[] { 0, 1 }
                });

            case GradientColor.Black:
                return(new GradientModel()
                {
                    Colors = new SKColor[] { SKColors.Transparent, SKColors.Black },
                    ColorPos = new float[] { 0.5f, 1 }
                });

            case GradientColor.Gray:
                return(new GradientModel()
                {
                    Colors = new SKColor[] { SKColors.LightGray, SKColors.Gray },
                    ColorPos = new float[] { 0, 1 }
                });

            default:
                throw new System.Exception("Invalid GradientColor");
            }
        }
        /// <summary>
        /// 渲染一个圆角矩形区域(渐变色)
        /// Fills the rectangle.
        /// </summary>
        /// <param name="g">The g.</param>
        /// <param name="roundRect">The round rect.</param>
        /// <param name="color">The color.</param>
        /// User:Ryan  CreateTime:2012-8-3 21:45.
        public static void FillRectangle(Graphics g, RoundRectangle roundRect, GradientColor color)
        {
            if (roundRect.Rect.Width <= 0 || roundRect.Rect.Height <= 0)
            {
                return;
            }

            using (GraphicsPath path = roundRect.ToGraphicsBezierPath())
            {
                using (LinearGradientBrush brush = new LinearGradientBrush(roundRect.Rect, color.First, color.Second, LinearGradientMode.Vertical))
                {
                    brush.Blend.Factors   = color.Factors;
                    brush.Blend.Positions = color.Positions;
                    g.FillPath(brush, path);
                }
            }
        }
        //Implement ISerializable
        public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
        {
            info.AddValue("Key", Key);
            info.AddValue("Redraw", Redraw);
            info.AddValue("BasePath", Serialize.AddPath(mBasePath));
            info.AddValue("BaseSize", Serialize.AddSizeF(BaseSize));
            info.AddValue("BaseInternalRectangle", Serialize.AddRectangleF(BaseInternalRectangle));

            info.AddValue("BorderColor", BorderColor.ToArgb().ToString());
            info.AddValue("BorderStyle", Convert.ToInt32(BorderStyle).ToString());
            info.AddValue("SmoothingMode", Convert.ToInt32(SmoothingMode).ToString());
            info.AddValue("BackColor", BackColor.ToArgb().ToString());
            info.AddValue("GradientColor", GradientColor.ToArgb().ToString());
            info.AddValue("GradientMode", Convert.ToInt32(GradientMode).ToString());
            info.AddValue("DrawGradient", DrawGradient);
            info.AddValue("Options", Convert.ToInt32(Options).ToString());
        }
Beispiel #28
0
    // レコードオブジェクトの初期化
    void InitializeRecord(ref List <int> records)
    {
        PointManager pointManager;

#if UNITY_EDITOR
        if (m_isUseTestMyScore)
        {
            SetMyScore(m_testMyScore);
        }
#endif

        for (int i = 0; i < records.Count; i++)
        {
            Transform child = transform.FindChild("Records").GetChild(i);;

            // ランクイン判定
            if (m_isMyScoreChanged && m_rankInRecordObj == null && m_myScore > records[i])
            {
                m_rankInRecordObj = child;

                records.Insert(i, m_myScore);
                records.RemoveAt(records.Count - 1);

                Debug.Log("Rank In! : " + (i + 1));
            }

            pointManager = child.FindChild("PointManager").GetComponent <PointManager>();
            pointManager.AddPoint(records[i]);
        }

        // マイスコア

        m_myScoreObj = transform.FindChild("myScore");
        pointManager = m_myScoreObj.FindChild("PointManager").GetComponent <PointManager>();
        pointManager.AddPoint(m_myScore);

        if (m_rankInRecordObj != null)
        {
            m_gradient = gameObject.AddComponent <GradientColor>();
            m_gradient.gradientTime = m_interval;
            m_gradient.element      = new List <GradientElement>(m_gradColors);

            SetColorRecord(m_myScoreObj, m_gradColors[0].color);
            SetColorRecord(m_rankInRecordObj, m_gradColors[0].color);
        }
    }
Beispiel #29
0
        public DisplayObject(Image img, Point location, CoronaObject coronaObjectParent)
        {
            this.surfaceRect      = new Rectangle();
            this.surfaceRect.Size = img.Size;

            this.surfaceRect.Location = location;
            InitialRect = this.surfaceRect;

            this.Name  = "";
            this.type  = "IMAGE";
            this.image = img;

            CurrentFrame = 0;
            Alpha        = 1.0F;

            this.GradientColor      = new GradientColor();
            this.CoronaObjectParent = coronaObjectParent;
        }
Beispiel #30
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            int      w = this.BorderWidth > 0 ? this.BorderWidth : 0;
            Graphics g = e.Graphics;

            GDIHelper.InitializeGraphics(g);
            GradientColor  color     = new GradientColor(this._BackBeginColor, this._BackEndColor, null, null);
            Rectangle      rect      = new Rectangle(0, 0, this.Size.Width - 1, this.Size.Height - 1);
            RoundRectangle roundRect = new RoundRectangle(rect, new CornerRadius(this._CornerRadius));

            GDIHelper.FillRectangle(g, roundRect, color);
            if (this._BorderWidth > 0)
            {
                rect.X     += this._BorderWidth - 1; rect.Y += this._BorderWidth - 1;
                rect.Width -= this._BorderWidth - 1; rect.Height -= this._BorderWidth - 1;
                GDIHelper.DrawPathBorder(g, new RoundRectangle(rect, new CornerRadius(this._CornerRadius)), this._BorderColor, this.BorderWidth);
            }
        }
Beispiel #31
0
 public SpinButton()
 {
     this.m_gradientColors.PropertyChanged        += new EventHandler(this.OnGradientColorPropertyChanged);
     this.m_gradientColorsPressed                  = new GradientColor(Color.Black, Color.LightGray);
     this.m_gradientColorsPressed.PropertyChanged += new EventHandler(this.OnGradientColorPropertyChanged);
     this.m_imageDefault       = null;
     this.m_imagePressed       = null;
     this.m_imageVgaDefault    = null;
     this.m_imageVgaPressed    = null;
     this.m_timer              = new Timer();
     this.m_timer.Enabled      = false;
     this.m_timer.Tick        += new EventHandler(this.OnTimerTick);
     this.m_repeatDelay        = 500;
     this.m_repeatRate         = 100;
     this.m_repeatIncreaseRate = 20;
     this.m_repeatCount        = 0;
     this.m_increaseRate       = 1;
     base.BackColor            = SystemColors.Window;
     base.Size = new Size(12, 0x16);
 }
Beispiel #32
0
        public DisplayObject(GorgonLibrary.Graphics.Sprite gorgonSprite, Point location, CoronaObject coronaObjectParent)
        {
            this.surfaceRect  = new Rectangle();
            this.GorgonSprite = gorgonSprite;

            this.surfaceRect.Size = new Size(GorgonSprite.Image.Width, GorgonSprite.Image.Height);

            this.surfaceRect.Location = location;
            InitialRect = this.surfaceRect;

            this.Name = "";
            this.type = "IMAGE";


            CurrentFrame = 0;
            Alpha        = 1.0F;

            this.GradientColor      = new GradientColor();
            this.CoronaObjectParent = coronaObjectParent;
        }
Beispiel #33
0
 public InkBox()
 {
     this.m_lastPositon = new Point(0, 0);
     this.Width = 200;
     this.Height = 80;
     this.m_ImageSize = new System.Drawing.Size(this.Width, this.Height);
     this.BackColor = Color.White;
     this.ForeColor = Color.Black;
     this.m_gradientBackColor = new GradientColor();
     this.m_gradientBackColor.PropertyChanged += new EventHandler(this.m_gradientBackColor_PropertyChanged);
     this.m_useGradient = false;
     this.m_penWidth = 0;
     this.InitScrollBar();
     Graphics graphics = base.CreateGraphics();
     this.m_IsQvga = graphics.DpiX == 96f;
     graphics.Dispose();
     graphics = null;
     this.CreateMemoryBitmap();
     this.CreateGdiObjects();
     this.CreatePenObjects();
 }
Beispiel #34
0
 public ToolTip()
 {
     base.BackColor = SystemColors.Info;
     base.ForeColor = SystemColors.InfoText;
     //base.set_BorderStyle(BorderStyle.FixedSingle);
     base.BorderStyle = (BorderStyle.FixedSingle);
     base.Text = "";
     this.m_textAlignment = HorizontalAlignment.Left;
     this.m_showLocation = Resco.Controls.OutlookControls.ShowLocation.TopLeft;
     this.m_minimizeBox = false;
     this.m_showTitle = false;
     this.m_titleText = "";
     this.m_titleFont = new Font(this.Font.Name, this.Font.Size, FontStyle.Bold);
     this.m_titleHeight = 0x10;
     this.m_titleBackColor = SystemColors.ActiveCaption;
     this.m_titleForeColor = SystemColors.ActiveCaptionText;
     this.m_gradientBackColor = new GradientColor();
     this.m_gradientBackColor.PropertyChanged += new EventHandler(this.m_gradientBackColor_PropertyChanged);
     this.m_useGradient = false;
     this.m_style = ToolTipStyle.Normal;
 }
Beispiel #35
0
 public void ClearGradient()
 {
     gradient = new GradientColor();
 }
Beispiel #36
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public ImageRenderer()
        {
            gradient = new GradientColor();

            EnableLight = false;
            EnableWrap = false;
            LightAzimuth = 45D;
            LightBrightness = 1D;
            LightColor = new Color(255, 255, 255, 255);
            LightContrast = 1D;
            LightElevation = 45D;
            LightIntensity = 1D;

            recalcLightValues = true;
        }
Beispiel #37
0
 public AdvancedList()
 {
     this.OnChangeHandler = new OnChangeDelegate(this.OnChangeSafe);
     this.OnRowRemovedHandler = new OnRowRemovedDelegate(this.OnRowRemovedSafe);
     this.m_templateIndex = 0;
     this.m_selectedTemplateIndex = 0;
     this.m_activeTemplateIndex = -1;
     this.m_alternateTemplateIndex = -1;
     this.m_dbConnector = new Resco.Controls.AdvancedList.DataConnector();
     this.m_connector = this.m_dbConnector;
     this.m_rcRows = new RowCollection(this);
     this.m_rcRows.Changed += new GridEventHandler(this.OnChange);
     this.m_tsCurrent = new TemplateSet();
     this.m_tsCurrent.Parent = this;
     this.m_tsCurrent.Changed += new GridEventHandler(this.OnChange);
     BackBufferManager.AddRef();
     this.m_colorKey = Color.FromArgb(0xff, 0, 0xff);
     this.m_brushKey = new SolidBrush(this.m_colorKey);
     this.m_imgAttr = new ImageAttributes();
     this.m_imgAttr.SetColorKey(this.m_colorKey, this.m_colorKey);
     base.BackColor = SystemColors.ControlDark;
     this.m_BackColor = new SolidBrush(this.BackColor);
     this.m_vScrollWidth = 0;
     this.m_iScrollWidth = 13;
     this.ButtonClick = null;
     this.LinkClick = null;
     this.CellClick = null;
     this.RowSelect = null;
     this.HeaderClick = null;
     this.ActiveRowChanged = null;
     this.Scroll = null;
     this.m_rHeader = new Resco.Controls.AdvancedList.HeaderRow();
     this.m_rHeader.Parent = this.m_rcRows;
     this.m_rFooter = new Resco.Controls.AdvancedList.HeaderRow();
     this.m_rFooter.Parent = this.m_rcRows;
     this.m_iActualRowIndex = 0;
     this.m_iTopmostRowOffset = 0;
     this.m_iDocumentHeight = 0;
     this.m_iExpectedRows = -1;
     this.m_iVScrollPrevValue = 0;
     this.m_toolTipType = Resco.Controls.AdvancedList.ToolTipType.Triangle;
     using (Graphics graphics = base.CreateGraphics())
     {
         TooltipWidth = (int) (DefaultTooltipWidth * (graphics.DpiX / 96f));
         point1 = new Point(0, 0);
         point2 = new Point(0, -TooltipWidth);
         point3 = new Point(-TooltipWidth, 0);
         this.m_ToolTip = null;
         this.m_scaleFactorY = graphics.DpiY / 96f;
     }
     this.m_Timer = new Timer();
     this.m_Timer.Enabled = false;
     this.m_Timer.Interval = 500;
     this.m_Timer.Tick += new EventHandler(this.OnTimerTick);
     this.m_bShowingToolTip = false;
     this.m_iSelectedCellIndex = -1;
     this.m_TouchScrollingTimer = new Timer();
     this.m_TouchScrollingTimer.Enabled = false;
     this.m_TouchScrollingTimer.Interval = 50;
     this.m_TouchScrollingTimer.Tick += new EventHandler(this.OnTouchScrollingTimerTick);
     this.m_bStartingTouchScroll = false;
     this.m_bEnableTouchScrolling = false;
     this.m_TouchAutoScrollDiff = 0;
     this.m_touchSensitivity = 8;
     this.m_touchScrollDirection = Resco.Controls.AdvancedList.TouchScrollDirection.Inverse;
     this.m_nRowsLoaded = 0;
     this.m_nRowsInserted = 0;
     this.m_bFocusOnClick = false;
     this.m_gradientBackColor = new GradientColor(FillDirection.Horizontal);
     this.m_gradientBackColor.PropertyChanged += new EventHandler(this.m_gradientBackColor_PropertyChanged);
 }
Beispiel #38
0
 protected override void Dispose(bool disposing)
 {
     if (this.m_TouchScrollingTimer != null)
     {
         this.m_TouchScrollingTimer.Dispose();
         this.m_TouchScrollingTimer = null;
     }
     if (this.m_dbConnector != null)
     {
         this.m_dbConnector.Dispose();
         this.m_dbConnector = null;
     }
     if (this.m_rcRows != null)
     {
         this.m_rcRows.Parent = null;
     }
     this.m_rcRows = null;
     if (this.m_tsCurrent != null)
     {
         this.m_tsCurrent.Changed -= new GridEventHandler(this.OnChange);
         this.m_tsCurrent.Parent = null;
     }
     this.m_tsCurrent = null;
     BackBufferManager.Release();
     if (this.m_alLinks != null)
     {
         this.m_alLinks.Clear();
     }
     this.m_alLinks = null;
     if (this.m_alTooltips != null)
     {
         this.m_alTooltips.Clear();
     }
     this.m_alTooltips = null;
     if (this.m_alButtons != null)
     {
         this.m_alButtons.Clear();
     }
     this.m_alButtons = null;
     Utility.Dispose();
     Resco.Controls.AdvancedList.Mapping.DisposeEmptyMapping();
     RowTemplate.DisposeDefaultRowTemplate();
     ImageCache.GlobalCache.Clear();
     if (sBrushes != null)
     {
         sBrushes.Clear();
     }
     sBrushes = null;
     this.RemoveActiveHandlers();
     if (this.m_rHeader != null)
     {
         this.m_rHeader.Parent = null;
     }
     this.m_rHeader = null;
     if (this.m_rFooter != null)
     {
         this.m_rFooter.Parent = null;
     }
     this.m_rFooter = null;
     this.OnChangeHandler = null;
     this.OnRowRemovedHandler = null;
     if (this.m_gradientBackColor != null)
     {
         this.m_gradientBackColor.PropertyChanged -= new EventHandler(this.m_gradientBackColor_PropertyChanged);
     }
     this.m_gradientBackColor = null;
     if (sPen != null)
     {
         sPen.Dispose();
     }
     sPen = null;
     if (sPixel != null)
     {
         sPixel.Dispose();
     }
     sPixel = null;
     GC.Collect();
     base.Dispose(disposing);
 }
Beispiel #39
0
 private void InitDrawShadowMask(Graphics gr, Rectangle aRect, Point anOffset)
 {
     GradientColor color = new GradientColor();
     color.FillDirection = FillDirection.Vertical;
     color.StartColor = Color.FromArgb(0x9c, 0x9c, 0x9c);
     color.EndColor = Color.White;
     int height = aRect.Height / 3;
     Rectangle rc = new Rectangle(anOffset.X, anOffset.Y, aRect.Width, height);
     Rectangle rectangle2 = new Rectangle(anOffset.X, (anOffset.Y + aRect.Height) - height, aRect.Width, height);
     Rectangle rect = new Rectangle(anOffset.X, rc.Bottom, aRect.Width, rectangle2.Top - rc.Bottom);
     using (SolidBrush brush = new SolidBrush(Color.White))
     {
         gr.FillRectangle(brush, rect);
     }
     color.DrawGradient(gr, rc);
     color.StartColor = Color.White;
     color.EndColor = Color.FromArgb(0x9c, 0x9c, 0x9c);
     color.DrawGradient(gr, rectangle2);
 }
Beispiel #40
0
 public OutlookMonthCalendar()
 {
     using (Graphics graphics = base.CreateGraphics())
     {
         this.m_scaleFactor.Width = graphics.DpiX / 96f;
         this.m_scaleFactor.Height = graphics.DpiY / 96f;
     }
     this.m_tooltipTimer.Enabled = false;
     this.m_tooltipTimer.Interval = this.m_tooltipDelay;
     this.m_tooltipTimer.Tick += new EventHandler(this.m_tooltipTimer_Tick);
     this.CalculateDays(this.m_monthCount);
     for (int i = 0; i < this.m_monthCount; i++)
     {
         this.m_rcMonths.Add(Rectangle.Empty);
         this.m_rcYears.Add(Rectangle.Empty);
     }
     this.CreateGdiObjects();
     this.InitMonthContextMenu();
     this.InitYearUpDown();
     base.Visible = true;
     base.Location = new Point(0, 0);
     base.Size = new Size(0xa4, 0x98);
     using (Graphics graphics2 = base.CreateGraphics())
     {
         this.m_layout.FontChange(graphics2, this.Font);
     }
     this.m_gradientBackColor = new GradientColor();
     this.m_gradientBackColor.PropertyChanged += new EventHandler(this.m_gradientBackColor_PropertyChanged);
     this.m_useGradient = false;
     this.m_titleVistaStyle = false;
     this.m_TouchNavigatorTool = new TouchNavigatorTool(this);
     this.m_TouchNavigatorTool.GestureDetected += new TouchNavigatorTool.GestureDetectedHandler(this.TouchNavigatorTool_GestureDetected);
 }
        public override void FromXML(XmlNode xGradientNode)
        {
            base.FromXML(xGradientNode);

            originalGradientStops = new List<GradientColor>();
            XmlNodeList xColors = xGradientNode.SelectNodes("Color");
            foreach (XmlNode xColor in xColors)
            {
                GradientColor gc = new GradientColor();

                try
                {
                    gc.color = xColor.Attributes.GetNamedItem("color").Value;
                    gc.offset = double.Parse(xColor.Attributes.GetNamedItem("offset").Value);
                } catch (FormatException) {
                    throw new InvalidXMLValueException("OverlayGradient:Color", "offset", InvalidXMLValueException.Reason.FormatIncorrect);
                } catch (ArgumentNullException) {
                    throw new InvalidXMLValueException("OverlayGradient:Color", "offset", InvalidXMLValueException.Reason.NotSpecified);
                } catch (OverflowException) {
                    throw new InvalidXMLValueException("OverlayGradient:Color", "offset", InvalidXMLValueException.Reason.Overflow);
                } catch (Exception) {
                    throw new InvalidXMLValueException("OverlayGradient:Color", "color or offset", InvalidXMLValueException.Reason.NotSpecified);
                }

                gc.transparent = null;

                foreach (XmlAttribute xAttrib in xColor.Attributes)
                {
                    try
                    {
                        switch (xAttrib.LocalName)
                        {
                            case "transparent":
                                gc.transparent = bool.Parse(xAttrib.Value);
                                break;
                        }
                    } catch (FormatException) {
                        throw new InvalidXMLValueException("OverlayGradient:Color", "transparent", InvalidXMLValueException.Reason.FormatIncorrect);
                    } catch (ArgumentNullException) {
                        throw new InvalidXMLValueException("OverlayGradient:Color", "transparent", InvalidXMLValueException.Reason.NotSpecified);
                    }
                }

                originalGradientStops.Add(gc);
            }

            foreach (XmlAttribute xAttrib in xGradientNode.Attributes)
            {
                try
                {
                    switch (xAttrib.LocalName)
                    {
                        case "angle":
                            angle = double.Parse(xAttrib.Value);
                            break;
                        case "height":
                            Height = double.Parse(xAttrib.Value);
                            break;
                        case "width":
                            Width = double.Parse(xAttrib.Value);
                            break;

                    }
                } catch (FormatException) {
                    throw new InvalidXMLValueException("OverlayGradient", xAttrib.LocalName, InvalidXMLValueException.Reason.FormatIncorrect);
                } catch (ArgumentNullException) {
                    throw new InvalidXMLValueException("OverlayGradient", xAttrib.LocalName, InvalidXMLValueException.Reason.NotSpecified);
                } catch (OverflowException) {
                    throw new InvalidXMLValueException("OverlayGradient", xAttrib.LocalName, InvalidXMLValueException.Reason.Overflow);
                }
            }
        }
Beispiel #42
0
 public GradientColorTests()
 {
     gradient = new GradientColor();
     gradient.AddGradientPoint(0, new Color(0, 0, 0, byte.MaxValue));
     gradient.AddGradientPoint(1, new Color(byte.MaxValue, 0, 0, byte.MaxValue));
 }