Creates a new transparency object.
Optionalalpha: numberWhen provided, constructs with ByAlpha method and sets alpha.
Must be between 0 and 255.
Gets the alpha value.
Only meaningful if method === ByAlpha.
Sets the alpha value and force the method to ByAlpha.
0–255 alpha, clamped internally if out of range
True if the method is ByAlpha.
True if the method is ByBlock.
True if the method is ByLayer.
True if transparency is exactly clear (alpha==0 and ByAlpha).
True if current state is invalid (ErrorValue).
True if transparency is solid (alpha==255 and ByAlpha).
Gets the current transparency method
Sets the transparency method. If setting to ByAlpha with no prior alpha, alpha stays 255 (opaque).
The new transparency method
Gets the AutoCAD-style transparency percentage.
Mapping rules:
This matches how AutoCAD displays and stores transparency values in UI and DXF files.
If the transparency method is not ByAlpha,
this method returns undefined, because AutoCAD
does not define a percentage for ByLayer or ByBlock.
Transparency percentage (0–100), or undefined
Sets the transparency using an AutoCAD-style percentage.
Mapping rules (AutoCAD compatible):
Internally, the alpha value is calculated as: alpha = round(255 × (1 − percentage / 100))
This method:
ByAlphaTransparency percentage (0–100)
This instance (for fluent chaining)
Creates a deep copy of this transparency object.
This mirrors the value-semantics of ObjectARX AcCmTransparency,
where copying results in an independent object with the same
transparency method and alpha value.
A new AcCmTransparency instance with identical state.
Compares this transparency with another one for equality.
Two AcCmTransparency objects are considered equal if:
This mirrors the value semantics of ObjectARX
AcCmTransparency.
The transparency to compare with
True if both represent the same transparency
Convert this transparency to an integer suitable for storage. Uses a simple bit-encoding: highbits for method and lowbits for alpha.
31 24 23 8 7 0 +-------------+--------------+------------+ | flags | reserved | alpha | +-------------+--------------+------------+
Returns a human-readable string representation of the transparency.
Behavior:
"ByLayer" if transparency is inherited from layer"ByBlock" if transparency is inherited from block"0"–"255") if method is ByAlphaThis format is intentionally simple and mirrors common AutoCAD UI and DXF text usage.
String representation of the transparency
StaticdeserializeDeserialize an integer back into a transparency object.
32-bit stored transparency representation
StaticfromCreates an AcCmTransparency instance from a string representation.
Accepted formats:
"ByLayer" (case-insensitive)"ByBlock" (case-insensitive)"0"–"255"Invalid or out-of-range values will produce an
ErrorValue transparency.
String to parse
Parsed AcCmTransparency instance
Class representing transparency similar to AutoCAD’s
AcCmTransparency.Stores both method and alpha information.