File: image.rst

package info (click to toggle)
ezdxf 0.18.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 46,952 kB
  • sloc: python: 158,141; javascript: 166; cpp: 138; makefile: 116; lisp: 20
file content (115 lines) | stat: -rw-r--r-- 3,597 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
Image
=====

.. module:: ezdxf.entities
    :noindex:

Add a raster IMAGE (`DXF Reference`_) to the DXF file, the file itself is not embedded into the DXF file, it is always a separated file.
The IMAGE entity is like a block reference, you can use it multiple times to add the image on different locations
with different scales and rotations. But therefore you need a also a IMAGEDEF entity, see :class:`ImageDef`.
`ezdxf` creates only images in the xy-plan, you can place images in the 3D space too, but then you have to set
the :attr:`Image.dxf.u_pixel` and the :attr:`Image.dxf.v_pixel` vectors by yourself.

======================== ==========================================
Subclass of              :class:`ezdxf.entities.DXFGraphic`
DXF type                 ``'IMAGE'``
Factory function         :meth:`ezdxf.layouts.BaseLayout.add_image`
Inherited DXF attributes :ref:`Common graphical DXF attributes`
Required DXF version     DXF R2000 (``'AC1015'``)
======================== ==========================================

.. warning::

    Do not instantiate entity classes by yourself - always use the provided factory functions!

.. class:: Image

    .. attribute:: dxf.insert

        Insertion point, lower left corner of the image (3D Point in :ref:`WCS`).

    .. attribute:: dxf.u_pixel

        U-vector of a single pixel (points along the visual bottom of the image, starting at the insertion point)
        as ``(x, y, z)`` tuple

    .. attribute:: dxf.v_pixel

        V-vector of a single pixel (points along the visual left side of the image, starting at the insertion point)
        as ``(x, y, z)`` tuple

    .. attribute:: dxf.image_size

        Image size in pixels as ``(x, y)`` tuple

    .. attribute:: dxf.image_def_handle

        Handle to the image definition entity, see :class:`ImageDef`

    .. attribute:: dxf.flags

        =================================== ======= ===========
        :attr:`Image.dxf.flags`             Value   Description
        =================================== ======= ===========
        :attr:`Image.SHOW_IMAGE`            1       Show image
        :attr:`Image.SHOW_WHEN_NOT_ALIGNED` 2       Show image when not aligned with screen
        :attr:`Image.USE_CLIPPING_BOUNDARY` 4       Use clipping boundary
        :attr:`Image.USE_TRANSPARENCY`      8       Transparency is on
        =================================== ======= ===========

    .. attribute:: dxf.clipping

        Clipping state:

        ===== ============
        ``0`` clipping off
        ``1`` clipping on
        ===== ============

    .. attribute:: dxf.brightness

        Brightness value (0-100; default = ``50``)

    .. attribute:: dxf.contrast

        Contrast value (0-100; default = ``50``)

    .. attribute:: dxf.fade

        Fade value (0-100; default = ``0``)

    .. attribute:: dxf.clipping_boundary_type

        Clipping boundary type:

        === ============
        1   Rectangular
        2   Polygonal
        === ============

    .. attribute:: dxf.count_boundary_points

        Number of clip boundary vertices, maintained by `ezdxf`.

    .. attribute:: Image.dxf.clip_mode

        Clip mode (DXF R2010):

        === ========
        0   Outside
        1   Inside
        === ========

    .. autoattribute:: boundary_path

    .. autoattribute:: image_def

    .. automethod:: reset_boundary_path

    .. automethod:: set_boundary_path

    .. automethod:: boundary_path_wcs

    .. automethod:: transform

.. _DXF Reference: http://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-3A2FF847-BE14-4AC5-9BD4-BD3DCAEF2281