| Server IP : 93.86.61.54 / Your IP : 216.73.216.60 Web Server : Apache/2.4.62 (Ubuntu) System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64 User : www-data ( 33) PHP Version : 8.4.22 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/inkscape/extensions/__pycache__/ |
Upload File : |
o
0�a1 � @ s� d Z ddlZddlZddlZddlmZmZmZ g d�Zg d�Zg d�Z dd� Z
d d
� Zdd� Zd
d� Z
dd� Zdd� Zdd� ZG dd� dej�ZedkrTe� �� dS dS )a:
Version 0.6 - DPI Switcher
This extension scales a document to fit different SVG DPI -90/96-
Changes since v0.5:
- transform all top-level containers and graphics elements
- support scientific notation in SVG lengths
- fix scaling with existing matrix()
- support different units for document width, height attributes
- improve viewBox support (syntax, offset)
- support common cases of text-put-on-path in SVG root
- support common cases of <use> references in SVG root
- examples from http://tavmjong.free.fr/INKSCAPE/UNITS/ tested
TODO:
- check grids/guides created with 0.91:
http://tavmjong.free.fr/INKSCAPE/UNITS/units_mm_nv_90dpi.svg
- check <symbol> instances
- check more <use> and text-on-path cases (reverse scaling needed?)
- scale perspective of 3dboxes
� N)�Use�TextElement�
transforms)�defs�glyph�marker�maskz
missing-glyph�pattern�symbol)�a�g�switch)
�circle�ellipse�image�line�path�polygon�polyline�rect�text�usec C s | � d�dkS )z0Check whether element is an Inkscape 3dbox type.z
sodipodi:typezinkscape:box3d)�get)�element� r �-/usr/share/inkscape/extensions/dpiswitcher.py�is_3dboxO s r c C s, t | t�r| �d�}|durt|�rdS dS )z,Check whether text element is put on a path.zsvg:textPathNTF)�
isinstancer �find�len)r � text_pathr r r �is_text_on_pathT s
r! c C s || � � v S )z@Check whether element1 and element2 are siblings of same parent.)� getparent)�element1�element2r r r �
is_sibling] s r% c C s* |dur| � d�}|dur||�� v S dS )z!Check whether element is in defs.Nr F)r �iterdescendants)�docr r r r r �
is_in_defsb s
r( c C s d}|r |S )z'Check transformation for 3dbox element.Fr )�svgr �scale_x�scale_y�skipr r r �check_3dboxk s r- c C sH d}|� d�j}t| |�s�t||�r�d}d|jv r |j�||� t�d� ||��j
}t|d d |d d |d d |d d �}t�
t|��}d} ttj�|�d ���}
| |
v rqt|
| �| |
| <