File: image.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 (116 lines) | stat: -rw-r--r-- 3,568 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
116
Image
=====

.. module:: ezdxf.entities
    :noindex:

The IMAGE entity (`DXF Reference`_) represents a raster image, the image file itself is
not embedded into the DXF file, it is always a separated file.
The IMAGE entity is like a block reference, it can be used to add the image multiple times
at different locations with different scale and rotation angles.  Every IMAGE entity
requires an image definition, see entity :class:`ImageDef`.
`Ezdxf` creates only images in the xy-plan, it's possible to place images in 3D space,
therefore the :attr:`Image.dxf.u_pixel` and the :attr:`Image.dxf.v_pixel` vectors
has to be set accordingly.

======================== ==========================================
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 as (x, y, z) tuple. This vector points along the
        visual bottom of the image, starting at the insertion point.

    .. attribute:: dxf.v_pixel

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

    .. 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.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 in the range [0, 100], default is 50

    .. attribute:: dxf.contrast

        Contrast value in the range [0, 100], default is 50

    .. attribute:: dxf.fade

        Fade value in the range [0, 100], default is 0

    .. attribute:: dxf.clipping_boundary_type

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

    .. attribute:: dxf.count_boundary_points

        Number of clip boundary vertices, this attribute is maintained by `ezdxf`.

    .. attribute:: Image.dxf.clip_mode

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

        requires DXF R2010 or newer

    .. autoattribute:: boundary_path

    .. autoattribute:: image_def

    .. automethod:: reset_boundary_path

    .. automethod:: set_boundary_path

    .. automethod:: pixel_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