"Fossies" - the Fresh Open Source Software Archive

Member "sk1-2.0rc4/src/uc2/sk2const.py" (25 May 2019, 4110 Bytes) of package /linux/misc/sk1-2.0rc4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "sk2const.py" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.0rc3_vs_2.0rc4.

    1 # -*- coding: utf-8 -*-
    2 #
    3 #  Copyright (C) 2015-2019 by Igor E. Novikov
    4 #
    5 #  This program is free software: you can redistribute it and/or modify
    6 #  it under the terms of the GNU General Public License as published by
    7 #  the Free Software Foundation, either version 3 of the License, or
    8 #  (at your option) any later version.
    9 #
   10 #  This program is distributed in the hope that it will be useful,
   11 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
   12 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   13 #  GNU General Public License for more details.
   14 #
   15 #  You should have received a copy of the GNU General Public License
   16 #  along with this program.  If not, see <https://www.gnu.org/licenses/>.
   17 
   18 from uc2 import uc2const
   19 
   20 SK2DOC_ID = '##sK1 2 '
   21 SK2XML_ID = '<!-- sK1 2 '
   22 SK2VER = '1'
   23 SK2XML_START = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
   24 SK2SVG_START = '<svg xmlns:svg="http://www.w3.org/2000/svg" ' + \
   25                'xmlns="http://www.w3.org/2000/svg" ' + \
   26                'xmlns:xlink="http://www.w3.org/1999/xlink" ' + \
   27                'version="1.0" width="%d" height="%d">'
   28 SK2IMG_TAG = '<image y="0.0"  x="0.0" xlink:href="data:image/png;base64,'
   29 SK2IMG_TAG_END = '"  height="%d" width="%d" />'
   30 SK2DOC_START = '<!-- Encapsulated SK2'
   31 
   32 DOC_ORIGIN_CENTER = 0
   33 DOC_ORIGIN_LL = 1
   34 DOC_ORIGIN_LU = 2
   35 ORIGINS = [DOC_ORIGIN_CENTER, DOC_ORIGIN_LL, DOC_ORIGIN_LU]
   36 
   37 # Bezier curve constants
   38 NORMAL_TRAFO = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0]
   39 # [scale_x, scale_y, shear_x, shear_y, rotate]
   40 PATTERN_TRANSFORMS = [1.0, 1.0, 0.0, 0.0, 0.0]
   41 CORNERS = [0.0, 0.0, 0.0, 0.0]
   42 EMPTY_STYLE = [[], [], [], []]
   43 EMPTY_IMAGE_STYLE = [[], []]
   44 
   45 CURVE_CLOSED = 1
   46 CURVE_OPENED = 0
   47 
   48 NODE_CUSP = 0  # 0000
   49 NODE_SMOOTH = 1  # 0001
   50 NODE_SMOOTH_OPP = 2  # 0010
   51 NODE_SMOOTH_BOTH = 3  # 0011
   52 NODE_SYMMETRICAL = 4  # 0100
   53 NODE_NOT_SMOOTH_OPP = 5  # 0101
   54 NODE_SYMM_SMOOTH = 6  # 0110
   55 
   56 ARC_ARC = 0
   57 ARC_CHORD = 1
   58 ARC_PIE_SLICE = 2
   59 
   60 CIRCLE_CTRL = 0.552191307086614
   61 CIRCLE_CTRL_SHIFT = 0.447808692913386
   62 
   63 STUB_RECT = [0.0, 0.0, 1.0, 1.0]
   64 STUB_PATHS = [[[0.0, 0.0], [[10.0, 10.0], ], CURVE_OPENED], ]
   65 STUB_CIRCLE = [[[1.0, 0.5], [
   66     [[1.0, 0.776095653543307], [0.776095653543307, 1.0], [0.5, 1.0],
   67         NODE_SYMMETRICAL],
   68     [[0.223904346456693, 1.0], [0.0, 0.776095653543307], [0.0, 0.5],
   69         NODE_SYMMETRICAL],
   70     [[0.0, 0.223904346456693], [0.223904346456693, 0.0], [0.5, 0.0],
   71         NODE_SYMMETRICAL],
   72     [[0.776095653543307, 0.0], [1.0, 0.223904346456693], [1.0, 0.5],
   73         NODE_SYMMETRICAL],
   74 ], CURVE_CLOSED]]
   75 
   76 STUB_ARCS = [
   77     [[1.0, 0.776095653543307], [0.776095653543307, 1.0], [0.5, 1.0],
   78         NODE_SYMMETRICAL],
   79     [[0.223904346456693, 1.0], [0.0, 0.776095653543307], [0.0, 0.5],
   80         NODE_SYMMETRICAL],
   81     [[0.0, 0.223904346456693], [0.223904346456693, 0.0], [0.5, 0.0],
   82         NODE_SYMMETRICAL],
   83     [[0.776095653543307, 0.0], [1.0, 0.223904346456693], [1.0, 0.5],
   84         NODE_SYMMETRICAL],
   85 ]
   86 
   87 # Fill and stroke constants
   88 
   89 FILL_EVENODD = 1  # 01
   90 FILL_NONZERO = 0  # 00
   91 FILL_NONZERO_CLOSED_ONLY = 2  # 10
   92 FILL_EVENODD_CLOSED_ONLY = 3  # 11
   93 
   94 FILL_ANY = 0  # 00
   95 FILL_CLOSED_ONLY = 2  # 10
   96 
   97 FILL_SOLID = 0
   98 FILL_GRADIENT = 1
   99 FILL_PATTERN = 2
  100 
  101 GRADIENT_LINEAR = 0
  102 GRADIENT_RADIAL = 1
  103 GRADIENT_CONICAL = 2
  104 
  105 GRADIENT_EXTEND_NONE = 0
  106 GRADIENT_EXTEND_PAD = 1
  107 GRADIENT_EXTEND_REPEAT = 2
  108 GRADIENT_EXTEND_REFLECT = 3
  109 
  110 PATTERN_IMG = 0
  111 PATTERN_TRUECOLOR = 1
  112 PATTERN_EPS = 2
  113 
  114 STROKE_MIDDLE = 0
  115 STROKE_OTSIDE = 1
  116 STROKE_INSIDE = 2
  117 
  118 JOIN_MITER = 0
  119 JOIN_ROUND = 1
  120 JOIN_BEVEL = 2
  121 
  122 CAP_BUTT = 1
  123 CAP_ROUND = 2
  124 CAP_SQUARE = 3
  125 
  126 CMYK_BLACK = [uc2const.COLOR_CMYK, [0.0, 0.0, 0.0, 1.0], 1.0, 'Black']
  127 CMYK_WHITE = [uc2const.COLOR_CMYK, [0.0, 0.0, 0.0, 0.0], 1.0, 'White']
  128 RGB_BLACK = [uc2const.COLOR_RGB, [0.0, 0.0, 0.0], 1.0, 'Black']
  129 RGB_WHITE = [uc2const.COLOR_RGB, [1.0, 1.0, 1.0], 1.0, 'White']
  130 
  131 FALLBACK_OUTLINE = [STROKE_MIDDLE, 1.0, CMYK_BLACK, [], CAP_BUTT, JOIN_MITER,
  132                     10.433, 0, 0, []]
  133 
  134 TEXTBLOCK_WIDTH = -1
  135 
  136 TEXT_ALIGN_LEFT = 0
  137 TEXT_ALIGN_CENTER = 1
  138 TEXT_ALIGN_RIGHT = 2
  139 TEXT_ALIGN_JUSTIFY = 3
  140 
  141 TEXT_VALIGN_TOP = 0
  142 TEXT_VALIGN_BASELINE = 1
  143 TEXT_VALIGN_BOTTOM = 2