public void SetDEMFillMode(FillMode fillMode)
 {
     lock (gDevice)
     {
         demFillMode = fillMode;
     }
 }
 public AtomShadingDesc(AtomShadingDesc toClone)
 {
     this.fillMode = toClone.fillMode;
     this.symbolText = toClone.symbolText;
     this.moleculeMaterials = toClone.moleculeMaterials;
     this.Draw = toClone.Draw;
 }
        public void BeginModify(FillMode fillmode)
        {
            if(m_geometryFilled)
                CreatePathGeometry();

            m_geometrySink = m_pathGeometry.Open();
            m_geometrySink.SetFillMode((SlimDX.Direct2D.FillMode)fillmode);
        }
Exemple #4
0
 /// <summary>
 /// Create objects in a cubical patern
 /// </summary>
 /// <param name="item">the GameObject to be placed in our cubic patern</param>
 /// <param name="item2">the second type of GameObject to be placed in empty places of our patern (instead of being empty)</param>
 /// <param name="position">position of the corner of the cube</param>
 /// <param name="width">width of the cube</param>
 /// <param name="height">height of the cube</param>
 /// <param name="depth">depth of the cube</param>
 /// <param name="tileSize">size of each tile of the cube (i.e distance between items)</param>
 /// <param name="fill">fill mode of the cube</param>
 /// <returns>returns if it was successful or not</returns>
 public static bool CreateCubical(GameObject item, GameObject item2, Vector3 position, float width, float height, float depth, float tileSize, FillMode fill)
 {
     if (item == null || width <= 0 || height <= 0 || depth <= 0 || tileSize <= 0)
     {
         return false;
     }
     //some modes can not tolerate even numbers
     if (fill == FillMode.YesNo)
     {
         if (width % 2 == 0) width++;
         if (height % 2 == 0) height++;
         if (depth % 2 == 0) depth++;
     }
     currentPosition = position;
     for (int i = 0; i < width; i++)
     {
         for (int j = 0; j < height; j++)
         {
             for (int k = 0; k < depth; k++)
             {
                 if (fill == FillMode.fill)
                 {
                     GameObject.Instantiate(item, currentPosition, Quaternion.identity);
                 }
                 else if (fill == FillMode.empty)
                 {
                     if (i == 0 || j == 0 || k == 0 || i == width - 1 || j == height - 1 || k == depth - 1)
                     {
                         GameObject.Instantiate(item, currentPosition, Quaternion.identity);
                     }
                     else if (item2 != null)
                     {
                         GameObject.Instantiate(item2, currentPosition, Quaternion.identity);
                     }
                 }
                 else if (fill == FillMode.YesNo)
                 {
                     if ((i % 2 == 0 && j % 2 == 0 && k % 2 == 0) || i == 0 || j == 0 || k == 0 || i == width - 1 || j == height - 1 || k == depth - 1)
                     {
                         GameObject.Instantiate(item, currentPosition, Quaternion.identity);
                     }
                     else if (item2 != null)
                     {
                         GameObject.Instantiate(item2, currentPosition, Quaternion.identity);
                     }
                 }
                 currentPosition.z += tileSize;
             }
             currentPosition.y += tileSize;
             currentPosition.z = position.z;
         }
         currentPosition.x += tileSize;
         currentPosition.y = position.y;
         currentPosition.z = position.z;
     }
     return true;
 }
Exemple #5
0
 /// <summary>
 /// </summary>
 /// <param name="parent"> </param>
 /// <param name="title"> </param>
 public Page(Version parent, string title)
 {
     Title = title;
     _parent = parent;
     if (parent != null)
         _parent.Pages.Add(this);
     _items = new List<IOption>();
     _fillMode = FillMode.TopToBottom;
 }
        public IFillStyleInfo ProduceNewFillStyleInfo(
			Color FillColor,
			Color GradientColor,
			FillMode mode)
        {
            IFillStyleInfo NewFillStyle = new GDIFillStyle(
                FillColor, GradientColor, mode);
            return NewFillStyle;
        }
Exemple #7
0
		public GraphicsPath (PointF[] pts, byte[] types, FillMode fillMode)
		{
			if (pts == null)
				throw new ArgumentNullException ("pts");
			if (pts.Length != types.Length)
				throw new ArgumentException ("Invalid parameter passed. Number of points and types must be same.");

			Status status = GDIPlus.GdipCreatePath2 (pts, types, pts.Length, fillMode, out nativePath);
			GDIPlus.CheckStatus (status);
		}
Exemple #8
0
 public RenderInfo(Mesh mesh, int subset, Matrix transform, NJS_MATERIAL material, Texture texture, FillMode fillMode, BoundingSphere bounds)
 {
     Mesh = mesh;
     Subset = subset;
     Transform = transform;
     Material = material;
     Texture = texture;
     FillMode = fillMode;
     Bounds = bounds;
 }
Exemple #9
0
        public GraphicsPath(FillMode fillMode) {
            IntPtr nativePath = IntPtr.Zero;

            int status = SafeNativeMethods.Gdip.GdipCreatePath(unchecked((int)fillMode), out nativePath);

            if (status != SafeNativeMethods.Gdip.Ok)
                throw SafeNativeMethods.Gdip.StatusException(status);

            this.nativePath = nativePath;
        }
 public SmoothProgressBar()
 {
     InitializeComponent();
     m_min = 0;
     m_max = 100;
     m_value = 0;
     m_fillMode = FillMode.LEFT_TO_RIGHT;
     m_text = "";
     m_txtColor = SystemColors.WindowText;
 }
Exemple #11
0
        public static List<List<Vector2>> Combine(List<List<Vector2>> subjectPolygons, List<List<Vector2>> clippingPolygons,
                                                  FillMode subjectFillMode, FillMode clipFillMode, CombineMode combineMode, out PolyTree tree)
        {
            Clipper.Clear();
            Clipper.AddPaths(subjectPolygons, PolyType.ptSubject, true);
            Clipper.AddPaths(clippingPolygons, PolyType.ptClip, true);

            tree = new PolyTree();
            Clipper.Execute(combineMode.ToClipType(), tree, subjectFillMode.ToPolyFillType(), clipFillMode.ToPolyFillType());
            return Clipper.ClosedPathsFromPolyTree(tree);
        }
Exemple #12
0
        public static List<List<Vector2>> Simplify(List<Vector2> polygon, FillMode fillMode, out PolyTree tree)
        {
            Clipper.Clear();
            Clipper.AddPath(polygon, PolyType.ptSubject, true);
            Clipper.AddPath(polygon, PolyType.ptClip, true);

            tree = new PolyTree();
            PolyFillType fillType = fillMode.ToPolyFillType();
            Clipper.Execute(ClipType.ctUnion, tree, fillType, fillType);
            return Clipper.ClosedPathsFromPolyTree(tree);
        }
Exemple #13
0
 /// <summary>
 /// </summary>
 /// <param name="parent"> </param>
 /// <param name="title"> </param>
 public Version(Menu parent, string title)
 {
     Title = title;
     _parent = parent;
     if (parent != null)
         _parent.Versions.Add(this);
     _number = 0.0f;
     _items = new List<IOption>();
     _pages = new List<Page>();
     _fillMode = FillMode.TopToBottom;
 }
		/// <summary>
		/// Creates a new instance of the rasterizer state.
		/// </summary>
		/// <param name="cullMode"></param>
		/// <param name="fillMode"></param>
		/// <param name="depthBias"></param>
		/// <param name="slopeDepthBias"></param>
		/// <returns></returns>
		public static RasterizerState Create ( CullMode cullMode, FillMode fillMode = FillMode.Solid, int depthBias = 0, float slopeDepthBias = 0 )
		{
			var rs = new RasterizerState();
			rs.CullMode			=	cullMode;
			rs.DepthBias		=	depthBias;
			rs.SlopeDepthBias	=	slopeDepthBias;
			rs.MsaaEnabled		=	true;
			rs.FillMode			=	fillMode;
			rs.DepthClipEnabled	=	true;
			rs.ScissorEnabled	=	false;
			return rs;
		}
Exemple #15
0
        public static List<List<Vector2>> Outline(List<Vector2> polygon, FillMode fillMode, bool closed, StrokeStyle strokeStyle, float strokeWidth, out PolyTree tree)
        {
            List<List<Vector2>> simplified = Clipper.SimplifyPolygon(polygon, fillMode.ToPolyFillType());

            Offsetter.Clear();
            Offsetter.MiterLimit = strokeStyle.MiterLimit;
            Offsetter.AddPaths(simplified, (JoinType)strokeStyle.LineJoin, closed ? EndType.etClosedLine : strokeStyle.CapStyle.ToEndType());

            tree = new PolyTree();
            Offsetter.Execute(ref tree, strokeWidth / 2);
            return Clipper.ClosedPathsFromPolyTree(tree);
        }
 /// <summary>
 /// Sets default values for this instance.
 /// </summary>
 public void SetDefault()
 {
     CullMode = CullMode.Back;
     FillMode = FillMode.Solid;
     DepthClipEnable = true;
     FrontFaceCounterClockwise = false;
     ScissorTestEnable = false;
     MultiSampleAntiAlias = false;
     MultiSampleAntiAliasLine = false;
     DepthBias = 0;
     DepthBiasClamp = 0f;
     SlopeScaleDepthBias = 0f;
 }
	public GraphicsPath(Point[] pts, byte[] types, FillMode fillMode)
			{
				if(pts == null)
				{
					throw new ArgumentNullException("pts");
				}
				if(types == null)
				{
					throw new ArgumentNullException("types");
				}
				this.fillMode = fillMode;
				// TODO: convert the pts and types arrays
			}
        public static PolygonMode ConvertFillMode(FillMode fillMode)
        {
            // NOTE: Vulkan's PolygonMode.Point is not exposed

            switch (fillMode)
            {
                case FillMode.Solid:
                    return PolygonMode.Fill;
                case FillMode.Wireframe:
                    return PolygonMode.Line;
                default:
                    throw new ArgumentOutOfRangeException(nameof(fillMode));
            }
        }
        public Moving_Object(Graphics _Gmoving)
        {
            G_moving = _Gmoving;
            Moving_Matrix = new Matrix(1, 0, 0, 1, 0, 0);
            Robot_Center_Point_X = Robot_Width/2 + _Init_X;

            point1 = new Point(10, 10);
            point2 = new Point(10, 20);
            point3 = new Point(30, 15);
            curvePoints = new Point[3];
            curvePoints[0] = point1;
            curvePoints[1] = point2;
            curvePoints[2] = point3;
            newFillMode = FillMode.Winding;
        }
Exemple #20
0
        public GraphicsPath(PointF[] pts, byte[] types, FillMode fillMode)
        {
            if (pts == null)
            {
                throw new ArgumentNullException(nameof(pts));
            }
            if (pts.Length != types.Length)
            {
                throw new ArgumentException(SR.NumberOfPointsAndTypesMustBeSame);
            }

            int status = Gdip.GdipCreatePath2(pts, types, pts.Length, fillMode, out _nativePath);

            Gdip.CheckStatus(status);
        }
Exemple #21
0
        public GraphicsPath(Point[] pts, byte[] types, FillMode fillMode)
        {
            if (pts == null)
            {
                throw new ArgumentNullException("pts");
            }
            if (pts.Length != types.Length)
            {
                throw new ArgumentException("Invalid parameter passed. Number of points and types must be same.");
            }

            Status status = GDIPlus.GdipCreatePath2I(pts, types, pts.Length, fillMode, out nativePath);

            GDIPlus.CheckStatus(status);
        }
Exemple #22
0
        private void ShowResult(Sudoku solver, SolidColorBrush color)
        {
            FillMode oldMode = fillMode;

            fillMode = FillMode.None;
            forEachCell((row, col, box) =>
            {
                if (box.Text.Length == 0)
                {
                    int num        = solver.GetEntry(row, col);
                    box.Text       = num == NumberSet.UNKNOWN ? "" : Convert.ToString(num + 1, CULTURE);
                    box.Foreground = color;
                }
            });
            fillMode = oldMode;
        }
        public static VkPolygonMode ConvertFillMode(FillMode fillMode)
        {
            // NOTE: Vulkan's PolygonMode.Point is not exposed

            switch (fillMode)
            {
            case FillMode.Solid:
                return(VkPolygonMode.Fill);

            case FillMode.Wireframe:
                return(VkPolygonMode.Line);

            default:
                throw new ArgumentOutOfRangeException(nameof(fillMode));
            }
        }
        internal void Fill(FillMode mode)
        {
            switch (mode)
            {
            case FillMode.Alternate:
                Control.EOFillPath();
                break;

            case FillMode.Winding:
                Control.FillPath();
                break;

            default:
                throw new NotSupportedException();
            }
        }
Exemple #25
0
        internal void ModeBoxClicked(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = (CheckBox)sender;

            if (checkBox.IsChecked == true)
            {
                fillMode      = FillMode.Direct;
                currentInput  = getUserInput();
                currentSudoku = CreateSudoku(currentInput);
                ShowResult(currentSudoku, DIRECT_CONCLUSION);
            }
            else
            {
                fillMode = FillMode.None;
            }
        }
Exemple #26
0
        internal static VkPolygonMode FillModeToVkPolygonMode(this FillMode fillMode)
        {
            // TODO: Vulkan's PolygonMode.Point is not exposed

            switch (fillMode)
            {
            case FillMode.Solid:
                return(VkPolygonMode.Fill);

            case FillMode.Wireframe:
                return(VkPolygonMode.Line);

            default:
                throw new ArgumentOutOfRangeException(nameof(fillMode));
            }
        }
Exemple #27
0
        private void drawFullTriangleShape()
        {
            Point[] trianglePoints = createTrianglePoints();

            FillMode   newFillMode          = FillMode.Winding;
            SolidBrush myBrush              = new SolidBrush(ColorTranslator.FromHtml(colorsList[colorCounter]));
            Graphics   formGraphicsTriangle = CreateGraphics();

            formGraphicsTriangle.FillPolygon(myBrush, trianglePoints, newFillMode);
            formGraphicsTriangle.Dispose();
            colorCounter++;
            if (colorCounter == colorsList.Length)
            {
                colorCounter = 0;
            }
        }
Exemple #28
0
        /// <summary>
        /// Draw dynamically at runtime. This function will have poor-performance
        /// due to loading two vertices into the graphicsDevice memory
        /// and then throwing them away. For academic uses only, very expensive and slow.
        /// Use the non-static stuff in this class. An instance of this class is quicker than
        /// a bunch of arbitrary lines via this function.
        /// </summary>
        /// <param name="cullMode">Default is CullMode.None</param>
        /// <param name="fillMode">Default is FillMode.WireFrame</param>
        /// <param name="vertexColorsEnabled">Default is true.</param>
        static public void DrawLine(GraphicsDevice graphicsDevice,
                                    Vector3 point1, Color point1Color,
                                    Vector3 point2, Color point2Color,
                                    Matrix world,
                                    Matrix cameraView,
                                    Matrix cameraProjection,
                                    CullMode cullMode,
                                    FillMode fillMode,
                                    bool vertexColorsEnabled)
        {
            // Vertex data
            VertexPositionColor[] verts_static = new VertexPositionColor[2];
            verts_static[0] = new VertexPositionColor(point1, point1Color);
            verts_static[1] = new VertexPositionColor(point2, point2Color);
            VertexBuffer vertexBuffer_static = new VertexBuffer(graphicsDevice, typeof(VertexPositionColor),
                                                                2, BufferUsage.None);

            vertexBuffer_static.SetData <VertexPositionColor>(verts_static); // This line is why there is bad performance. Puts stuff into GPU memory.
            short[] vertexIndicies_static = new short[2];
            vertexIndicies_static[0] = 0;
            vertexIndicies_static[1] = 1;

            BasicEffect effect_static = new BasicEffect(graphicsDevice);
            // I had to make a localRS because assigning directly to the graphicsDevice.RasterizerState.properties
            // didn't work.
            RasterizerState localRS = new RasterizerState();

            localRS.CullMode = cullMode;
            localRS.FillMode = fillMode;
            graphicsDevice.RasterizerState = localRS;

            // Effect configuration
            effect_static.World              = world;
            effect_static.View               = cameraView;
            effect_static.Projection         = cameraProjection;
            effect_static.VertexColorEnabled = vertexColorsEnabled;


            foreach (EffectPass pass in effect_static.CurrentTechnique.Passes)
            {
                pass.Apply();
                graphicsDevice.DrawUserIndexedPrimitives <VertexPositionColor>(
                    PrimitiveType.LineList,
                    verts_static, 0, 2,
                    vertexIndicies_static, 0, 1);
            }
        }
Exemple #29
0
        public void FillPolygon(PointF[] points, FillMode fillMode)
        {
            if (Brush == null)
            {
                return;
            }
            var frame = Target.Frame();

            if (frame == null)
            {
                return;
            }

            var color = Brush.Color.ToArgb();

            SdfDraw.FillPolygon(frame, points, color, fillMode);
        }
        public RasterizerState(string name,
                               CullMode cullMode         = CullMode.CullCounterClockwiseFace,
                               FillMode fillMode         = FillMode.Solid,
                               float depthBias           = 0f,
                               bool multiSampleAntiAlias = true,
                               bool scissorTestEnable    = false,
                               float slopeScaleDepthBias = 0f)
        {
            Name = name;

            CullMode             = cullMode;
            FillMode             = fillMode;
            DepthBias            = depthBias;
            MultiSampleAntiAlias = multiSampleAntiAlias;
            ScissorTestEnable    = scissorTestEnable;
            SlopeScaleDepthBias  = slopeScaleDepthBias;
        }
Exemple #31
0
        private void Fill_SelectionChangeCommited(object sender, EventArgs e)
        {
            switch (fill.SelectedItem)
            {
            case "Unfilled":
                fMode = FillMode.unfilled;
                break;

            case "Filled":
                fMode = FillMode.filled;
                break;

            case "Gradient filled":
                fMode = FillMode.gradient;
                break;
            }
        }
        internal static VkPolygonMode ToFillMode(FillMode fillMode)
        {
            switch (fillMode)
            {
            case FillMode.Solid:
                return(VkPolygonMode.Fill);

            case FillMode.Wireframe:
                return(VkPolygonMode.Line);

            case FillMode.Point:
                return(VkPolygonMode.Point);

            default:
                throw new ArgumentOutOfRangeException(nameof(fillMode));
            }
        }
Exemple #33
0
        private void DrawStrike(Enemy res)
        {
            Canon    cannon   = CannonToShot(res);
            Graphics graphics = TheForm.CreateGraphics();

            Point[]           points = { new Point(cannon.Left + cannon.Width / 2 - 8, cannon.Top), new Point(cannon.Left + cannon.Width / 2 + 8, cannon.Top), new Point(res.Left + res.Width / 2 + 5, res.Top + res.Height / 2),
                                         new Point(res.Left + res.Width / 2 - 5,                 res.Top + res.Height / 2) };
            PathGradientBrush brush = new PathGradientBrush(points);

            brush.CenterPoint    = new Point(cannon.Left + cannon.Width / 2, cannon.Top);
            brush.CenterColor    = Color.DarkBlue;
            brush.SurroundColors = new[] { Color.White, Color.Violet };
            FillMode fillMode = FillMode.Winding;

            graphics.FillPolygon(brush, points, fillMode);
            TimerStrike.Start();
        }
Exemple #34
0
 public NumberRunElement(string currentFormat, string otherFormat, string seperatorFormat, bool collapseSeperators, bool collapseAdjacentElements, int firstNumber, string firstSeperator, int adjacentMin, int adjacentMax, int fillMin, int fillMax, FillMode fillMode, string lastSeperator, int lastNumber)
 {
     this.currentFormat            = currentFormat;
     this.otherFormat              = otherFormat;
     this.seperatorFormat          = seperatorFormat;
     this.collapseSeperators       = collapseSeperators;
     this.collapseAdjacentElements = collapseAdjacentElements;
     this.firstNumber              = firstNumber;
     this.firstSeperator           = firstSeperator;
     this.adjacentMin              = adjacentMin;
     this.adjacentMax              = adjacentMax;
     this.fillMin       = fillMin;
     this.fillMax       = fillMax;
     this.fillMode      = fillMode;
     this.lastSeperator = lastSeperator;
     this.lastNumber    = lastNumber;
 }
Exemple #35
0
        public unsafe GraphicsPath(Point[] pts, byte[] types, FillMode fillMode)
        {
            ArgumentNullException.ThrowIfNull(pts);

            if (pts.Length != types.Length)
            {
                throw Gdip.StatusException(Gdip.InvalidParameter);

                fixed(byte *t = types)
                fixed(Point * p = pts)
                {
                    Gdip.CheckStatus(Gdip.GdipCreatePath2I(
                                         p, t, types.Length, unchecked ((int)fillMode), out IntPtr nativePath));

                    _nativePath = nativePath;
                }
        }
Exemple #36
0
        private void clear(Predicate <TextBox> predicate)
        {
            FillMode oldMode = fillMode;

            fillMode = FillMode.None;
            forEachCell((row, col, box) =>
            {
                if (predicate.Invoke(box))
                {
                    box.Text = "";
                }
            });
            currentInput       = getUserInput();
            currentSudoku      = CreateSudoku(currentInput);
            stateLabel.Content = "";
            fillMode           = oldMode;
        }
        /// <summary>
        /// Display a helix handle.
        /// </summary>
        /// <returns>A new helix with any modifications applied.</returns>
        /// <param name="baseId">Base identifier. Each handle has its own unique hash based off this value.</param>
        /// <param name="helix">Helix.</param>
        /// <param name="origin">Origin.</param>
        /// <param name="orientation">Orientation.</param>
        /// <param name="scale">Scale.</param>
        /// <param name="color">Color.</param>
        /// <param name="divisions">Divisions.</param>
        /// <param name="fillMode">Fill mode.</param>
        /// <param name="shapeMode">Shape mode.</param>
        private static Helix DoHelixHandle(
            int baseId,
            Helix helix,
            Vector3 origin,
            Quaternion orientation,
            Vector3 scale,
            Color color,
            int divisions,
            FillMode fillMode,
            ShapeMode shapeMode
            )
        {
            // early out if the scale is too small
            if (scale.sqrMagnitude < s_RequiredMinHandleChange)
            {
                Debug.LogWarning("Scale vector for helix handle is too close to 0. Handle is disabled");
                return(null);
            }
            // create copy of helix
            helix = new Helix(helix);
            // store the handle matrix
            Matrix4x4 oldMatrix = Handles.matrix;

            Handles.matrix *= Matrix4x4.TRS(origin, orientation, scale);
            // set the helix handle's color
            Color oldColor = Handles.color;

            Handles.color = color;
            // validate the number of divisions
            divisions = Mathf.Max(1, divisions);
            // create a handle to adjust length
            DoHelixLengthHandle(baseId, helix);
            // next, create handles for the twist curve
            DoHelixTwistHandles(baseId, helix);
            // next, create handles for the width curve
            DoHelixWidthHandles(baseId, helix);
            // draw lines to visualize the helix
            DrawHelix(helix, divisions, fillMode, shapeMode);
            // reset handle color
            Handles.color = oldColor;
            // reset handle matrix
            Handles.matrix = oldMatrix;
            // return result
            return(helix);
        }
Exemple #38
0
        public static RasterizerState CreateRasterizerState(Device device, FillMode fillMode, CullMode cullMode, bool depthClipEnable, bool scissorEnable, bool multisampleEnable, int depthBias, float depthBiasClamp, float slopeScaledDepthBias)
        {
            RasterizerStateDescription drd = new RasterizerStateDescription();

            drd.FillMode = fillMode;                             //D3D11_FILL_MODE FillMode;
            drd.CullMode = cullMode;                             //D3D11_CULL_MODE CullMode;
            drd.IsFrontCounterClockwise = false;                 //BOOL FrontCounterClockwise;
            drd.DepthBias                = depthBias;            //INT DepthBias;
            drd.DepthBiasClamp           = depthBiasClamp;       //FLOAT DepthBiasClamp;
            drd.SlopeScaledDepthBias     = slopeScaledDepthBias; //FLOAT SlopeScaledDepthBias;
            drd.IsDepthClipEnabled       = depthClipEnable;      //BOOL DepthClipEnable;
            drd.IsScissorEnabled         = scissorEnable;        //BOOL ScissorEnable;
            drd.IsMultisampleEnabled     = multisampleEnable;    //BOOL MultisampleEnable;
            drd.IsAntialiasedLineEnabled = false;                //BOOL AntialiasedLineEnable;
            RasterizerState rs = new RasterizerState(device, drd);

            return(rs);
        }
Exemple #39
0
        public GraphicNode(String tag, String path, Guid modelGuid, Stencil stencil, Rectangle boundingRect,
                           Double angle, Rectangle tagArea, Double tagAngle, Font tagFont, Boolean tagVisible, Double opacity,
                           System.Drawing.Color fillColor, FillMode fillMode, bool mirrorX, bool mirrorY)
            : base(tag, tagArea, tagAngle, tagFont, tagVisible, opacity)
        {
            this.path = path;

            this.modelGuid = modelGuid;
            this.stencil   = stencil;

            this.boundingRect = boundingRect;
            this.angle        = angle;

            this.fillColor = fillColor;
            this.fillMode  = fillMode;
            this.mirrorX   = mirrorX;
            this.mirrorY   = mirrorY;
        }
Exemple #40
0
    public GraphicNode(String tag, String path, Guid modelGuid, Stencil stencil, Rectangle boundingRect,
      Double angle, Rectangle tagArea, Double tagAngle, Font tagFont, Boolean tagVisible, Double opacity,
      System.Drawing.Color fillColor, FillMode fillMode, bool mirrorX, bool mirrorY)
      : base(tag, tagArea, tagAngle, tagFont, tagVisible, opacity)
    {
      this.path = path;

      this.modelGuid = modelGuid;
      this.stencil = stencil;

      this.boundingRect = boundingRect;
      this.angle = angle;

      this.fillColor = fillColor;
      this.fillMode = fillMode;
      this.mirrorX = mirrorX;
      this.mirrorY = mirrorY;
    }
Exemple #41
0
        private void btnZalivkaPolygon_Click(object sender, EventArgs e)
        {
            panelCanvas.Refresh();
            HatchBrush hBrush = new HatchBrush(HatchStyle.DarkUpwardDiagonal, Color.DarkGoldenrod, Color.Crimson);
            PointF     point1 = new PointF(0.0F, 0.0F);
            PointF     point2 = new PointF(100.0F, 25.0F);
            PointF     point3 = new PointF(200.0F, 5.0F);
            PointF     point4 = new PointF(250.0F, 50.0F);
            PointF     point5 = new PointF(300.0F, 100.0F);
            PointF     point6 = new PointF(350.0F, 200.0F);
            PointF     point7 = new PointF(200.0F, 200.0F);
            PointF     point8 = new PointF(130.0F, 230.0F);

            PointF[] curvePoints = new[] { point1, point2, point3, point4, point5, point6, point7, point8 };
            FillMode newFillMode = FillMode.Winding;

            panelCanvas.CreateGraphics().FillPolygon(hBrush, curvePoints, newFillMode);
        }
        public AnimationInstance(Animation animation, Animatable control, Animator <T> animator, IClock baseClock, Action OnComplete, Func <double, T, T> Interpolator)
        {
            if (animation.SpeedRatio <= 0)
            {
                throw new InvalidOperationException("Speed ratio cannot be negative or zero.");
            }

            if (animation.Duration.TotalSeconds <= 0)
            {
                throw new InvalidOperationException("Duration cannot be negative or zero.");
            }

            _parent        = animator;
            _easeFunc      = animation.Easing;
            _targetControl = control;
            _neutralValue  = (T)_targetControl.GetValue(_parent.Property);

            _speedRatio = animation.SpeedRatio;

            _delay          = animation.Delay;
            _duration       = animation.Duration;
            _iterationDelay = animation.DelayBetweenIterations;

            switch (animation.RepeatCount.RepeatType)
            {
            case RepeatType.None:
                _repeatCount = 1;
                break;

            case RepeatType.Loop:
                _isLooping = true;
                break;

            case RepeatType.Repeat:
                _repeatCount = (long)animation.RepeatCount.Value;
                break;
            }

            _animationDirection = animation.PlaybackDirection;
            _fillMode           = animation.FillMode;
            _onCompleteAction   = OnComplete;
            _interpolator       = Interpolator;
            _baseClock          = baseClock;
        }
            public void Draw(GraphicsHandler graphics, bool stroke, FillMode fillMode, bool clip)
            {
                var start = StartPoint;
                var end   = EndPoint;
                var rect  = graphics.Control.GetPathBoundingBox().ToEto();

                if (stroke)
                {
                    graphics.Control.ReplacePathWithStrokedPath();
                }
                if (clip)
                {
                    graphics.Clip(fillMode);
                }

                if (transform != null)
                {
                    start = transform.TransformPoint(start);
                    end   = transform.TransformPoint(end);
                }

                if (wrap == GradientWrapMode.Pad)
                {
                    if (Gradient == null)
                    {
                        Gradient = new CGGradient(CGColorSpace.CreateDeviceRGB(), new [] { StartColor, EndColor }, new nfloat[] { (nfloat)0f, (nfloat)1f });
                    }
                }
                else
                {
                    var scale = GradientHelper.GetLinearScale(ref start, ref end, rect, lastScale, wrap == GradientWrapMode.Reflect ? 2f : 1f);

                    if (Gradient == null || scale > lastScale)
                    {
                        var stops = GradientHelper.GetGradientStops(StartColor, EndColor, scale, wrap).ToList();
                        Gradient  = new CGGradient(CGColorSpace.CreateDeviceRGB(), stops.Select(r => r.Item2).ToArray(), stops.Select(r => (nfloat)r.Item1).ToArray());
                        lastScale = scale;
                    }
                }

                var context = graphics.Control;

                context.DrawLinearGradient(Gradient, start.ToNS(), end.ToNS(), CGGradientDrawingOptions.DrawsAfterEndLocation | CGGradientDrawingOptions.DrawsBeforeStartLocation);
            }
Exemple #44
0
 /// <summary>
 /// Default constructor sets all attributes to their default value.
 /// Use DefaultAttributes to access an instance of this.
 /// </summary>
 private GraphicAttributes()
 {
     Color            = RGB.Black;
     Opacity          = 1.0;
     AntiGrain        = false;
     Hatch            = Hatch.Cross;
     FillStyle        = FillStyle.Solid;
     LineWidth        = 0.0;
     LineStyle        = LineStyle.Continuous;
     LineStyleDashes  = Painter.DefaultLineStyleDashes;
     EndCaps          = EndCap.Flat;
     LineJoin         = LineJoin.Bevel;
     Pattern          = null;
     Transform        = Transform2d.Identity;
     Clip             = null;
     PatternTransform = Transform2d.Identity;
     FillMode         = FillMode.EvenOdd;
     Font             = null;
 }
Exemple #45
0
        public unsafe GraphicsPath(PointF[] pts, byte[] types, FillMode fillMode)
        {
            if (pts == null)
            {
                throw new ArgumentNullException(nameof(pts));
            }
            if (pts.Length != types.Length)
            {
                throw Gdip.StatusException(Gdip.InvalidParameter);

                fixed(PointF *p = pts)
                fixed(byte *t = types)
                {
                    Gdip.CheckStatus(Gdip.GdipCreatePath2(
                                         p, t, types.Length, (int)fillMode, out IntPtr nativePath));

                    _nativePath = nativePath;
                }
        }
Exemple #46
0
        // </snippet93>


        // Snippet for: M:System.Drawing.Graphics.FillClosedCurve(System.Drawing.Brush,System.Drawing.Point[],System.Drawing.Drawing2D.FillMode)
        // <snippet94>
        public void FillClosedCurvePointFillMode(PaintEventArgs e)
        {
            // Create solid brush.
            SolidBrush redBrush = new SolidBrush(Color.Red);

            //Create array of points for curve.
            Point point1 = new Point(100, 100);
            Point point2 = new Point(200, 50);
            Point point3 = new Point(250, 200);
            Point point4 = new Point(50, 150);

            Point[] points = { point1, point2, point3, point4 };

            // Set fill mode.
            FillMode newFillMode = FillMode.Winding;

            // Fill curve on screen.
            e.Graphics.FillClosedCurve(redBrush, points, newFillMode);
        }
Exemple #47
0
        public void Draw(Device device)
        {
            FillMode      mode      = device.RenderState.FillMode;
            TextureFilter magfilter = device.SamplerState[0].MagFilter;
            TextureFilter minfilter = device.SamplerState[0].MinFilter;
            TextureFilter mipfilter = device.SamplerState[0].MipFilter;

            Material.SetDeviceStates(device, Texture, Transform, FillMode);

            if (Mesh != null)
            {
                Mesh.DrawSubset(Subset);
            }
            device.RenderState.Ambient       = System.Drawing.Color.Black;
            device.RenderState.FillMode      = mode;
            device.SamplerState[0].MagFilter = magfilter;
            device.SamplerState[0].MinFilter = minfilter;
            device.SamplerState[0].MipFilter = mipfilter;
        }
Exemple #48
0
 public GraphicAttributes(Painter p)
 {
     Color            = p.Color;
     Opacity          = p.Opacity;
     AntiGrain        = p.AntiGrain;
     Hatch            = p.Hatch;
     FillStyle        = p.FillStyle;
     LineWidth        = p.LineWidth;
     LineStyle        = p.LineStyle;
     LineStyleDashes  = p.LineStyleDashes;
     EndCaps          = p.EndCaps;
     LineJoin         = p.LineJoin;
     Pattern          = p.Pattern;
     Transform        = p.Transform;
     Clip             = p.Clip;
     PatternTransform = p.PatternTransform;
     FillMode         = p.FillMode;
     Font             = p.Font;
 }
        public void Draw(Device device)
        {
            FillMode      mode      = device.GetRenderState <FillMode>(RenderState.FillMode);
            TextureFilter magfilter = device.GetSamplerState <TextureFilter>(0, SamplerState.MagFilter);
            TextureFilter minfilter = device.GetSamplerState <TextureFilter>(0, SamplerState.MinFilter);
            TextureFilter mipfilter = device.GetSamplerState <TextureFilter>(0, SamplerState.MipFilter);

            Material.SetDeviceStates(device, Texture, Transform, FillMode);

            if (Mesh != null)
            {
                Mesh.DrawSubset(device, Subset);
            }
            device.SetRenderState(RenderState.Ambient, System.Drawing.Color.Black.ToArgb());
            device.SetRenderState(RenderState.FillMode, mode);
            device.SetSamplerState(0, SamplerState.MagFilter, magfilter);
            device.SetSamplerState(0, SamplerState.MinFilter, minfilter);
            device.SetSamplerState(0, SamplerState.MipFilter, mipfilter);
        }
Exemple #50
0
    public void dibujarPlanoCuadrado()
    {
        // metodo 1
        punto3D p1 = new punto3D(100, 100, 150);
        punto3D p2 = new punto3D(200, 100, 150);
        punto3D p3 = new punto3D(200, 200, 150);
        punto3D p4 = new punto3D(100, 200, 150);

        dibujarLinea(p1, p2);
        dibujarLinea(p2, p3);
        dibujarLinea(p3, p4);
        dibujarLinea(p4, p1);
        // metodo 2
        dibujarLinea(p1.X, p1.Y, p1.Z, p2.X, p2.Y, p2.Z);
        dibujarLinea(p2.X, p2.Y, p2.Z, p3.X, p3.Y, p3.Z);
        dibujarLinea(p3.X, p3.Y, p3.Z, p4.X, p4.Y, p4.Z);
        dibujarLinea(p4.X, p4.Y, p4.Z, p1.X, p1.Y, p1.Z);

        // dibujar el relleno
        punto2D pun1 = new punto2D(p1.X, p1.Y, p1.Z);
        punto2D pun2 = new punto2D(p2.X, p2.Y, p2.Z);
        punto2D pun3 = new punto2D(p3.X, p3.Y, p3.Z);
        punto2D pun4 = new punto2D(p4.X, p4.Y, p4.Z);
        // Create solid brush.
        SolidBrush blueBrush = new SolidBrush(Color.FromArgb(150, 23, 56, 78));
        // Color.FromArgb(127, 23, 56, 78) 127=transparencia, 23=rojo, 56=verde, 78=azul;
        // todos los valores comprendidos entre 0 y 255, (0, 255)
        // Color.Blue

        // Create points that define polygon.
        PointF point1 = new PointF(pun1.xr, pun1.yr);
        PointF point2 = new PointF(pun2.xr, pun2.yr);
        PointF point3 = new PointF(pun3.xr, pun3.yr);
        PointF point4 = new PointF(pun4.xr, pun4.yr);

        PointF[] curvePoints = { point1, point2, point3, point4 };

        // Define fill mode.
        FillMode newFillMode = FillMode.Winding;     // FillMode.Alternate y FillMode.Winding

        // Fill polygon to screen.
        grafico.FillPolygon(blueBrush, curvePoints, newFillMode);
    }
Exemple #51
0
 public static void Draw(SpriteBatch SpriteBatch, GameTime gameTime, Matrix SpriteScaleMatrix)
 {
     _PreviousFillMode = SpriteBatch.GraphicsDevice.RenderState.FillMode;
     SpriteBatch.GraphicsDevice.RenderState.FillMode = FillMode.Solid;
     /*Before Drawing Check our FPS*/
     _fpsTimer += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
     if (_fpsTimer >= _fpsDelay)
     {
         /*Old Deprecated Method Fraps will report this correctly however only with FixedTimeStep Disabled*/
         //_dFPS = (1000.0f / gameTime.ElapsedGameTime.TotalMilliseconds);
         //_dFPS = Math.Round(_dFPS, 0);
         //_FPS.Text = ("FPS: ") + (_dFPS);
         _FPS.Text = "FPS: " + _iFramesThisSecond;
         if (_iFramesThisSecond >= 60)
             _FPS.Color = Color.Green;
         else
             if (_iFramesThisSecond <= 45 && _iFramesThisSecond > 30)
                 _FPS.Color = Color.Yellow;
             else
                 if (_iFramesThisSecond <= 30)
                     _FPS.Color = Color.Red;
         _fpsTimer = 0.0f;
         _iFramesThisSecond = 0;
     }
     //SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, SpriteScaleMatrix);
     mGraphics.Peek.ToggleSpriteDraw();
     SpriteBatch.Draw(_t2dBackground, _BarBounds, Color.White);
     for (int i = 0; i < DebugContainer.Count; i++)
     {
         SpriteBatch.DrawString(_spfDebug, DebugContainer[i].Text, DebugContainer[i].Position + BarPosition, DebugContainer[i].Color);
     }
     mGraphics.Peek.ToggleSpriteDraw();
     SpriteBatch.GraphicsDevice.RenderState.FillMode = _PreviousFillMode;
 }
        // according to MSDN fillmode "is required but ignored" which makes _some_ sense since the unmanaged
        // GDI+ call doesn't support it (issue spotted using Gendarme's AvoidUnusedParametersRule)
        public void FillClosedCurve(Brush brush, Point [] points, FillMode fillmode, float tension = 0.5f)
        {
            if (brush == null)
                throw new ArgumentNullException ("brush");
            if (points == null)
                throw new ArgumentNullException ("points");

            FillClosedCurve(brush,points,FillMode.Alternate);
        }
        // according to MSDN fillmode "is required but ignored" which makes _some_ sense since the unmanaged
        // GDI+ call doesn't support it (issue spotted using Gendarme's AvoidUnusedParametersRule)
        public void DrawClosedCurve(Pen pen, PointF [] points, float tension, FillMode fillmode)
        {
            if (pen == null)
                throw new ArgumentNullException ("pen");
            if (points == null)
                throw new ArgumentNullException ("points");

            int count = points.Length;
            if (count == 2)
                DrawPolygon (pen, points);
            else {
                int segments = (count > 3) ? (count-1) : (count-2);

                var tangents = GeomUtilities.GetCurveTangents (GraphicsPath.CURVE_MIN_TERMS, points, count, tension, CurveType.Close);
                MakeCurve (points, tangents, 0, segments, CurveType.Close);
                StrokePen (pen);
            }
        }
        // according to MSDN fillmode "is required but ignored" which makes _some_ sense since the unmanaged
        // GDI+ call doesn't support it (issue spotted using Gendarme's AvoidUnusedParametersRule)
        public void DrawClosedCurve(Pen pen, Point [] points, float tension, FillMode fillmode)
        {
            if (pen == null)
                throw new ArgumentNullException ("pen");
            if (points == null)
                throw new ArgumentNullException ("points");

            DrawClosedCurve (pen, ConvertPoints (points), tension, fillmode);
        }
 void FillBrush(Brush brush, FillMode fillMode = FillMode.Alternate)
 {
     brush.Setup (this, true);
     if (fillMode == FillMode.Alternate)
         context.EOFillPath ();
     else
         context.FillPath ();
 }
        public void FillPolygon(Brush brush, PointF [] points, FillMode fillMode = FillMode.Alternate)
        {
            if (brush == null)
                throw new ArgumentNullException ("brush");
            if (points == null)
                throw new ArgumentNullException ("points");

            PolygonSetup (points);
            FillBrush (brush, fillMode);
        }
        // according to MSDN fillmode "is required but ignored" which makes _some_ sense since the unmanaged
        // GDI+ call doesn't support it (issue spotted using Gendarme's AvoidUnusedParametersRule)
        public void FillClosedCurve(Brush brush, PointF [] points, FillMode fillmode, float tension = 0.5f)
        {
            if (brush == null)
                throw new ArgumentNullException ("brush");
            if (points == null)
                throw new ArgumentNullException ("points");

            int count = points.Length;
            if (count == 2)
                FillPolygon(brush, points, FillMode.Alternate);
            else {
                int segments = (count > 3) ? (count-1) : (count-2);

                var tangents = GeomUtilities.GetCurveTangents (GraphicsPath.CURVE_MIN_TERMS, points, count, tension, CurveType.Close);
                MakeCurve (points, tangents, 0, segments, CurveType.Close);
                FillBrush(brush);
            }
        }
Exemple #58
0
 void SimplifiedGeometrySink.SetFillMode(FillMode fillMode)
 {
 }
 /// <summary>
 /// Specifies the method used to determine which points are inside the geometry described by this geometry sink  and which points are outside.
 /// </summary>
 /// <param name="fillMode">The method used to determine whether a given point is part of the geometry.</param>
 /// <remarks>
 /// The fill mode defaults to <see cref="SharpDX.Direct2D1.FillMode.Alternate"/>. To set the fill mode, call <strong>SetFillMode</strong> before the first call to <strong>BeginFigure</strong>. Not doing will put the geometry sink in an error state.
 /// </remarks>
 public void SetFillMode(FillMode fillMode)
 {
     SetFillMode_(fillMode);
 }
 public void FillPolygon(Brush brush, Point [] points, FillMode fillMode = FillMode.Alternate)
 {
     FillPolygon (brush, ConvertPoints (points), fillMode);
 }