File: transparency.rst

package info (click to toggle)
ezdxf 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 104,528 kB
  • sloc: python: 182,341; makefile: 116; lisp: 20; ansic: 4
file content (33 lines) | stat: -rw-r--r-- 1,364 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
.. _transparency:

Transparency
============

The support for transparency was added to the DXF file format in revision R2004.
The raw transparency value stored as 32 bit value in the DXF namespace as
:attr:`transparency` attribute, has a range from 0 to 255 where 0 is fully
transparent and 255 if opaque and has the top byte set to ``0x02``.
For a more easy usage all graphical entities support the
:attr:`~ezdxf.entities.DXFGraphic.transparency` property to get and set the
transparency as float value in the range frem 0.0 to 1.0 where 0.0 is opaque and
1.0 is fully transparent. The transparency value can be set explicit in the
entity, by layer or by block.

.. code-block:: Python

    import ezdxf

    doc = ezdxf.new()
    msp = doc.modelspace()
    line = msp.add_line((0, 0), (10, 0))
    line.transparency = 0.5

.. seealso::

    - :mod:`ezdxf.colors`
    - :ref:`tut_common_graphical_attributes`
    - Autodesk Knowledge Network: `About Making Objects Transparent`_
    - BricsCAD Help Center: `Entity Transparency`_

.. _About Making Objects Transparent: https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2019/ENU/AutoCAD-Core/files/GUID-E6EB9CA5-B039-4262-BE17-1AD3E7230EF7-htm.html
.. _Entity Transparency: https://help.bricsys.com/document/_guides--BCAD_2D_drafting--GD_transparency/V22/EN_US?id=165079137340