Beispiel #1
0
        public ArgbColor GetColor(DrawContext context)
        {
            ArgbColor baseColor;

            if (this.DxfColor == null)
            {
                if (this.entityColor_0 == EntityColor.ByBlock)
                {
                    baseColor = context.ByBlockDxfColor == null?context.ByBlockColor.ToArgbColor(context.Config.IndexedColors) : context.ByBlockDxfColor.Color.ToArgbColor(context.Config.IndexedColors);
                }
                else if (this.entityColor_0 == EntityColor.ByLayer)
                {
                    DxfLayer layer = this.GetLayer(context);
                    baseColor = layer == null ? context.Config.IndexedColors[7] : layer.GetColor(context.Viewport).ToArgbColor(context.Config.IndexedColors);
                }
                else
                {
                    baseColor = this.Color.ToArgbColor(context.Config.IndexedColors);
                }
            }
            else
            {
                baseColor = this.DxfColor.Color.ToArgbColor(context.Config.IndexedColors);
            }
            byte alpha = this.GetAlpha(context);

            if (alpha != byte.MaxValue)
            {
                return(ArgbColor.FromArgb((int)alpha, baseColor));
            }
            return(baseColor);
        }
Beispiel #2
0
        public EntityColor GetEntityColor(DrawContext context)
        {
            EntityColor entityColor;

            if (this.DxfColor == null)
            {
                if (this.entityColor_0 == EntityColor.ByBlock)
                {
                    entityColor = context.ByBlockDxfColor == null ? context.ByBlockColor : EntityColor.CreateFrom(context.ByBlockDxfColor.Color);
                }
                else if (this.entityColor_0 == EntityColor.ByLayer)
                {
                    DxfLayer layer = this.GetLayer(context);
                    entityColor = layer == null?EntityColor.CreateFromColorIndex((short)7) : EntityColor.CreateFrom(layer.GetColor(context.Viewport));
                }
                else
                {
                    entityColor = this.Color;
                }
            }
            else
            {
                entityColor = EntityColor.CreateFrom(this.DxfColor.Color);
            }
            return(entityColor);
        }