示例#1
0
        /// <summary>
        /// Creates a new LwPolyline that is a copy of the current instance.
        /// </summary>
        /// <returns>A new LwPolyline that is a copy of this instance.</returns>
        public override Object Clone()
        {
            LwPolyline entity = new LwPolyline
            {
                //EntityObject properties
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                IsVisible     = IsVisible,
                //LwPolyline properties
                Elevation = elevation,
                Thickness = thickness,
                Flags     = flags
            };

            foreach (LwPolylineVertex vertex in vertexes)
            {
                entity.Vertexes.Add((LwPolylineVertex)vertex.Clone());
            }

            foreach (XData data in XData.Values)
            {
                entity.XData.Add((XData)data.Clone());
            }

            return(entity);
        }
示例#2
0
        /// <summary>
        /// Creates a new Arc that is a copy of the current instance.
        /// </summary>
        /// <returns>A new Arc that is a copy of this instance.</returns>
        public override object Clone()
        {
            Arc entity = new Arc
            {
                //EntityObject properties
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                IsVisible     = IsVisible,
                //Arc properties
                Center     = center,
                Radius     = radius,
                StartAngle = startAngle,
                EndAngle   = endAngle,
                Thickness  = thickness
            };

            foreach (XData data in XData.Values)
            {
                entity.XData.Add((XData)data.Clone());
            }

            return(entity);
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <c>Attribute</c> class.
        /// </summary>
        /// <param name="definition"><see cref="AttributeDefinition">Attribute definition</see>.</param>
        public Attribute(AttributeDefinition definition)
            : base(DxfObjectCode.Attribute)
        {
            if (definition == null)
            {
                throw new ArgumentNullException(definition.GetType().Name);
            }

            this.color         = definition.Color;
            this.layer         = definition.Layer;
            this.linetype      = definition.Linetype;
            this.lineweight    = definition.Lineweight;
            this.linetypeScale = definition.LinetypeScale;
            this.transparency  = definition.Transparency;
            this.isVisible     = definition.IsVisible;
            this.normal        = definition.Normal;

            this.definition   = definition;
            this.tag          = definition.Tag;
            this.attValue     = definition.Value;
            this.style        = definition.Style;
            this.position     = definition.Position;
            this.flags        = definition.Flags;
            this.height       = definition.Height;
            this.widthFactor  = definition.WidthFactor;
            this.obliqueAngle = definition.ObliqueAngle;
            this.rotation     = definition.Rotation;
            this.alignment    = definition.Alignment;
        }
示例#4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Address,Time,Amount,Reason,TxHash,Active,CreateDate")] Transparency transparency)
        {
            if (id != transparency.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(transparency);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TransparencyExists(transparency.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(transparency));
        }
示例#5
0
        //public override void TransformBy2(Matrix3 transformation, Vector3 translation)
        //{
        //    Vector3 newCenter;
        //    Vector3 newNormal;
        //    double newMajorAxis;
        //    double newMinorAxis;
        //    double newRotation;

        //    newCenter = transformation * this.Center + translation;
        //    newNormal = transformation * this.Normal;

        //    Matrix3 transOW = MathHelper.ArbitraryAxis(this.Normal);
        //    transOW *= Matrix3.RotationZ(this.Rotation * MathHelper.DegToRad);

        //    Matrix3 transWO = MathHelper.ArbitraryAxis(newNormal);
        //    transWO = transWO.Transpose();

        //    Vector3 v = transOW * Vector3.UnitX;
        //    v = transformation * v;
        //    v = transWO * v;
        //    double angle = Vector2.Angle(new Vector2(v.X, v.Y));

        //    newRotation = angle * MathHelper.RadToDeg;

        //    transWO = Matrix3.RotationZ(newRotation * MathHelper.DegToRad).Transpose() * transWO;

        //    Vector3 s = transOW * new Vector3(this.MajorAxis, this.MinorAxis, 0.0);
        //    s = transformation * s;
        //    s = transWO * s;

        //    newMajorAxis = s.X <= 0 ? MathHelper.Epsilon : s.X;
        //    newMinorAxis = s.Y <= 0 ? MathHelper.Epsilon : s.Y;

        //    this.Center = newCenter;
        //    this.Normal = newNormal;
        //    this.Rotation = newRotation;
        //    if (newMinorAxis > newMajorAxis)
        //    {
        //        this.MajorAxis = newMinorAxis;
        //        this.MinorAxis = newMajorAxis;
        //    }
        //    else
        //    {
        //        this.MajorAxis = newMajorAxis;
        //        this.MinorAxis = newMinorAxis;
        //    }
        //}

        /// <summary>
        /// Creates a new Ellipse that is a copy of the current instance.
        /// </summary>
        /// <returns>A new Ellipse that is a copy of this instance.</returns>
        public override object Clone()
        {
            Ellipse entity = new Ellipse
            {
                //EntityObject properties
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                IsVisible     = IsVisible,
                //Ellipse properties
                Center     = center,
                MajorAxis  = majorAxis,
                MinorAxis  = minorAxis,
                Rotation   = rotation,
                StartAngle = startAngle,
                EndAngle   = endAngle,
                Thickness  = thickness
            };

            foreach (XData data in XData.Values)
            {
                entity.XData.Add((XData)data.Clone());
            }

            return(entity);
        }
示例#6
0
        bool CheckAdjacent(int x, int y, int z, Direction direction, Transparency transparency)
        {
            // returns true if a face should be spawned
            Index  idx           = _chunk.GetAdjacentIndex(x, y, z, direction);
            ushort adjacentVoxel = _chunk.GetVoxel(idx);

            if (adjacentVoxel == ushort.MaxValue)
            {
                bool neighborChunkIsMissing = Engine.ShowBorderFaces || direction == Direction.up;
                return(neighborChunkIsMissing);
            }

            Transparency result = Engine.GetVoxelType(adjacentVoxel).VTransparency; // get the transparency of the adjacent voxel

            // parse the result (taking into account the transparency of the adjacent block as well as the one doing this check)
            if (transparency == Transparency.transparent)
            {
                return(result != Transparency.transparent);
                // don't draw a transparent block next to another transparent block
                // draw a transparent block next to a solid or semi-transparent
            }
            else
            {
                return(result != Transparency.solid);
                // don't draw a solid block or a semi-transparent block next to a solid block
                // draw a solid block or a semi-transparent block next to both transparent and semi-transparent
            }
        }
示例#7
0
        /// <summary>
        /// Creates a new Hatch that is a copy of the current instance.
        /// </summary>
        /// <returns>A new Hatch that is a copy of this instance.</returns>
        /// <remarks>If the hatch is associative the referenced boundary entities will not be automatically cloned. Use CreateBoundary if required.</remarks>
        public override object Clone()
        {
            Hatch entity = new Hatch((HatchPattern)pattern.Clone(), associative)
            {
                //EntityObject properties
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                IsVisible     = IsVisible,
                //Hatch properties
                Elevation = elevation
            };

            foreach (HatchBoundaryPath path in boundaryPaths)
            {
                entity.boundaryPaths.Add((HatchBoundaryPath)path.Clone());
            }

            foreach (XData data in XData.Values)
            {
                entity.XData.Add((XData)data.Clone());
            }

            return(entity);
        }
示例#8
0
        public override object Clone()
        {
            Shape entity = new Shape(name, (ShapeStyle)style.Clone())
            {
                //EntityObject properties
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                IsVisible     = IsVisible,
                //Shape properties
                Position     = position,
                Size         = size,
                Rotation     = rotation,
                ObliqueAngle = obliqueAngle,
                Thickness    = thickness
            };

            foreach (XData data in XData.Values)
            {
                entity.XData.Add((XData)data.Clone());
            }

            return(entity);
        }
示例#9
0
        /// <summary>
        /// Creates a new Underlay that is a copy of the current instance.
        /// </summary>
        /// <returns>A new Underlay that is a copy of this instance.</returns>
        public override object Clone()
        {
            Underlay entity = new Underlay
            {
                //EntityObject properties
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                IsVisible     = IsVisible,
                //Underlay properties
                Definition       = (UnderlayDefinition)definition.Clone(),
                Position         = position,
                Scale            = scale,
                Rotation         = rotation,
                Contrast         = contrast,
                Fade             = fade,
                DisplayOptions   = displayOptions,
                ClippingBoundary = clippingBoundary != null ? (ClippingBoundary)clippingBoundary.Clone() : null
            };

            foreach (XData data in XData.Values)
            {
                entity.XData.Add((XData)data.Clone());
            }

            return(entity);
        }
示例#10
0
        /// <summary>
        /// Creates a new Line that is a copy of the current instance.
        /// </summary>
        /// <returns>A new Line that is a copy of this instance.</returns>
        public override object Clone()
        {
            Line entity = new Line
            {
                //EntityObject properties
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                IsVisible     = IsVisible,
                //Line properties
                StartPoint = start,
                EndPoint   = end,
                Thickness  = thickness
            };

            foreach (XData data in XData.Values)
            {
                entity.XData.Add((XData)data.Clone());
            }

            return(entity);
        }
示例#11
0
 protected DrawContext(DrawContext from)
 {
     this.image_0               = from.image_0;
     this.graphics_0            = from.graphics_0;
     this.dxfModel_0            = from.dxfModel_0;
     this.dxfLayout_0           = from.dxfLayout_0;
     this.graphicsConfig_0      = from.graphicsConfig_0;
     this.dxfLayer_0            = from.dxfLayer_0;
     this.dxfLayer_1            = from.dxfLayer_1;
     this.dxfEntity_0           = from.dxfEntity_0;
     this.dxfBlock_0            = from.dxfBlock_0;
     this.drawContext_0         = from.drawContext_0;
     this.dxfEntity_1           = from.dxfEntity_1;
     this.entityColor_0         = from.entityColor_0;
     this.transparency_0        = from.transparency_0;
     this.dxfColor_0            = from.dxfColor_0;
     this.dxfLineType_0         = from.dxfLineType_0;
     this.short_0               = from.short_0;
     this.int_0                 = from.int_0;
     this.int_1                 = from.int_1;
     this.dxfWipeoutVariables_0 = from.dxfWipeoutVariables_0;
     this.dictionary_0          = from.dictionary_0;
     this.double_0              = from.double_0;
     this.double_1              = from.double_1;
 }
示例#12
0
        /// <summary>
        /// Creates a new Attribute that is a copy of the current instance.
        /// </summary>
        /// <returns>A new Attribute that is a copy of this instance.</returns>
        public object Clone()
        {
            Attribute entity = new Attribute
            {
                //EntityObject properties
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                IsVisible     = isVisible,
                //Attribute properties
                Definition   = (AttributeDefinition)definition?.Clone(),
                Tag          = tag,
                Height       = height,
                WidthFactor  = widthFactor,
                ObliqueAngle = obliqueAngle,
                Value        = attValue,
                Style        = style,
                Position     = position,
                Flags        = flags,
                Rotation     = rotation,
                Alignment    = alignment
            };

            return(entity);
        }
示例#13
0
        /// <summary>
        /// Converts the arc in a Polyline.
        /// </summary>
        /// <param name="precision">Number of divisions.</param>
        /// <returns>A new instance of <see cref="LwPolyline">LightWeightPolyline</see> that represents the arc.</returns>
        public LwPolyline ToPolyline(int precision)
        {
            IEnumerable <Vector2> vertexes = PolygonalVertexes(precision);
            Vector3 ocsCenter = MathHelper.Transform(center, Normal, CoordinateSystem.World, CoordinateSystem.Object);

            LwPolyline poly = new LwPolyline
            {
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                Elevation     = ocsCenter.Z,
                Thickness     = Thickness,
                IsClosed      = false
            };

            foreach (Vector2 v in vertexes)
            {
                poly.Vertexes.Add(new LwPolylineVertex(v.X + ocsCenter.X, v.Y + ocsCenter.Y));
            }
            return(poly);
        }
示例#14
0
 public void imethod_26(
     out EntityColor color,
     out Transparency transparency,
     out bool isColorBookColor)
 {
     this.interface30_0.imethod_26(out color, out transparency, out isColorBookColor);
 }
示例#15
0
        /// <summary>
        /// Creates a new MLine that is a copy of the current instance.
        /// </summary>
        /// <returns>A new MLine that is a copy of this instance.</returns>
        public override object Clone()
        {
            MLine entity = new MLine
            {
                //EntityObject properties
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                IsVisible     = IsVisible,
                //MLine properties
                Elevation     = elevation,
                Scale         = scale,
                Justification = justification,
                Style         = (MLineStyle)style.Clone(),
                Flags         = flags
            };

            foreach (MLineVertex vertex in vertexes)
            {
                entity.vertexes.Add((MLineVertex)vertex.Clone());
            }

            foreach (XData data in XData.Values)
            {
                entity.XData.Add((XData)data.Clone());
            }

            return(entity);
        }
示例#16
0
        /// <summary>
        /// Initializes a new instance of the <c>AttributeDefinition</c> class.
        /// </summary>
        /// <param name="tag">Attribute identifier.</param>
        /// <param name="textHeight">Height of the attribute definition text.</param>
        /// <param name="style">Attribute <see cref="TextStyle">text style</see>.</param>
        public AttributeDefinition(string tag, double textHeight, TextStyle style)
            : base(DxfObjectCode.AttributeDefinition)
        {
            if (string.IsNullOrEmpty(tag))
            {
                throw new ArgumentNullException(nameof(tag));
            }

            this.tag      = tag;
            this.flags    = AttributeFlags.None;
            this.prompt   = string.Empty;
            this.attValue = null;
            this.position = Vector3.Zero;
            this.style    = style ?? throw new ArgumentNullException(nameof(style));
            if (textHeight <= 0.0)
            {
                throw new ArgumentOutOfRangeException(nameof(textHeight), this.attValue, "The attribute definition text height must be greater than zero.");
            }
            this.height        = textHeight;
            this.width         = 1.0;
            this.widthFactor   = style.WidthFactor;
            this.obliqueAngle  = style.ObliqueAngle;
            this.rotation      = 0.0;
            this.alignment     = TextAlignment.BaselineLeft;
            this.isBackward    = false;
            this.isUpsideDown  = false;
            this.color         = AciColor.ByLayer;
            this.layer         = Layer.Default;
            this.linetype      = Linetype.ByLayer;
            this.lineweight    = Lineweight.ByLayer;
            this.transparency  = Transparency.ByLayer;
            this.linetypeScale = 1.0;
            this.isVisible     = true;
            this.normal        = Vector3.UnitZ;
        }
示例#17
0
        public void SaveInXML(XmlElement parentNode, CandleChartControl owner)
        {
            var node = parentNode.AppendChild(parentNode.OwnerDocument.CreateElement("Asterisk"));

            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Name")).Value = Name;

            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Text")).Value  = Text;
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Sign")).Value  = Sign;
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("magic")).Value = Magic.ToString();

            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ColorLine")).Value = ColorLine.ToArgb().ToString();
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ColorFill")).Value = ColorFill.ToArgb().ToString();
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ColorText")).Value = ColorText.ToArgb().ToString();

            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Price")).Value = Price.ToString(CultureProvider.Common);
            if (DateStart.HasValue)
            {
                node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("PivotTime")).Value =
                    DateStart.Value.ToString("ddMMyyyy HHmmss", CultureProvider.Common);
            }
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Shape")).Value        = Shape.ToString();
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Transparency")).Value =
                Transparency.ToString();
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("TransparencyText")).Value =
                TransparencyText.ToString();
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Radius")).Value =
                Radius.ToString();
            node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("magic")).Value = Magic.ToString();
        }
示例#18
0
 public override void imethod_10(
     EntityColor color,
     Transparency transparency,
     bool isColorBookColor)
 {
     this.imethod_6(Color.CreateFrom(color));
 }
示例#19
0
    IEnumerator Pulse()
    {
        // bool fadeStarted = false;
        Image img = GetComponent <Image>();

        while (true)
        {
            // if (!fadeStarted) {
            //  // print ()
            //  // Transparency.DownFade(imgColor);
            //  fadeStarted = !fadeStarted;
            //  // print("fade started");
            // }

            float rate = (endWidth - startWidth) / 20f;

            // rect.rect = new Vector2(rect.sizeDelta.x + 5f, rect.sizeDelta.y);
            // rect.sizeDelta = new Vector2(rect.sizeDelta.x + 1f, rect.sizeDelta.y + 1f);
            transform.localScale = new Vector3(transform.localScale.x + rate, transform.localScale.y + rate, transform.localScale.z + rate);
            Transparency.SetOpacity(gameObject, img.color.a - 0.04f);
            // print(img.color.a);
            yield return(new WaitForSeconds(0.07f));

            // if (new Vector2(rect.rect.width, rect.rect.height) == new Vector2(endWidth, endHeight)) {
            if (transform.localScale.x >= endWidth)
            {
                // rect.sizeDelta = new Vector2(startWidth, startHeight);
                transform.localScale = new Vector3(startWidth, startHeight, startHeight);
                Transparency.SetOpacity(gameObject, 0.75f);
                // fadeStarted = false;
            }
        }
    }
示例#20
0
    // Use this for initialization
    void Start()
    {
        wardAnim = GameObject.Find("Ward Logo").GetComponent <Animator>();
        peakAnim = GameObject.Find("Peak Logo").GetComponent <Animator>();

        Time.timeScale = 1f;

        ctrlNum = XCI.GetNumPluggedCtrlrs();

        // Transparency.SetTransparent(leftStickGroup);
        // Transparency.SetTransparent(rightStickGroup);
        // Transparency.SetTransparent(pauseGroup);
        // Transparency.SetTransparent(startGroup);

        // Transparency.SetTransparent(escGroup);
        // Transparency.SetTransparent(spaceGroup);
        // Transparency.SetTransparent(asGroup);
        // Transparency.SetTransparent(klGroup);

        Transparency.SetTransparent(pauseButtonGroup);
        Transparency.SetTransparent(pauseKeyboardGroup);

        StartCoroutine("StartScreen");

        Cursor.visible = false;

        // Screen.SetResolution(1920, 1080, true);
        // StartCoroutine("SwitchButtons");
    }
示例#21
0
    IEnumerator StartScreen()
    {
        yield return(new WaitForSeconds(1f));

        wardAnim.SetBool("Transition", true);
        yield return(new WaitForSeconds(3f));

        Destroy(GameObject.Find("Ward Logo"));
        peakAnim.SetBool("Transition", true);

        yield return(new WaitForSeconds(2f));

        if (ctrlNum > 0)
        {
            while (pauseButtonGroup[0].GetComponent <Text>().color.a < 1f)
            {
                Transparency.SetOpacity(pauseButtonGroup, pauseButtonGroup[0].GetComponent <Text>().color.a + 0.1f);
                yield return(new WaitForSeconds(0.05f));
            }
        }

        else
        {
            while (pauseKeyboardGroup[0].GetComponent <Text>().color.a < 1f)
            {
                Transparency.SetOpacity(pauseKeyboardGroup, pauseKeyboardGroup[0].GetComponent <Text>().color.a + 0.1f);
                yield return(new WaitForSeconds(0.05f));
            }
        }


        // Transparency.UpFade(pauseButtonGroup);

        // if (ctrlNum > 0) {
        //  print(ctrlNum);
        //  Transparency.UpFade(leftStickGroup);

        //  yield return new WaitForSeconds(1f);
        //  Transparency.UpFade(rightStickGroup);

        //  yield return new WaitForSeconds(1f);
        //  Transparency.UpFade(pauseGroup);

        //  yield return new WaitForSeconds(1f);
        //  Transparency.UpFade(startGroup);
        // }

        // else {
        //  Transparency.UpFade(asGroup);

        //  yield return new WaitForSeconds(1f);
        //  Transparency.UpFade(klGroup);

        //  yield return new WaitForSeconds(1f);
        //  Transparency.UpFade(escGroup);

        //  yield return new WaitForSeconds(1f);
        //  Transparency.UpFade(spaceGroup);
        // }
    }
        public byte GetTransparency()
        {
            byte     result         = 0;
            Document parentDocument = this.ParentDataset.ParentDocument;

            using (parentDocument.LockDocument())
            {
                var transactionManager = parentDocument.TransactionManager;
                using (Transaction transaction = transactionManager.StartTransaction())
                {
                    BlockTable       blockTable   = (BlockTable)transaction.GetObject(parentDocument.Database.BlockTableId, 0);
                    BlockTableRecord arg_57_0     = (BlockTableRecord)transaction.GetObject(blockTable[(BlockTableRecord.ModelSpace)], 0);
                    RasterImage      rasterImage  = (RasterImage)transaction.GetObject(this.RasterObjectId, 0);
                    Transparency     transparency = rasterImage.Transparency;
                    if (transparency.IsByAlpha)
                    {
                        byte   alpha = transparency.Alpha;
                        double d     = 100.0 - 100.0 * ((double)alpha / 254.0);
                        result = Convert.ToByte(Math.Floor(d));
                    }
                    transaction.Commit();
                }
            }
            return(result);
        }
 /// <summary>
 /// Initializes a new instance of the <c>LayerStateProperties</c> class.
 /// </summary>
 /// <param name="layer">Layer from which copy the properties.</param>
 public LayerStateProperties(Layer layer)
 {
     this.name = layer.Name;
     if (!layer.IsVisible)
     {
         this.flags |= LayerPropertiesFlags.Hidden;
     }
     if (layer.IsFrozen)
     {
         this.flags |= LayerPropertiesFlags.Frozen;
     }
     if (layer.IsLocked)
     {
         this.flags |= LayerPropertiesFlags.Locked;
     }
     if (layer.Plot)
     {
         this.flags |= LayerPropertiesFlags.Plot;
     }
     this.linetype     = layer.Linetype.Name;
     this.color        = (AciColor)layer.Color.Clone();
     this.lineweight   = layer.Lineweight;
     this.transparency = (Transparency)layer.Transparency.Clone();
     //this.plotStyle = "Color_" + layer.Color.Index;
 }
 public void SetTransparency(int newValue)
 {
     try
     {
         this.CheckForUpdates();
         DocUtil.EnableTransparency();
         Document     parentDocument = this.ParentDataset.ParentDocument;
         byte         b            = Convert.ToByte(Math.Floor((100.0 - (double)newValue) / 100.0 * 254.0));
         Transparency transparency = new Transparency(b);
         using (parentDocument.LockDocument())
         {
             parentDocument.TransactionManager.EnableGraphicsFlush(true);
             var transactionManager = parentDocument.TransactionManager;
             using (Transaction transaction = transactionManager.StartTransaction())
             {
                 BlockTable       blockTable  = (BlockTable)transaction.GetObject(parentDocument.Database.BlockTableId, 0);
                 BlockTableRecord arg_A1_0    = (BlockTableRecord)transaction.GetObject(blockTable[(BlockTableRecord.ModelSpace)], (OpenMode)1);
                 RasterImage      rasterImage = (RasterImage)transaction.GetObject(this.RasterObjectId, (OpenMode)1);
                 rasterImage.Transparency = (transparency);
                 rasterImage.Draw();
                 parentDocument.TransactionManager.QueueForGraphicsFlush();
                 parentDocument.TransactionManager.FlushGraphics();
                 parentDocument.Editor.UpdateScreen();
                 transaction.Commit();
             }
         }
     }
     catch
     {
     }
 }
示例#25
0
        /// <summary>
        /// Creates a new Ray that is a copy of the current instance.
        /// </summary>
        /// <returns>A new Ray that is a copy of this instance.</returns>
        public override object Clone()
        {
            Ray entity = new Ray
            {
                //EntityObject properties
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                IsVisible     = IsVisible,
                //Ray properties
                Origin    = origin,
                Direction = direction,
            };

            foreach (XData data in XData.Values)
            {
                entity.XData.Add((XData)data.Clone());
            }

            return(entity);
        }
示例#26
0
        /// <summary>
        /// Creates a new Text that is a copy of the current instance.
        /// </summary>
        /// <returns>A new Text that is a copy of this instance.</returns>
        public override object Clone()
        {
            Text entity = new Text
            {
                //EntityObject properties
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                IsVisible     = IsVisible,
                //Text properties
                Position     = position,
                Rotation     = rotation,
                Height       = height,
                WidthFactor  = widthFactor,
                ObliqueAngle = obliqueAngle,
                Alignment    = alignment,
                Style        = (TextStyle)style.Clone(),
                Value        = text
            };

            foreach (XData data in XData.Values)
            {
                entity.XData.Add((XData)data.Clone());
            }

            return(entity);
        }
示例#27
0
        public override object Clone()
        {
            Tolerance entity = new Tolerance
            {
                //EntityObject properties
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                IsVisible     = IsVisible,
                //Tolerance properties
                Entry1 = (ToleranceEntry)entry1.Clone(),
                Entry2 = (ToleranceEntry)entry2.Clone(),
                Height = height,
                ShowProjectedToleranceZoneSymbol = showProjectedToleranceZoneSymbol,
                DatumIdentifier = datumIdentifier,
                Style           = (DimensionStyle)style.Clone(),
                Position        = position,
                Rotation        = rotation
            };

            foreach (XData data in XData.Values)
            {
                entity.XData.Add((XData)data.Clone());
            }

            return(entity);
        }
示例#28
0
        /// <summary>
        /// Creates a new Point that is a copy of the current instance.
        /// </summary>
        /// <returns>A new Point that is a copy of this instance.</returns>
        public override object Clone()
        {
            Point entity = new Point
            {
                //EntityObject properties
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                IsVisible     = IsVisible,
                //Point properties
                Position  = position,
                Rotation  = rotation,
                Thickness = thickness
            };

            foreach (XData data in XData.Values)
            {
                entity.XData.Add((XData)data.Clone());
            }

            return(entity);
        }
示例#29
0
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
     m_name   = des.ReadStringPointer(br);
     m_stages = des.ReadClassArray <hkxMaterialTextureStage>(br);
     br.ReadUInt64();
     m_diffuseColor       = des.ReadVector4(br);
     m_ambientColor       = des.ReadVector4(br);
     m_specularColor      = des.ReadVector4(br);
     m_emissiveColor      = des.ReadVector4(br);
     m_subMaterials       = des.ReadClassPointerArray <hkxMaterial>(br);
     m_extraData          = des.ReadClassPointer <hkReferencedObject>(br);
     m_uvMapScale_0       = br.ReadSingle();
     m_uvMapScale_1       = br.ReadSingle();
     m_uvMapOffset_0      = br.ReadSingle();
     m_uvMapOffset_1      = br.ReadSingle();
     m_uvMapRotation      = br.ReadSingle();
     m_uvMapAlgorithm     = (UVMappingAlgorithm)br.ReadUInt32();
     m_specularMultiplier = br.ReadSingle();
     m_specularExponent   = br.ReadSingle();
     m_transparency       = (Transparency)br.ReadByte();
     br.ReadUInt32();
     br.ReadUInt16();
     br.ReadByte();
     m_userData   = br.ReadUInt64();
     m_properties = des.ReadClassArray <hkxMaterialProperty>(br);
     br.ReadUInt64();
 }
示例#30
0
        /// <summary>
        /// Creates a new Trace that is a copy of the current instance.
        /// </summary>
        /// <returns>A new Trace that is a copy of this instance.</returns>
        public override object Clone()
        {
            Trace entity = new Trace
            {
                //EntityObject properties
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                IsVisible     = IsVisible,
                //Solid properties
                FirstVertex  = firstVertex,
                SecondVertex = secondVertex,
                ThirdVertex  = thirdVertex,
                FourthVertex = fourthVertex,
                Thickness    = thickness
            };

            foreach (XData data in XData.Values)
            {
                entity.XData.Add((XData)data.Clone());
            }

            return(entity);
        }
示例#31
0
文件: Layer.cs 项目: Core2D/netdxf
        internal Layer(string name, bool checkName)
            : base(name, DxfObjectCode.Layer, checkName)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentNullException(nameof(name), "The layer name should be at least one character long.");

            this.IsReserved = name.Equals(DefaultName, StringComparison.OrdinalIgnoreCase);
            this.color = AciColor.Default;
            this.linetype = Linetype.Continuous;
            this.isVisible = true;
            this.plot = true;
            this.lineweight = Lineweight.Default;
            this.transparency = new Transparency(0);
        }
示例#32
0
 protected EntityObject(EntityType type, string dxfCode)
     : base(dxfCode)
 {
     this.type = type;
     this.color = AciColor.ByLayer;
     this.layer = Layer.Default;
     this.lineType = LineType.ByLayer;
     this.lineweight = Lineweight.ByLayer;
     this.transparency = Transparency.ByLayer;
     this.lineTypeScale = 1.0;
     this.isVisible = true;
     this.normal = Vector3.UnitZ;
     this.reactors = new List<DxfObject>();
     this.xData = new XDataDictionary();
     this.xData.AddAppReg += this.XData_AddAppReg;
     this.xData.RemoveAppReg += this.XData_RemoveAppReg;
 }
示例#33
0
        private Layer ReadLayer()
        {
            Debug.Assert(this.chunk.ReadString() == SubclassMarker.Layer);

            string name = null;
            bool isVisible = true;
            bool plot = true;
            AciColor color = AciColor.Default;
            Linetype linetype = Linetype.ByLayer;
            Lineweight lineweight = Lineweight.Default;
            LayerFlags flags = LayerFlags.None;
            Transparency transparency = new Transparency(0);
            XDataDictionary xData = new XDataDictionary();
            this.chunk.Next();

            while (this.chunk.Code != 0)
            {
                switch (this.chunk.Code)
                {
                    case 2:
                        name = this.DecodeEncodedNonAsciiCharacters(this.chunk.ReadString());
                        this.chunk.Next();
                        break;
                    case 70:
                        flags = (LayerFlags) this.chunk.ReadShort();
                        this.chunk.Next();
                        break;
                    case 62:
                        short index = this.chunk.ReadShort();
                        if (index < 0)
                        {
                            isVisible = false;
                            index = Math.Abs(index);
                        }
                        if (!color.UseTrueColor)
                            color = AciColor.FromCadIndex(index);

                        this.chunk.Next();
                        break;
                    case 420: // the layer uses true color
                        color = AciColor.FromTrueColor(this.chunk.ReadInt());
                        this.chunk.Next();
                        break;
                    case 6:
                        string linetypeName = this.DecodeEncodedNonAsciiCharacters(this.chunk.ReadString());
                        linetype = this.GetLinetype(linetypeName);
                        this.chunk.Next();
                        break;
                    case 290:
                        plot = this.chunk.ReadBool();
                        this.chunk.Next();
                        break;
                    case 370:
                        lineweight = (Lineweight) this.chunk.ReadShort();
                        this.chunk.Next();
                        break;
                    case 1001:
                        string appId = this.DecodeEncodedNonAsciiCharacters(this.chunk.ReadString());
                        XData data = this.ReadXDataRecord(new ApplicationRegistry(appId));
                        xData.Add(data);
                        break;
                    default:
                        if (this.chunk.Code >= 1000 && this.chunk.Code <= 1071)
                            throw new Exception("The extended data of an entity must start with the application registry code.");
                        this.chunk.Next();
                        break;
                }
            }

            if (string.IsNullOrEmpty(name) || !TableObject.IsValidName(name))
                return null;

            // read the layer transparency from the extended data
            XData xDataTransparency;
            if (xData.TryGetValue("AcCmTransparency", out xDataTransparency))
            {
                // there should be only one entry with the transparency value, the first 1071 code will be used
                foreach (XDataRecord record in xDataTransparency.XDataRecord)
                {
                    if (record.Code == XDataCode.Int32)
                    {
                        transparency = Transparency.FromAlphaValue((int) record.Value);
                        break;
                    }
                }
            }

            return new Layer(name, false)
            {
                Color = color,
                Linetype = linetype,
                IsVisible = isVisible,
                IsFrozen = flags.HasFlag(LayerFlags.Frozen),
                IsLocked = flags.HasFlag(LayerFlags.Locked),
                Plot = plot,
                Lineweight = lineweight,
                Transparency = transparency
            };
        }
示例#34
0
 public Pixbuf GetThumbnail(int width, int height, Transparency alpha)
 {
     return new Pixbuf(gimp_image_get_thumbnail(ID, width, height, alpha));
 }
示例#35
0
        /// <summary>
        /// Initializes a new instance of the <c>Attribute</c> class.
        /// </summary>
        /// <param name="definition"><see cref="AttributeDefinition">Attribute definition</see>.</param>
        /// <remarks>
        /// Although the attribute entity could override values defined in its definition for simplicity the implementation has restricted this possibility.
        /// </remarks>
        public Attribute(AttributeDefinition definition)
            : base(DxfObjectCode.Attribute)
        {
            if (definition == null)
                throw new ArgumentNullException("definition");

            //EntityObject properties
            this.color = definition.Color;
            this.layer = definition.Layer;
            this.lineType = definition.LineType;
            this.lineweight = definition.Lineweight;
            this.lineTypeScale = definition.LineTypeScale;
            this.transparency = definition.Transparency;
            this.isVisible = definition.IsVisible;
            this.normal = definition.Normal;

            //Attribute definition properties
            this.definition = definition;
            this.tag = definition.Tag;
            this.value = definition.Value;
            this.style = definition.Style;
            this.position = definition.Position;
            this.flags = definition.Flags;
            this.height = definition.Height;
            this.widthFactor = definition.WidthFactor;
            this.obliqueAngle = definition.ObliqueAngle;
            this.rotation = definition.Rotation;
            this.alignment = definition.Alignment;
        }
示例#36
0
        static extern IntPtr gimp_image_get_thumbnail(Int32 image_ID,
						  int width,
						  int height,
						  Transparency alpha);
示例#37
0
        public Pixel[,] GetThumbnail(Dimensions dimensions, Transparency alpha)
        {
            IntPtr src = gimp_image_get_thumbnail(ID, dimensions.Width,
                        dimensions.Height, alpha);
              var pixbuf = new Pixbuf(src);

              int bpp = ActiveDrawable.Bpp;
              var thumbnail = Pixel.ConvertToPixelArray(pixbuf.Pixels, dimensions, bpp);
              // Marshaller.Free(src);
              return thumbnail;
        }
示例#38
0
        private Layer ReadLayer()
        {
            Debug.Assert(this.chunk.ReadString() == SubclassMarker.Layer);

            string name = null;
            bool isVisible = true;
            bool plot = true;
            AciColor color = AciColor.Default;
            LineType lineType = LineType.ByLayer;
            Lineweight lineweight = Lineweight.Default;
            LayerFlags flags = LayerFlags.None;
            Transparency transparency = new Transparency(0);

            this.chunk.Next();

            while (this.chunk.Code != 0)
            {
                switch (this.chunk.Code)
                {
                    case 2:
                        name = this.DecodeEncodedNonAsciiCharacters(this.chunk.ReadString());
                        this.chunk.Next();
                        break;
                    case 70:
                        flags = (LayerFlags) this.chunk.ReadShort();
                        this.chunk.Next();
                        break;
                    case 62:
                        short index = this.chunk.ReadShort();
                        if (index < 0)
                        {
                            isVisible = false;
                            index = Math.Abs(index);
                        }
                        if (!color.UseTrueColor)
                            color = AciColor.FromCadIndex(index);

                        this.chunk.Next();
                        break;
                    case 420: // the layer uses true color
                        color = AciColor.FromTrueColor(this.chunk.ReadInt());
                        this.chunk.Next();
                        break;
                    case 6:
                        // the line type names ByLayer or ByBlock are case insensitive
                        string lineTypeName = this.DecodeEncodedNonAsciiCharacters(this.chunk.ReadString());
                        if (string.Compare(lineTypeName, LineType.ByLayerName, StringComparison.OrdinalIgnoreCase) == 0)
                            lineTypeName = LineType.ByLayerName;
                        else if (string.Compare(lineTypeName, LineType.ByBlockName, StringComparison.OrdinalIgnoreCase) == 0)
                            lineTypeName = LineType.ByBlockName;
                        lineType = this.GetLineType(lineTypeName);

                        this.chunk.Next();
                        break;
                    case 290:
                        plot = this.chunk.ReadBool();
                        this.chunk.Next();
                        break;
                    case 370:
                        lineweight = Lineweight.FromCadIndex(this.chunk.ReadShort());
                        this.chunk.Next();
                        break;
                    case 1001:
                        // layer transparency is stored in XData
                        // the ApplicationRegistries might be defined after the objects that requires them,
                        // same old story this time we don't need to store the information in the object XData since it is only supported by entities.
                        if (this.chunk.ReadString() == "AcCmTransparency")
                        {
                            this.chunk.Next();
                            transparency = Transparency.FromAlphaValue(this.chunk.ReadInt());
                        }
                        this.chunk.Next();
                        break;
                    default:
                        this.chunk.Next();
                        break;
                }
            }

            if (string.IsNullOrEmpty(name)) return null;

            return new Layer(name)
            {
                Color = color,
                LineType = lineType,
                IsVisible = isVisible,
                IsFrozen = (flags & LayerFlags.Frozen) == LayerFlags.Frozen,
                IsLocked = (flags & LayerFlags.Locked) == LayerFlags.Locked,
                Plot = plot,
                Lineweight = lineweight,
                Transparency = transparency
            };
        }
示例#39
0
        private bool CheckAdjacent( int x, int y, int z, Direction direction, Transparency transparency )
        {
            // returns true if a face should be spawned

            Index index = chunk.GetAdjacentIndex(x,y,z, direction);
            ushort adjacentVoxel = chunk.GetVoxel(index.x, index.y, index.z);

            if (adjacentVoxel == ushort.MaxValue) { // if the neighbor chunk is missing

            if (Engine.ShowBorderFaces || direction == Direction.up) {
                return true;
            }
            else {
                return false;
            }

            }

            Transparency result = Engine.GetVoxelType (adjacentVoxel).VTransparency;	// get the transparency of the adjacent voxel

            // parse the result (taking into account the transparency of the adjacent block as well as the one doing this check)
            if (transparency == Transparency.transparent) {
            if (result == Transparency.transparent)
                return false; // don't draw a transparent block next to another transparent block
            else
                return true; // draw a transparent block next to a solid or semi-transparent
            }
            else {
            if (result == Transparency.solid)
             	return false; // don't draw a solid block or a semi-transparent block next to a solid block
            else
                return true; // draw a solid block or a semi-transparent block next to both transparent and semi-transparent
            }
        }
示例#40
0
 /// <summary>
 ///  parse method is called from the atom parser to populate an Transparency node
 /// </summary>
 /// <param name="node">the xmlnode to parser</param>
 /// <returns>Transparency object</returns>
 public static Transparency parse(XmlNode node)
 {
     Transparency trans = null;
     if (String.Compare(node.NamespaceURI, BaseNameTable.gNamespace, true) == 0)
     {
         trans = new Transparency();
         if (node.Attributes != null)
         {
             trans.Value = node.Attributes["value"].Value;
         }
     }
     return trans;
 }