Table of Contents

Class DxfColor

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

A colour of a DXF file, as AutoCAD's Autodesk.AutoCAD.Colors.Color: BYLAYER, BYBLOCK, a colour of AutoCAD's index (group 62), or one of red, green and blue (group 420), with the name of a colour book where the file gives one (430).

public sealed class DxfColor : IEquatable<DxfColor>
Inheritance
DxfColor
Implements
Inherited Members

Remarks

DxfColor.FromColorIndex(DxfColorMethod.ByAci, 1) is red, index 1, red 255, green 0 and blue 0; DxfColor.FromRgb(255, 128, 0) is the true colour 0xFF8000, its ColorIndex the index nearest it, 30. The red, green and blue of an index are those AutoCAD 2021 gives it: 7 is white, 12 is 0xCC0000, and the greys 250 to 255 run 0x333333, 0x5B5B5B, 0x848484, 0xADADAD, 0xD6D6D6 and white.

A colour cannot be changed once made, and two colours are equal where their method, index, red, green, blue and name are.

Properties

Blue

Gets the blue of the colour, 0 to 255; see Red for a colour of the index.

ByBlock

Gets the colour BYBLOCK, the colour index 0.

ByLayer

Gets the colour BYLAYER, the colour index 256.

ColorIndex

Gets the colour index, as AutoCAD's ColorIndex: 1 to 255 of a colour of the index, 256 for BYLAYER, 0 for BYBLOCK, 7 for the foreground; for a true colour the index nearest it, which AutoCAD writes beside it: 30 for orange, 0xFF8000, whether made by FromRgb(byte, byte, byte) or read from an entity or a layer.

ColorMethod

Gets how the colour is given, as AutoCAD's ColorMethod.

ColorName

Gets the name of the colour in its colour book (group 430), as AutoCAD's ColorName; null where it has none.

ColorValue

Gets the colour as red, green and blue, 0xRRGGBB, as AutoCAD's ColorValue gives them: BYLAYER is white, 0xFFFFFF, while its Red, Green and Blue stay nought; BYBLOCK is black.

Green

Gets the green of the colour, 0 to 255; see Red for a colour of the index.

IsByAci

Gets whether the colour is one of AutoCAD's index, as AutoCAD's IsByAci.

IsByBlock

Gets whether the colour is BYBLOCK, as AutoCAD's IsByBlock.

IsByColor

Gets whether the colour is a true colour, as AutoCAD's IsByColor.

IsByLayer

Gets whether the colour is BYLAYER, as AutoCAD's IsByLayer.

IsForeground

Gets whether the colour is the foreground, as AutoCAD's IsForeground.

IsNone

Gets whether the colour is none, as AutoCAD's IsNone.

Red

Gets the red of the colour, 0 to 255: its own for a true colour, the palette's for one of the index, nought for BYLAYER and BYBLOCK. AutoCAD 2021's Color.Red gives nought for a colour of the index too, and its ColorValue the palette colour (index 1 is 255, 0, 0 by ColorValue and 0, 0, 0 by Red, Green and Blue); here they give the palette colour, which the viewer draws with, so that the three read the same as ColorValue except for BYLAYER.

Methods

Equals(DxfColor)

Gets whether this colour is another, by method, index, red, green, blue and name.

Equals(object)

Gets whether this colour is another object, a colour equal to it.

FromColorIndex(DxfColorMethod, short)

Gets the colour of a method and an index, as AutoCAD's FromColorIndex: ByAci with 1 to 255, ByLayer, ByBlock, Foreground or None, whose index is theirs whatever is given.

FromRgb(byte, byte, byte)

Gets the true colour of a red, a green and a blue, as AutoCAD's FromRgb; its ColorIndex the index nearest it, the first of the nearest.

GetHashCode()

Gets a hash of the colour, the same for equal colours.

ToString()

Gives the colour as AutoCAD names it: BYLAYER, BYBLOCK, the index, or the red, green and blue.