| 1 | <!doctype html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1"> |
| 6 | <meta name="generator" content="pdoc3 0.11.1"> |
| 7 | <title>fluxity API documentation</title> |
| 8 | <meta name="description" content="GPL Licence text …"> |
| 9 | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin> |
| 10 | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/typography.min.css" integrity="sha512-Y1DYSb995BAfxobCkKepB1BqJJTPrOp3zPL74AWFugHHmmdcvO+C48WLrUOlhGMc0QG7AE3f7gmvvcrmX2fDoA==" crossorigin> |
| 11 | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css" crossorigin> |
| 12 | <style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:1.5em;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:2em 0 .50em 0}h3{font-size:1.4em;margin:1.6em 0 .7em 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .2s ease-in-out}a:visited{color:#503}a:hover{color:#b62}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900;font-weight:bold}pre code{font-size:.8em;line-height:1.4em;padding:1em;display:block}code{background:#f3f3f3;font-family:"DejaVu Sans Mono",monospace;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em 1em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style> |
| 13 | <style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul ul{padding-left:1em}.toc > ul > li{margin-top:.5em}}</style> |
| 14 | <style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style> |
| 15 | <script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" integrity="sha512-D9gUyxqja7hBtkWpPWGt9wfbfaMGVt9gnyCvYa+jojwwPHLCzUm5i8rpk7vD7wNee9bA35eYIjobYPaQuKS1MQ==" crossorigin></script> |
| 16 | <script>window.addEventListener('DOMContentLoaded', () => { |
| 17 | hljs.configure({languages: ['bash', 'css', 'diff', 'graphql', 'ini', 'javascript', 'json', 'plaintext', 'python', 'python-repl', 'rust', 'shell', 'sql', 'typescript', 'xml', 'yaml']}); |
| 18 | hljs.highlightAll(); |
| 19 | })</script> |
| 20 | </head> |
| 21 | <body> |
| 22 | <main> |
| 23 | <article id="content"> |
| 24 | <header> |
| 25 | <h1 class="title">Module <code>fluxity</code></h1> |
| 26 | </header> |
| 27 | <section id="section-intro"> |
| 28 | <h3 id="gpl-licence-text">GPL Licence text</h3> |
| 29 | <p>Flowblade Movie Editor is a nonlinear video editor. |
| 30 | Copyright 2021 Janne Liljeblad.</p> |
| 31 | <p>This file is part of Flowblade Movie Editor <a href="https://github.com/jliljebl/flowblade/">https://github.com/jliljebl/flowblade/</a>.</p> |
| 32 | <p>Flowblade Movie Editor is free software: you can redistribute it and/or modify |
| 33 | it under the terms of the GNU General Public License as published by |
| 34 | the Free Software Foundation, either version 3 of the License, or |
| 35 | (at your option) any later version.</p> |
| 36 | <p>Flowblade Movie Editor is distributed in the hope that it will be useful, |
| 37 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 38 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 39 | See the |
| 40 | GNU General Public License for more details.</p> |
| 41 | <p>You should have received a copy of the GNU General Public License |
| 42 | along with Flowblade Movie Editor. If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.</p> |
| 43 | <h1 id="fluxity-scripting">FLUXITY SCRIPTING</h1> |
| 44 | <p>Fluxity scripting is a <strong>Python scripting solution</strong> created to provide <strong>Flowblade Movie Editor</strong> with a <em>Plugin API</em>.</p> |
| 45 | <p>Currently <em>Fluxity API</em> |
| 46 | is used by Flowblade <em>Generators</em> feature.</p> |
| 47 | <p><em>Fluxity API</em> |
| 48 | is made available to scripts mainly by <em>fluxity.FluxityContext</em> object and its methods. This object is created to communicate with the script before calling any of the methods of the script.</p> |
| 49 | <p>Some constants mentioned in this source file - such as <code><a title="fluxity.EDITOR_FLOAT" href="#fluxity.EDITOR_FLOAT">EDITOR_FLOAT</a></code> or <code><a title="fluxity.PROFILE_WIDTH" href="#fluxity.PROFILE_WIDTH">PROFILE_WIDTH</a></code> - can also be used by scripts. </p> |
| 50 | <p>See this below for <em>fluxity.FluxityContext</em> object API details.</p> |
| 51 | <h2 id="script-interface">SCRIPT INTERFACE</h2> |
| 52 | <p>A Python script needs to have the following functions to load and run without crashing as a Fluxity API conforming script.</p> |
| 53 | <pre><code>def init_script(fctx): |
| 54 | pass |
| 55 | |
| 56 | def init_render(fctx): |
| 57 | pass |
| 58 | |
| 59 | def render_frame(frame, fctx, w, h): |
| 60 | pass |
| 61 | </code></pre> |
| 62 | <h2 id="script-lifecycle">SCRIPT LIFECYCLE</h2> |
| 63 | <p><strong><code>init_script(fctx):</code></strong> This method is called when script is first loaded by Flowblade to create data structures with info on editors and script metadata. </p> |
| 64 | <p><strong><code>init_render(fctx):</code></strong> This method is called before a render is started to get user input from editors, and possibly to create some additional data structures.</p> |
| 65 | <p><strong><code>render_frame(frame, fctx, w, h):</code></strong> This method is called for each rendered frame to create an output image.</p> |
| 66 | <h2 id="example-script">EXAMPLE SCRIPT</h2> |
| 67 | <h3 id="init_script">init_script()</h3> |
| 68 | <pre><code>import cairo |
| 69 | import numpy as np |
| 70 | import random |
| 71 | import math |
| 72 | |
| 73 | import fluxity |
| 74 | |
| 75 | def init_script(fctx): |
| 76 | fctx.set_name("Floating Balls") |
| 77 | fctx.set_version(1) |
| 78 | fctx.set_author("Janne Liljeblad") |
| 79 | |
| 80 | fctx.add_editor("Hue", fluxity.EDITOR_COLOR, (0.8, 0.50, 0.3, 1.0)) |
| 81 | fctx.add_editor("Speed", fluxity.EDITOR_FLOAT_RANGE, (1.0, -5.0, 5.0)) |
| 82 | fctx.add_editor("Speed Variation %", fluxity.EDITOR_INT_RANGE, (40, 0, 99)) |
| 83 | fctx.add_editor("Number of Items", fluxity.EDITOR_INT_RANGE, (50, 10, 500)) |
| 84 | fctx.add_editor("Size", fluxity.EDITOR_INT_RANGE, (330, 10, 800)) |
| 85 | fctx.add_editor("Size Variation %", fluxity.EDITOR_INT_RANGE, (0, 0, 80)) |
| 86 | fctx.add_editor("Opacity", fluxity.EDITOR_INT_RANGE, (100, 5, 100)) |
| 87 | fctx.add_editor("Random Seed", fluxity.EDITOR_INT, 42) |
| 88 | </code></pre> |
| 89 | <p>In <em>init_script()</em> we define the editors that will be presented to the user and set some metadata like the name of the script displayed to the user and the script author.</p> |
| 90 | <h3 id="init_render">init_render()</h3> |
| 91 | <pre><code>def init_render(fctx): |
| 92 | # The script is possibly rendered using multiple processes and we need to have the |
| 93 | # same sequence of random numbers in all processes. If we don't set seed we'll get completely different |
| 94 | # ball positions, colors and speeds in different rendering processes. |
| 95 | random.seed(fctx.get_editor_value("Random Seed")) |
| 96 | |
| 97 | # Ball colors data structure |
| 98 | hue = fctx.get_editor_value("Hue") |
| 99 | hr, hg, hb, alpha = hue |
| 100 | fctx.set_data_obj("hue_tuple", hue) |
| 101 | color_array = list(hue) |
| 102 | ball_colors = [] |
| 103 | color_mult = 1.05 |
| 104 | opacity = float(fctx.get_editor_value("Opacity")) / 100.0 |
| 105 | |
| 106 | for i in range(0, 10): |
| 107 | array = np.array(color_array) * color_mult |
| 108 | r, g, b, a = array |
| 109 | ball_colors.append(cairo.SolidPattern(_clamp(r), _clamp(g), _clamp(b), opacity)) |
| 110 | color_array = array |
| 111 | fctx.set_data_obj("ball_colors", ball_colors) |
| 112 | |
| 113 | # Ball animations data structure |
| 114 | ball_data = [] |
| 115 | number_of_balls = fctx.get_editor_value("Number of Items") |
| 116 | speed = fctx.get_editor_value("Speed") |
| 117 | speed_var_size_precentage = fctx.get_editor_value("Speed Variation %") |
| 118 | speed_var_max = speed * (speed_var_size_precentage / 100.0) |
| 119 | size = fctx.get_editor_value("Size") |
| 120 | size_var_size_precentage = fctx.get_editor_value("Size Variation %") |
| 121 | size_var_max = size * (size_var_size_precentage / 100.0) |
| 122 | size_max = size + size_var_max |
| 123 | fctx.set_data_obj("size_max", size_max) |
| 124 | |
| 125 | for i in range(0, number_of_balls): |
| 126 | path_pos = random.uniform(0.0, 1.0) |
| 127 | y = random.randint(-330, 1080 + 330) |
| 128 | speed_var = random.uniform(-1.0, 1.0) |
| 129 | |
| 130 | ball_speed = speed + (speed_var * speed_var_max) |
| 131 | size_var = random.uniform(-1.0, 1.0) |
| 132 | ball_size = size + (size_var * size_var_max) |
| 133 | color_index = random.randint(0, 9) |
| 134 | ball_data.append((path_pos, y, ball_speed, ball_size, color_index)) |
| 135 | |
| 136 | fctx.set_data_obj("ball_data", ball_data) |
| 137 | </code></pre> |
| 138 | <p>In <em>init_render()</em> we read editor values set by the user and create data structures for moving ball animations.</p> |
| 139 | <p>Also note that <strong>we need to set seed for Pythom module 'random'</strong> because when a frame sequence is rendered using multiple processes we need the exact same sequence of random numbers produced in every process. </p> |
| 140 | <h3 id="render_frame">render_frame()</h3> |
| 141 | <pre><code>def render_frame(frame, fctx, w, h): |
| 142 | cr = fctx.get_frame_cr() |
| 143 | |
| 144 | # Draw bg |
| 145 | bg_color = cairo.SolidPattern(*fctx.get_data_obj("hue_tuple")) |
| 146 | ball_colors = fctx.get_data_obj("ball_colors") |
| 147 | ball_data = fctx.get_data_obj("ball_data") |
| 148 | |
| 149 | cr.set_source(bg_color) |
| 150 | cr.rectangle(0, 0, w, h) |
| 151 | cr.fill() |
| 152 | |
| 153 | # Draw balls |
| 154 | number_of_balls = fctx.get_editor_value("Number of Items") |
| 155 | size_max = fctx.get_data_obj("size_max") |
| 156 | path_start_x = - size_max |
| 157 | path_end_x = w + size_max |
| 158 | path_len = path_end_x - path_start_x |
| 159 | SPEED_NORM_PER_FRAME = 15.0 / float(w) # Speed value 1.0 gets 15 pixels of movement per frame. |
| 160 | for i in range(0, number_of_balls): |
| 161 | path_pos, y, ball_speed, ball_size, color_index = ball_data[i] |
| 162 | xc = ball_size / 2.0 |
| 163 | yc = ball_size / 2.0 |
| 164 | xpos_norm = path_pos + (float(frame) * ball_speed * SPEED_NORM_PER_FRAME) |
| 165 | while xpos_norm > 1.0: |
| 166 | xpos_norm = xpos_norm - 1.0 |
| 167 | x = path_start_x + path_len * xpos_norm |
| 168 | cr.save() |
| 169 | cr.translate(x, y) |
| 170 | cr.arc(xc, yc, ball_size / 4.0, 0.0, 2.0 * math.pi) |
| 171 | cr.set_source(ball_colors[color_index]) |
| 172 | cr.fill() |
| 173 | cr.restore() |
| 174 | |
| 175 | # ----------------------- helper func |
| 176 | def _clamp(v): |
| 177 | return max(min(v, 1.0), 0.0) |
| 178 | |
| 179 | </code></pre> |
| 180 | <p>In <em>render_frame()</em> we first acquire <em>Cairo.Context</em> object that can be drawn onto to create output for the frame.</p> |
| 181 | <p>After that the data structures created in <em>init_render()</em> are accessed and image is drawn.</p> |
| 182 | <p>There is a helper function <em>_clamp(v)</em> used to make sure that all color values are in range 0-1. Any number of helper functions, objects and data structures can be created.</p> |
| 183 | <h2 id="developing-fluxity-scripts">DEVELOPING FLUXITY SCRIPTS</h2> |
| 184 | <p><strong>Flowblade</strong> comes with a simple GUI tool for developing Fluxity scripts. It can be accessed from menu <strong>Tools->Generator Script Editor</strong>.</p> |
| 185 | <p>Using the development tool you can edit scripts, render output from them, and receive error messages whenthings go wrong. From hamburger menu you can open and save your own scripts, access this document, and open and inspect example code from <em>Generators</em> distributed with Flowblade. </p> |
| 186 | <p>Since the text editor in the development tool is quite rudimentary, it can be a useful workflow to use an external text editor to edit the scripts, and press <em>Reload Script</em> button to update text area contents before attempting render.</p> |
| 187 | <h2 id="fluxity-api-versions">FLUXITY API VERSIONS</h2> |
| 188 | <table> |
| 189 | <thead> |
| 190 | <tr> |
| 191 | <th style="text-align: left;">VERSION</th> |
| 192 | <th style="text-align: left;">CHANGES</th> |
| 193 | </tr> |
| 194 | </thead> |
| 195 | <tbody> |
| 196 | <tr> |
| 197 | <td style="text-align: left;">1</td> |
| 198 | <td style="text-align: left;">Initial release.</td> |
| 199 | </tr> |
| 200 | <tr> |
| 201 | <td style="text-align: left;">2</td> |
| 202 | <td style="text-align: left;">Added methods FluxityContext.required_api_version(), FluxityContext.add_editor_group()</td> |
| 203 | </tr> |
| 204 | <tr> |
| 205 | <td style="text-align: left;">3</td> |
| 206 | <td style="text-align: left;">Added method FluxityContext.get_editors_values_clone_dict(), Added editor EDITOR_HTML_LINK, added global variable LOCAL_ROOT</td> |
| 207 | </tr> |
| 208 | </tbody> |
| 209 | </table> |
| 210 | <h1 id="fluxity-api">FLUXITY API</h1> |
| 211 | </section> |
| 212 | <section> |
| 213 | </section> |
| 214 | <section> |
| 215 | <h2 class="section-title" id="header-variables">Global variables</h2> |
| 216 | <dl> |
| 217 | <dt id="fluxity.API_VERSION"><code class="name">var <span class="ident">API_VERSION</span></code></dt> |
| 218 | <dd> |
| 219 | <div class="desc"><p>API version number, increasing integer for each Flowblade release with changes.</p></div> |
| 220 | </dd> |
| 221 | <dt id="fluxity.EDITOR_CHECK_BOX"><code class="name">var <span class="ident">EDITOR_CHECK_BOX</span></code></dt> |
| 222 | <dd> |
| 223 | <div class="desc"><p>Editor for boolean value. Value is either <em>True</em> or <em>False</em></p></div> |
| 224 | </dd> |
| 225 | <dt id="fluxity.EDITOR_COLOR"><code class="name">var <span class="ident">EDITOR_COLOR</span></code></dt> |
| 226 | <dd> |
| 227 | <div class="desc"><p>Editor for colors. Value is a <em>(R,G,B,A)</em> tuple with values in range 0-1.</p></div> |
| 228 | </dd> |
| 229 | <dt id="fluxity.EDITOR_FILE_PATH"><code class="name">var <span class="ident">EDITOR_FILE_PATH</span></code></dt> |
| 230 | <dd> |
| 231 | <div class="desc"><p>Editor for selecting a file path. Value is Python pathname or <em>None</em>.</p></div> |
| 232 | </dd> |
| 233 | <dt id="fluxity.EDITOR_FLOAT"><code class="name">var <span class="ident">EDITOR_FLOAT</span></code></dt> |
| 234 | <dd> |
| 235 | <div class="desc"><p>Editor for float values.</p></div> |
| 236 | </dd> |
| 237 | <dt id="fluxity.EDITOR_FLOAT_RANGE"><code class="name">var <span class="ident">EDITOR_FLOAT_RANGE</span></code></dt> |
| 238 | <dd> |
| 239 | <div class="desc"><p>Editor for float values with a defined range of accepted values. Value is a 3-tuple <em>(default_val, min_val, max_val)</em>.</p></div> |
| 240 | </dd> |
| 241 | <dt id="fluxity.EDITOR_HTML_LINK"><code class="name">var <span class="ident">EDITOR_HTML_LINK</span></code></dt> |
| 242 | <dd> |
| 243 | <div class="desc"><p>Editor for opening a HTML page, generally to make some additional documentation available.</p></div> |
| 244 | </dd> |
| 245 | <dt id="fluxity.EDITOR_INT"><code class="name">var <span class="ident">EDITOR_INT</span></code></dt> |
| 246 | <dd> |
| 247 | <div class="desc"><p>Editor for integer values.</p></div> |
| 248 | </dd> |
| 249 | <dt id="fluxity.EDITOR_INT_RANGE"><code class="name">var <span class="ident">EDITOR_INT_RANGE</span></code></dt> |
| 250 | <dd> |
| 251 | <div class="desc"><p>Editor for integer values with a defined range of accepted values. Value is a 3-tuple <em>(default_val, min_val, max_val)</em></p></div> |
| 252 | </dd> |
| 253 | <dt id="fluxity.EDITOR_OPTIONS"><code class="name">var <span class="ident">EDITOR_OPTIONS</span></code></dt> |
| 254 | <dd> |
| 255 | <div class="desc"><p>Editor for selecting between |
| 256 | 2 - N |
| 257 | string options. Value is tuple <em>(selected_index,[option_str_1, option_str_2, …])</em>.</p></div> |
| 258 | </dd> |
| 259 | <dt id="fluxity.EDITOR_PANGO_FONT"><code class="name">var <span class="ident">EDITOR_PANGO_FONT</span></code></dt> |
| 260 | <dd> |
| 261 | <div class="desc"><p>Editor for setting pango font properties.</p></div> |
| 262 | </dd> |
| 263 | <dt id="fluxity.EDITOR_PANGO_FONT_DEFAULT_VALUES"><code class="name">var <span class="ident">EDITOR_PANGO_FONT_DEFAULT_VALUES</span></code></dt> |
| 264 | <dd> |
| 265 | <div class="desc"><p>Pango Font Editor default values.</p></div> |
| 266 | </dd> |
| 267 | <dt id="fluxity.EDITOR_TEXT"><code class="name">var <span class="ident">EDITOR_TEXT</span></code></dt> |
| 268 | <dd> |
| 269 | <div class="desc"><p>Editor for strings.</p></div> |
| 270 | </dd> |
| 271 | <dt id="fluxity.EDITOR_TEXT_AREA"><code class="name">var <span class="ident">EDITOR_TEXT_AREA</span></code></dt> |
| 272 | <dd> |
| 273 | <div class="desc"><p>Editor for creating multiline text.</p></div> |
| 274 | </dd> |
| 275 | <dt id="fluxity.KEYFRAME_DISCRETE"><code class="name">var <span class="ident">KEYFRAME_DISCRETE</span></code></dt> |
| 276 | <dd> |
| 277 | <div class="desc"><p>Value after keyframe of this type is value at keyframe.</p></div> |
| 278 | </dd> |
| 279 | <dt id="fluxity.KEYFRAME_LINEAR"><code class="name">var <span class="ident">KEYFRAME_LINEAR</span></code></dt> |
| 280 | <dd> |
| 281 | <div class="desc"><p>Value after keyframe of this type is linearly interpolated using two surrounding keyframe values.</p></div> |
| 282 | </dd> |
| 283 | <dt id="fluxity.KEYFRAME_SMOOTH"><code class="name">var <span class="ident">KEYFRAME_SMOOTH</span></code></dt> |
| 284 | <dd> |
| 285 | <div class="desc"><p>Value after keyframe of this type is calculated using a Catmull-Rom curve created from four surrounding keyframe values.</p></div> |
| 286 | </dd> |
| 287 | <dt id="fluxity.LOCAL_ROOT"><code class="name">var <span class="ident">LOCAL_ROOT</span></code></dt> |
| 288 | <dd> |
| 289 | <div class="desc"><p>This value is replaced with an absolute path to local installation root directory when creating a path to a local resource.</p></div> |
| 290 | </dd> |
| 291 | <dt id="fluxity.PROFILE_COLORSPACE"><code class="name">var <span class="ident">PROFILE_COLORSPACE</span></code></dt> |
| 292 | <dd> |
| 293 | <div class="desc"><p>Profile colorspace, value is either 709, 601 or 2020.</p></div> |
| 294 | </dd> |
| 295 | <dt id="fluxity.PROFILE_DESCRIPTION"><code class="name">var <span class="ident">PROFILE_DESCRIPTION</span></code></dt> |
| 296 | <dd> |
| 297 | <div class="desc"><p>MLT Profile descriptiption string.</p></div> |
| 298 | </dd> |
| 299 | <dt id="fluxity.PROFILE_DISPLAY_ASPECT_DEN"><code class="name">var <span class="ident">PROFILE_DISPLAY_ASPECT_DEN</span></code></dt> |
| 300 | <dd> |
| 301 | <div class="desc"><p>Output image size fraction denominator.</p></div> |
| 302 | </dd> |
| 303 | <dt id="fluxity.PROFILE_DISPLAY_ASPECT_NUM"><code class="name">var <span class="ident">PROFILE_DISPLAY_ASPECT_NUM</span></code></dt> |
| 304 | <dd> |
| 305 | <div class="desc"><p>Output image size fraction numerator.</p></div> |
| 306 | </dd> |
| 307 | <dt id="fluxity.PROFILE_FRAME_RATE_DEN"><code class="name">var <span class="ident">PROFILE_FRAME_RATE_DEN</span></code></dt> |
| 308 | <dd> |
| 309 | <div class="desc"><p>Frame rate denominator.</p></div> |
| 310 | </dd> |
| 311 | <dt id="fluxity.PROFILE_FRAME_RATE_NUM"><code class="name">var <span class="ident">PROFILE_FRAME_RATE_NUM</span></code></dt> |
| 312 | <dd> |
| 313 | <div class="desc"><p>Frame rate numerator.</p></div> |
| 314 | </dd> |
| 315 | <dt id="fluxity.PROFILE_HEIGHT"><code class="name">var <span class="ident">PROFILE_HEIGHT</span></code></dt> |
| 316 | <dd> |
| 317 | <div class="desc"><p>Output image height in pixels.</p></div> |
| 318 | </dd> |
| 319 | <dt id="fluxity.PROFILE_PROGRESSIVE"><code class="name">var <span class="ident">PROFILE_PROGRESSIVE</span></code></dt> |
| 320 | <dd> |
| 321 | <div class="desc"><p>MLT Profile image is progressive if value is <em>True</em>, if value is <em>False</em> image is interlaced.</p></div> |
| 322 | </dd> |
| 323 | <dt id="fluxity.PROFILE_SAMPLE_ASPECT_DEN"><code class="name">var <span class="ident">PROFILE_SAMPLE_ASPECT_DEN</span></code></dt> |
| 324 | <dd> |
| 325 | <div class="desc"><p>Pixel size fraction denominator.</p></div> |
| 326 | </dd> |
| 327 | <dt id="fluxity.PROFILE_SAMPLE_ASPECT_NUM"><code class="name">var <span class="ident">PROFILE_SAMPLE_ASPECT_NUM</span></code></dt> |
| 328 | <dd> |
| 329 | <div class="desc"><p>Pixel size fraction numerator.</p></div> |
| 330 | </dd> |
| 331 | <dt id="fluxity.PROFILE_WIDTH"><code class="name">var <span class="ident">PROFILE_WIDTH</span></code></dt> |
| 332 | <dd> |
| 333 | <div class="desc"><p>Output image width in pixels.</p></div> |
| 334 | </dd> |
| 335 | </dl> |
| 336 | </section> |
| 337 | <section> |
| 338 | <h2 class="section-title" id="header-functions">Functions</h2> |
| 339 | <dl> |
| 340 | <dt id="fluxity.get_script_default_edit_data"><code class="name flex"> |
| 341 | <span>def <span class="ident">get_script_default_edit_data</span></span>(<span>script, script_file, out_folder, profile_file_path)</span> |
| 342 | </code></dt> |
| 343 | <dd> |
| 344 | <div class="desc"><p><strong>script(str)</strong> Script to be rendered as a string.</p> |
| 345 | <p><strong>script_file(str)</strong> Absolute path to a file containing script. If this is not provided, some methods like <em>FluxityContext.get_script_dir()</em> will not function as intended.</p> |
| 346 | <p><strong>out_folder(str)</strong> Path to the folder where rendered frame will be saved.</p> |
| 347 | <p><strong>profile_file_path(str)</strong> Path to a file containing a file describing a MLT profile used when rendering the script.</p> |
| 348 | <p>Creates a <em>FluxityContext</em> object, calls <em>init_script()</em> on it </p> |
| 349 | <p><strong>Returns:</strong> (str, dict) Tuple of error message string and Python dict representation of Json object created with <em>FluxityContext.get_script_data()</em>. Error message string will be <em>None</em> if no error occurred.</p></div> |
| 350 | </dd> |
| 351 | </dl> |
| 352 | </section> |
| 353 | <section> |
| 354 | <h2 class="section-title" id="header-classes">Classes</h2> |
| 355 | <dl> |
| 356 | <dt id="fluxity.AffineTransform"><code class="flex name class"> |
| 357 | <span>class <span class="ident">AffineTransform</span></span> |
| 358 | </code></dt> |
| 359 | <dd> |
| 360 | <div class="desc"><p>Object for describing animated affine transforms and applying them on <em><code>cairo.Context</code></em>.</p> |
| 361 | <p>On creation object creates following instance <em><code><a title="fluxity.AnimatedValue" href="#fluxity.AnimatedValue">AnimatedValue</a></code></em> attributes:</p> |
| 362 | <p><strong><code>x</code></strong> X position in pixels.</p> |
| 363 | <p><strong><code>y</code></strong> Y position in pixels.</p> |
| 364 | <p><strong><code>anchor_x</code></strong> Rotation and scaling offset from <em><code>source</code></em> top left corner in x axis pixels.</p> |
| 365 | <p><strong><code>anchor_y</code></strong> Rotation and scaling offset from <em><code>source</code></em> top left corner in y axis pixels.</p> |
| 366 | <p><strong><code>scale_x</code></strong> Scaling in x-axis as float value.</p> |
| 367 | <p><strong><code>scale_y</code></strong> Scaling in y-axis as float value.</p> |
| 368 | <p><strong><code>rotation</code></strong> Rotation in degrees.</p> |
| 369 | <p>Default value for all attributes is value 0.0 at keyframe 0, except <code>scale_x</code> and <code>scale_y</code> which have default value of 1.0 at keyframe 0.</p> |
| 370 | <p>The intended usage pattern:</p> |
| 371 | <ul> |
| 372 | <li> |
| 373 | <p>create <em><code><a title="fluxity.AffineTransform" href="#fluxity.AffineTransform">AffineTransform</a></code></em> object and set values to needed attributes to create animations.</p> |
| 374 | </li> |
| 375 | <li> |
| 376 | <p>for each frame first call method <em><code><a title="fluxity.AffineTransform.apply_transform" href="#fluxity.AffineTransform.apply_transform">AffineTransform.apply_transform()</a></code></em> to apply the affine transform.</p> |
| 377 | </li> |
| 378 | <li> |
| 379 | <p>draw <em><code>source</code></em> in <code>origo(0,0)</code> position.</p> |
| 380 | </li> |
| 381 | </ul></div> |
| 382 | <details class="source"> |
| 383 | <summary> |
| 384 | <span>Expand source code</span> |
| 385 | </summary> |
| 386 | <pre><code class="python">class AffineTransform: |
| 387 | |
| 388 | """ |
| 389 | Object for describing animated affine transforms and applying them on *`cairo.Context`*. |
| 390 | |
| 391 | On creation object creates following instance *`fluxity.AnimatedValue`* attributes: |
| 392 | |
| 393 | **`x`** X position in pixels. |
| 394 | |
| 395 | **`y`** Y position in pixels. |
| 396 | |
| 397 | **`anchor_x`** Rotation and scaling offset from *`source`* top left corner in x axis pixels. |
| 398 | |
| 399 | **`anchor_y`** Rotation and scaling offset from *`source`* top left corner in y axis pixels. |
| 400 | |
| 401 | **`scale_x`** Scaling in x-axis as float value. |
| 402 | |
| 403 | **`scale_y`** Scaling in y-axis as float value. |
| 404 | |
| 405 | **`rotation`** Rotation in degrees. |
| 406 | |
| 407 | Default value for all attributes is value 0.0 at keyframe 0, except `scale_x` and `scale_y` which have default value of 1.0 at keyframe 0. |
| 408 | |
| 409 | The intended usage pattern: |
| 410 | |
| 411 | * create *`fluxity.AffineTransform`* object and set values to needed attributes to create animations. |
| 412 | |
| 413 | * for each frame first call method *`fluxity.AffineTransform.apply_transform()`* to apply the affine transform. |
| 414 | |
| 415 | * draw *`source`* in `origo(0,0)` position. |
| 416 | """ |
| 417 | |
| 418 | def __init__(self): |
| 419 | self.x = AnimatedValue() |
| 420 | self.y = AnimatedValue() |
| 421 | self.anchor_x = AnimatedValue() |
| 422 | self.anchor_y = AnimatedValue() |
| 423 | self.scale_x = AnimatedValue(1.0) |
| 424 | self.scale_y = AnimatedValue(1.0) |
| 425 | self.rotation = AnimatedValue() |
| 426 | |
| 427 | def apply_transform(self, cr, frame): |
| 428 | """ |
| 429 | **`cr(cairo.Context)`** a `cairo.Context` object. |
| 430 | |
| 431 | **`frame(int)`** Frame number in range 0 - (plugin length). |
| 432 | |
| 433 | Applies affine transform defined by object instance at given frame on `cairo.Context` object. |
| 434 | """ |
| 435 | scale_x = self.scale_x.get_value(frame) |
| 436 | scale_y = self.scale_y.get_value(frame) |
| 437 | rotation_angle = self.rotation.get_value(frame) |
| 438 | |
| 439 | anchor_x = scale_x * self.anchor_x.get_value(frame) |
| 440 | anchor_y = scale_y * self.anchor_y.get_value(frame) |
| 441 | |
| 442 | axr, ayr = self._rotate_point_around_origo(rotation_angle, (anchor_x, anchor_y)) |
| 443 | |
| 444 | tx = self.x.get_value(frame) - axr |
| 445 | ty = self.y.get_value(frame) - ayr |
| 446 | |
| 447 | cr.translate(tx, ty) |
| 448 | cr.rotate(math.radians(rotation_angle)) |
| 449 | cr.scale(scale_x, scale_y) |
| 450 | |
| 451 | def _rotate_point_around_origo(self, rotation_angle, p): |
| 452 | px, py = p |
| 453 | angle_rad = math.radians(rotation_angle) |
| 454 | sin_val = math.sin(angle_rad) |
| 455 | cos_val = math.cos(angle_rad) |
| 456 | new_x = px * cos_val - py * sin_val |
| 457 | new_y = px * sin_val + py * cos_val |
| 458 | return (new_x, new_y)</code></pre> |
| 459 | </details> |
| 460 | <h3>Methods</h3> |
| 461 | <dl> |
| 462 | <dt id="fluxity.AffineTransform.apply_transform"><code class="name flex"> |
| 463 | <span>def <span class="ident">apply_transform</span></span>(<span>self, cr, frame)</span> |
| 464 | </code></dt> |
| 465 | <dd> |
| 466 | <div class="desc"><p><strong><code>cr(cairo.Context)</code></strong> a <code>cairo.Context</code> object.</p> |
| 467 | <p><strong><code>frame(int)</code></strong> Frame number in range 0 - (plugin length).</p> |
| 468 | <p>Applies affine transform defined by object instance at given frame on <code>cairo.Context</code> object.</p></div> |
| 469 | </dd> |
| 470 | </dl> |
| 471 | </dd> |
| 472 | <dt id="fluxity.AnimatedValue"><code class="flex name class"> |
| 473 | <span>class <span class="ident">AnimatedValue</span></span> |
| 474 | <span>(</span><span>value=0.0)</span> |
| 475 | </code></dt> |
| 476 | <dd> |
| 477 | <div class="desc"><p>Object for animating a float value.</p> |
| 478 | <p>Changing value is controlled by adding keyframes.</p> |
| 479 | <p>A keyframe has <em>frame position, value</em> and <em>type</em>. There are three types of keyframes: <code><a title="fluxity.KEYFRAME_LINEAR" href="#fluxity.KEYFRAME_LINEAR">KEYFRAME_LINEAR</a></code>, <code><a title="fluxity.KEYFRAME_SMOOTH" href="#fluxity.KEYFRAME_SMOOTH">KEYFRAME_SMOOTH</a></code> and <code><a title="fluxity.KEYFRAME_DISCRETE" href="#fluxity.KEYFRAME_DISCRETE">KEYFRAME_DISCRETE</a></code>.</p> |
| 480 | <ul> |
| 481 | <li> |
| 482 | <p><strong><code><a title="fluxity.KEYFRAME_LINEAR" href="#fluxity.KEYFRAME_LINEAR">KEYFRAME_LINEAR</a></code></strong> Value after keyframe is linearly interpolated using two surrounding keyframe values.</p> |
| 483 | </li> |
| 484 | <li> |
| 485 | <p><strong><code><a title="fluxity.KEYFRAME_SMOOTH" href="#fluxity.KEYFRAME_SMOOTH">KEYFRAME_SMOOTH</a></code></strong> Value after keyframe is calculated using a Catmull-Rom curve created from four surrounding keyframe values.</p> |
| 486 | </li> |
| 487 | <li> |
| 488 | <p><strong><code><a title="fluxity.KEYFRAME_DISCRETE" href="#fluxity.KEYFRAME_DISCRETE">KEYFRAME_DISCRETE</a></code></strong> Value after keyframe is value at keyframe.</p> |
| 489 | </li> |
| 490 | </ul> |
| 491 | <p>Implementation assumes there always being a keyframe at frame 0, and removing that will result in undefined behaviour. It is of course possible to overwrite existing keyframe at frame 0 using method <em>add_keyframe_at_frame().</em></p></div> |
| 492 | <details class="source"> |
| 493 | <summary> |
| 494 | <span>Expand source code</span> |
| 495 | </summary> |
| 496 | <pre><code class="python">class AnimatedValue: |
| 497 | |
| 498 | """ |
| 499 | Object for animating a float value. |
| 500 | |
| 501 | Changing value is controlled by adding keyframes. |
| 502 | |
| 503 | A keyframe has *frame position, value* and *type*. There are three types of keyframes: `KEYFRAME_LINEAR`, `KEYFRAME_SMOOTH` and `KEYFRAME_DISCRETE`. |
| 504 | |
| 505 | * **`KEYFRAME_LINEAR`** Value after keyframe is linearly interpolated using two surrounding keyframe values. |
| 506 | |
| 507 | * **`KEYFRAME_SMOOTH`** Value after keyframe is calculated using a Catmull-Rom curve created from four surrounding keyframe values. |
| 508 | |
| 509 | * **`KEYFRAME_DISCRETE`** Value after keyframe is value at keyframe. |
| 510 | |
| 511 | Implementation assumes there always being a keyframe at frame 0, and removing that will result in undefined behaviour. It is of course possible to overwrite existing keyframe at frame 0 using method *add_keyframe_at_frame().* |
| 512 | """ |
| 513 | def __init__(self, value=0.0): |
| 514 | # We enforce a keyframe always existing in frame 0 |
| 515 | self.keyframes = [(0, value, KEYFRAME_LINEAR)] |
| 516 | |
| 517 | def add_keyframe_at_frame(self, frame, value, kf_type): |
| 518 | """ |
| 519 | **`frame(int)`** Frame number in range 0 - (plugin length). |
| 520 | |
| 521 | **`value(float)`** A float value. |
| 522 | |
| 523 | **`kf_type(KEYFRAME_LINEAR|KEYFRAME_SMOOTH|KEYFRAME_DISCRETE)`** Type of added keyframe. |
| 524 | |
| 525 | Adds or overwrites a keyframe. |
| 526 | |
| 527 | If frame is on existing keyframe that keyframe is replaced. |
| 528 | |
| 529 | If frame is between two keyframes a new keyframe is added between keyframes. |
| 530 | |
| 531 | If frame is after last keyframe a new keyframe is appended. |
| 532 | """ |
| 533 | |
| 534 | # Replace if kf in frame exists. |
| 535 | new_kf = (frame, value, kf_type) |
| 536 | kf_index_on_frame = self._frame_has_keyframe(frame) |
| 537 | if kf_index_on_frame != -1: |
| 538 | self.keyframes.pop(kf_index_on_frame) |
| 539 | self.keyframes.insert(kf_index_on_frame, new_kf) |
| 540 | return |
| 541 | |
| 542 | # Insert between if frame between two kfs. |
| 543 | for i in range(0, len(self.keyframes)): |
| 544 | kf_frame, kf_value, kf_type = self.keyframes[i] |
| 545 | if kf_frame > frame: |
| 546 | prev_frame, prev_value, prev_type = self.keyframes[i - 1] |
| 547 | self.keyframes.insert(i, new_kf) |
| 548 | self.active_kf_index = i |
| 549 | return |
| 550 | |
| 551 | # Append last if after last kf. |
| 552 | self.keyframes.append(new_kf) |
| 553 | |
| 554 | def _frame_has_keyframe(self, frame): |
| 555 | for i in range(0, len(self.keyframes)): |
| 556 | kf_frame, kf_value, type = self.keyframes[i] |
| 557 | if frame == kf_frame: |
| 558 | return i |
| 559 | |
| 560 | return -1 |
| 561 | |
| 562 | def get_value(self, frame): |
| 563 | """ |
| 564 | **`frame(int)`** Frame number in range 0 - (plugin length). |
| 565 | |
| 566 | Computes and returns value at frame using current keyframe values, positions and types. |
| 567 | |
| 568 | **Returns:** (float) value at frame. |
| 569 | """ |
| 570 | last_frame, last_value, last_type = self.keyframes[-1] |
| 571 | if frame >= last_frame: # This also handles case len(self.keyframes) == 1 because first keyframe always at frame 0. |
| 572 | return last_value |
| 573 | |
| 574 | for i in range(0, len(self.keyframes) - 1): |
| 575 | kf_frame, kf_value, kf_type = self.keyframes[i] |
| 576 | if frame == kf_frame: |
| 577 | return kf_value |
| 578 | next_frame, next_value, next_type = self.keyframes[i + 1] |
| 579 | if frame == next_frame: |
| 580 | return next_value |
| 581 | if frame > kf_frame and frame < next_frame: |
| 582 | if kf_type == KEYFRAME_LINEAR: |
| 583 | fract = (frame - kf_frame) / (next_frame - kf_frame) |
| 584 | return kf_value + fract * (next_value - kf_value) |
| 585 | elif kf_type == KEYFRAME_SMOOTH: |
| 586 | return self._get_smooth_value(i, frame) |
| 587 | else: # KEYFRAME_DISCRETE |
| 588 | return kf_value |
| 589 | |
| 590 | return None # We absolutely want to crash if somehow we hit this. |
| 591 | |
| 592 | def _get_smooth_value(self, i, frame): |
| 593 | # Get indexes of the four keyframes that affect the drawn curve. |
| 594 | prev = i |
| 595 | if i == 0: |
| 596 | prev_prev = 0 |
| 597 | else: |
| 598 | prev_prev = i - 1 |
| 599 | |
| 600 | next = i + 1 |
| 601 | if next >= len(self.keyframes): |
| 602 | next = len(self.keyframes) - 1 |
| 603 | |
| 604 | next_next = next + 1 |
| 605 | if next_next >= len(self.keyframes): |
| 606 | next_next = len(self.keyframes) - 1 |
| 607 | |
| 608 | # Get keyframes. |
| 609 | frame_pp, val0, kf_type = self.keyframes[prev_prev] |
| 610 | frame_p, val1, kf_type = self.keyframes[prev] |
| 611 | frame_n, val2, kf_type = self.keyframes[next] |
| 612 | frame_nn, val3, kf_type = self.keyframes[next_next] |
| 613 | |
| 614 | # Get value |
| 615 | fract = (frame - frame_p) / (frame_n - frame_p) |
| 616 | smooth_val = self._catmull_rom_interpolate(val0, val1, val2, val3, fract) |
| 617 | return smooth_val |
| 618 | |
| 619 | # These all need to be doubles. |
| 620 | def _catmull_rom_interpolate(self, y0, y1, y2, y3, t): |
| 621 | t2 = t * t |
| 622 | a0 = -0.5 * y0 + 1.5 * y1 - 1.5 * y2 + 0.5 * y3 |
| 623 | a1 = y0 - 2.5 * y1 + 2 * y2 - 0.5 * y3 |
| 624 | a2 = -0.5 * y0 + 0.5 * y2 |
| 625 | a3 = y1 |
| 626 | return a0 * t * t2 + a1 * t2 + a2 * t + a3</code></pre> |
| 627 | </details> |
| 628 | <h3>Methods</h3> |
| 629 | <dl> |
| 630 | <dt id="fluxity.AnimatedValue.add_keyframe_at_frame"><code class="name flex"> |
| 631 | <span>def <span class="ident">add_keyframe_at_frame</span></span>(<span>self, frame, value, kf_type)</span> |
| 632 | </code></dt> |
| 633 | <dd> |
| 634 | <div class="desc"><p><strong><code>frame(int)</code></strong> Frame number in range 0 - (plugin length).</p> |
| 635 | <p><strong><code>value(float)</code></strong> A float value.</p> |
| 636 | <p><strong><code>kf_type(KEYFRAME_LINEAR|KEYFRAME_SMOOTH|KEYFRAME_DISCRETE)</code></strong> Type of added keyframe.</p> |
| 637 | <p>Adds or overwrites a keyframe.</p> |
| 638 | <p>If frame is on existing keyframe that keyframe is replaced.</p> |
| 639 | <p>If frame is between two keyframes a new keyframe is added between keyframes.</p> |
| 640 | <p>If frame is after last keyframe a new keyframe is appended.</p></div> |
| 641 | </dd> |
| 642 | <dt id="fluxity.AnimatedValue.get_value"><code class="name flex"> |
| 643 | <span>def <span class="ident">get_value</span></span>(<span>self, frame)</span> |
| 644 | </code></dt> |
| 645 | <dd> |
| 646 | <div class="desc"><p><strong><code>frame(int)</code></strong> Frame number in range 0 - (plugin length).</p> |
| 647 | <p>Computes and returns value at frame using current keyframe values, positions and types.</p> |
| 648 | <p><strong>Returns:</strong> (float) value at frame.</p></div> |
| 649 | </dd> |
| 650 | </dl> |
| 651 | </dd> |
| 652 | <dt id="fluxity.FluxityContext"><code class="flex name class"> |
| 653 | <span>class <span class="ident">FluxityContext</span></span> |
| 654 | <span>(</span><span>script_file, output_folder)</span> |
| 655 | </code></dt> |
| 656 | <dd> |
| 657 | <div class="desc"></div> |
| 658 | <details class="source"> |
| 659 | <summary> |
| 660 | <span>Expand source code</span> |
| 661 | </summary> |
| 662 | <pre><code class="python">class FluxityContext: |
| 663 | |
| 664 | def __init__(self, script_file, output_folder): |
| 665 | self.priv_context = FluxityContextPrivate(output_folder) |
| 666 | self.script_file = script_file |
| 667 | self.data = {} |
| 668 | self.editors = {} # editors and script length |
| 669 | self.groups = {} |
| 670 | self.editor_tooltips = {} |
| 671 | self.length = DEFAULT_LENGTH |
| 672 | self.name = "Name Not Set" |
| 673 | self.version = 1 |
| 674 | self.author = "Author Not Set" |
| 675 | self.error = None |
| 676 | self.log_msg = "" |
| 677 | |
| 678 | def get_frame_cr(self): |
| 679 | """ |
| 680 | For every rendered frame method *`render_frame()`* is called and a new **`cairo.ImageSurface`** object is created. |
| 681 | |
| 682 | This method provides access to **`cairo.Context`** object that can be used to draw onto that image surface. This is the way that output is achieved with **Flowblade Media Plugins**. |
| 683 | |
| 684 | After method *`render_frame()`* exits, **`cairo.Context`** object is no longer valid and contents of **`cairo.ImageSurface`** are saved to disk. |
| 685 | |
| 686 | Must be called in script method *`render_frame()`*. |
| 687 | |
| 688 | **Returns:** (**`cairo.Context`**) Context object that can be drawn onto. |
| 689 | """ |
| 690 | return self.priv_context.frame_cr |
| 691 | |
| 692 | def get_dimensions(self): |
| 693 | """ |
| 694 | Pixel size of output image. |
| 695 | |
| 696 | **Returns:** (int, int) Tuple (width, height) of output image size. |
| 697 | """ |
| 698 | w = self.priv_context.profile.get_profile_property(PROFILE_WIDTH) |
| 699 | h = self.priv_context.profile.get_profile_property(PROFILE_HEIGHT) |
| 700 | return (w, h) |
| 701 | |
| 702 | def get_profile_property(self, p_property): |
| 703 | """ |
| 704 | **`p_property(str):`** propertyr identyfier, e.g. `fluxity.PROFILE_PROGRESSIVE`. |
| 705 | |
| 706 | Used to access properties of MLT profile set before running the script that defines e.g. output image size. |
| 707 | |
| 708 | **Returns:** (int || boolean || string) Value depends on which profile property is being accessed. |
| 709 | """ |
| 710 | return self.priv_context.profile.get_profile_property(p_property) |
| 711 | |
| 712 | def set_name(self, name): |
| 713 | """ |
| 714 | **`name(str):`** name of script displayed to user. |
| 715 | |
| 716 | Sets name of the script displayed to the user. Must be called in script method *`init_script()`*. |
| 717 | """ |
| 718 | self.priv_context.error_on_wrong_method("set_name()", METHOD_INIT_SCRIPT) |
| 719 | self.name = name |
| 720 | |
| 721 | def set_version(self, version): |
| 722 | """ |
| 723 | **`version(int):`** version of script, use increasing integer numbering. Default value is *1*. |
| 724 | |
| 725 | Sets version of script. Must be called in script method *`init_script()`*. |
| 726 | """ |
| 727 | self.priv_context.error_on_wrong_method("set_version()", METHOD_INIT_SCRIPT) |
| 728 | self.version = version |
| 729 | |
| 730 | def set_author(self, author): |
| 731 | """ |
| 732 | **`author(str):`** name of script creator. |
| 733 | |
| 734 | Sets author of the script. Must be called in script method *init_script()*. |
| 735 | """ |
| 736 | self.author = author |
| 737 | |
| 738 | def set_frame_name(self, frame_name): |
| 739 | """ |
| 740 | **`frame_name(str):`** name used before number part in rendered frame files. |
| 741 | """ |
| 742 | self.priv_context.frame_name = frame_name |
| 743 | |
| 744 | def set_data_obj(self, label, item): |
| 745 | """ |
| 746 | **`label(str):`** label used to access data later using *`get_data_obj(self, label)`*. |
| 747 | |
| 748 | **`item(obj):`** data item being saved. |
| 749 | |
| 750 | Saves data to be used later during execution of script. Using **global** would obviously be possible to replace this, but this is made available as a more clean solution. |
| 751 | """ |
| 752 | self.data[label] = item |
| 753 | |
| 754 | def get_data_obj(self, label): |
| 755 | """ |
| 756 | **`label(str):`** label of saved data item. |
| 757 | |
| 758 | Gives access to previously saved data. |
| 759 | |
| 760 | **Returns:** (obj) Saved data item. |
| 761 | """ |
| 762 | return self.data[label] |
| 763 | |
| 764 | def set_length(self, length): |
| 765 | """ |
| 766 | **`length(int):`** New length of script in frames. |
| 767 | |
| 768 | Sets length of script output in frames. |
| 769 | |
| 770 | Must *not* be called in *`render_frames()`*. |
| 771 | """ |
| 772 | self.length = length |
| 773 | |
| 774 | def get_length(self): |
| 775 | """ |
| 776 | **Returns:** (int) Length of script in frames. |
| 777 | """ |
| 778 | return self.length |
| 779 | |
| 780 | def add_editor(self, name, type, default_value, tooltip=None): |
| 781 | """ |
| 782 | **`name(str):`** Name for editor. |
| 783 | |
| 784 | **`type(int):`** Value either *`EDITOR_FLOAT`, `EDITOR_INT`, `EDITOR_COLOR`, `EDITOR_FILE_PATH`, `EDITOR_OPTIONS`, `EDITOR_CHECK_BOX`, `EDITOR_FLOAT_RANGE`, `EDITOR_INT_RANGE`.* |
| 785 | |
| 786 | **`default_value(str||int||float||tuple):`** Data type depends on editor type: |
| 787 | |
| 788 | * `EDITOR_TEXT`(str), |
| 789 | |
| 790 | * `EDITOR_TEXT_AREA`(str), |
| 791 | |
| 792 | * `EDITOR_FLOAT`(float), |
| 793 | |
| 794 | * `EDITOR_INT`(int), |
| 795 | |
| 796 | * `EDITOR_COLOR`(4-tuple with float values in range 0-1, (R,G,B,A)), |
| 797 | |
| 798 | * `EDITOR_FILE_PATH`(str), |
| 799 | |
| 800 | * `EDITOR_OPTIONS`(2-tuple (int, [str]), (selected_index,[option_str_1, option_str_2, ...]), |
| 801 | |
| 802 | * `EDITOR_CHECK_BOX`(bool), |
| 803 | |
| 804 | * `EDITOR_FLOAT_RANGE`(3-tuple with float values, (default, min, max)), |
| 805 | |
| 806 | * `EDITOR_INT_RANGE`(3-tuple with int values, (default, min, max)) |
| 807 | |
| 808 | * `EDITOR_HTML_LINK`((str) A path to a HTML resource, either local or in the web), |
| 809 | |
| 810 | * `EDITOR_PANGO_FONT` (17-tuple (font_family, font_face, font_size, alignment, color_rgba, |
| 811 | fill_on, outline_color_rgba, outline_on, outline_width, shadow_on, shadow_color_rgb, |
| 812 | shadow_opacity, shadow_xoff, shadow_yoff, shadow_blur, |
| 813 | gradient_color_rgba, gradient_direction)) |
| 814 | |
| 815 | **`tooltip(str, optional):`** Tooltip for editor if presented in GUI. |
| 816 | |
| 817 | Defines possible GUI editors used to affect script rendering. Edited value is accessed with method *get_editor_value(self, name, frame=0)*. |
| 818 | |
| 819 | Data describing editors can be accessed with *get_script_data(self)*. Edited values are made available for script with *set_editors_data(self, editors_data_json)*. |
| 820 | |
| 821 | EDITOR_HTML_LINK can use global variable fluxity.LOCAL_ROOT to point to installation root directory as part of a path to an installed resource. |
| 822 | |
| 823 | Must be called in script method *init_script()*. |
| 824 | """ |
| 825 | self.priv_context.error_on_wrong_method("add_editor()", METHOD_INIT_SCRIPT) |
| 826 | self.editors[name] = (type, default_value) |
| 827 | if tooltip != None: |
| 828 | self.editor_tooltips[name] = tooltip |
| 829 | |
| 830 | def get_editor_value(self, name, frame=0): |
| 831 | """ |
| 832 | **`name(str):`** Name of editor. |
| 833 | |
| 834 | **`frame(int):`** Frame in range 0 - (script length - 1). |
| 835 | |
| 836 | Value of edited data at given frame. We currently have no animated values, but they will added with future API updates. |
| 837 | |
| 838 | **Returns:** (obj) Value at frame. |
| 839 | |
| 840 | Data type depends on editor type: |
| 841 | |
| 842 | * `EDITOR_TEXT`(str), |
| 843 | |
| 844 | * `EDITOR_TEXT_AREA`(str), |
| 845 | |
| 846 | * `EDITOR_FLOAT`(float), |
| 847 | |
| 848 | * `EDITOR_INT`(int), |
| 849 | |
| 850 | * `EDITOR_COLOR`(4-tuple with float values in range 0-1, (R,G,B,A)), |
| 851 | |
| 852 | * `EDITOR_FILE_PATH`(str), |
| 853 | |
| 854 | * `EDITOR_OPTIONS`(selection index int), |
| 855 | |
| 856 | * `EDITOR_CHECK_BOX`(bool), |
| 857 | |
| 858 | * `EDITOR_FLOAT_RANGE`(3-tuple with float values, (default, min, max)), |
| 859 | |
| 860 | * `EDITOR_INT_RANGE`(3-tuple with int values, (default, min, max)) |
| 861 | |
| 862 | * `EDITOR_HTML_LINK`(str), |
| 863 | |
| 864 | * `EDITOR_PANGO_FONT`(17-tuple (font_family, font_face, font_size, alignment, color_rgba, |
| 865 | fill_on, outline_color_rgba, outline_on, outline_width, shadow_on, shadow_color_rgb, |
| 866 | shadow_opacity, shadow_xoff, shadow_yoff, shadow_blur, |
| 867 | gradient_color_rgba, gradient_direction)) |
| 868 | """ |
| 869 | try: |
| 870 | type, value = self.editors[name] |
| 871 | if type == EDITOR_INT_RANGE or type == EDITOR_FLOAT_RANGE: |
| 872 | val, min, max = value |
| 873 | return val |
| 874 | elif type == EDITOR_OPTIONS: |
| 875 | selected_index, options = value |
| 876 | return selected_index |
| 877 | return value |
| 878 | except Exception as e: |
| 879 | exception_msg = "No editor for name '" + name + "' found." |
| 880 | _raise_fluxity_error(exception_msg) |
| 881 | |
| 882 | def get_editors_values_clone_dict(self): |
| 883 | """ |
| 884 | Return dictionary containing values of all edited data. |
| 885 | |
| 886 | **Returns:** (dict) Dictionary {name:value} containing all editors. |
| 887 | """ |
| 888 | editor_values = {} |
| 889 | |
| 890 | for name, value_item in self.editors.items(): |
| 891 | type, value = value_item |
| 892 | if type == EDITOR_INT_RANGE or type == EDITOR_FLOAT_RANGE: |
| 893 | val, min, max = value |
| 894 | value = val |
| 895 | elif type == EDITOR_OPTIONS: |
| 896 | selected_index, options = value |
| 897 | value = selected_index |
| 898 | |
| 899 | editor_values[name] = value |
| 900 | |
| 901 | return editor_values |
| 902 | |
| 903 | def get_script_data(self): |
| 904 | """ |
| 905 | Returns data of all editors and their default values, and script metadata like script author and version. |
| 906 | |
| 907 | Output can be turned into Python object tree using *json.loads()* method. |
| 908 | |
| 909 | **Returns:** (str) string representation of JSON object. |
| 910 | """ |
| 911 | script_data = {} |
| 912 | script_data["length"] = self.length |
| 913 | script_data["name"] = self.name |
| 914 | script_data["version"] = self.version |
| 915 | script_data["author"] = self.author |
| 916 | |
| 917 | editors_list = [] |
| 918 | for name in self.editors: |
| 919 | type, value = self.editors[name] |
| 920 | json_obj = [name, type, value] |
| 921 | editors_list.append(json_obj) |
| 922 | |
| 923 | script_data["editors_list"] = editors_list # this is dict inside FluxityContext object, but is given out as list for convenience of Flowblade app integration. |
| 924 | script_data["tooltips_list"] = self.editor_tooltips |
| 925 | script_data["groups_list"] = self.groups |
| 926 | |
| 927 | return json.dumps(script_data) |
| 928 | |
| 929 | def get_script_dir(self): |
| 930 | """ |
| 931 | Returns path to directory where the script being executed is located. |
| 932 | |
| 933 | Sometimes script directory information is not available (e.g. when executing a non-saved script in Flowblade *Script Tool* application) and *None* is returned. It is recommended that all Fluxity scripts handle getting *None* gracefully. |
| 934 | |
| 935 | This functionality is useful when script is being distributed with some associated media files. |
| 936 | |
| 937 | **Returns:** (str) script directory path or *None*. |
| 938 | """ |
| 939 | if self.script_file == None: |
| 940 | return None |
| 941 | |
| 942 | dir_path = os.path.dirname(self.script_file) + "/" |
| 943 | return dir_path |
| 944 | |
| 945 | def set_editors_data(self, editors_data_json): |
| 946 | """ |
| 947 | **`editors_data_json(str):`** string representation of JSON object. |
| 948 | |
| 949 | Sets edited data to be used when rendering. |
| 950 | |
| 951 | Input string must describe JSON object that can be turned into usable editor data. |
| 952 | |
| 953 | Example with `EDITOR_FLOAT` and `EDITOR_COLOR`: |
| 954 | |
| 955 | ``` |
| 956 | [ |
| 957 | ["Position X", 2, 1.0], |
| 958 | ["BG Color", 4, [0.8, 0.2, 0.2, 1.0]] |
| 959 | ] |
| 960 | ``` |
| 961 | |
| 962 | General form: |
| 963 | |
| 964 | ``` |
| 965 | [ |
| 966 | [<name>, <type>, <value>], |
| 967 | ... |
| 968 | ] |
| 969 | ``` |
| 970 | |
| 971 | Using this method is not needed when writing **Flowblade Media Plugins**, application handles setting editors data. |
| 972 | |
| 973 | Should be called in script method *init_render()*. |
| 974 | """ |
| 975 | new_editors_list = json.loads(editors_data_json) |
| 976 | for editor in new_editors_list: |
| 977 | name, type, value = editor |
| 978 | self.editors[name] = (type, value) |
| 979 | |
| 980 | def create_text_layout(self, font_data): |
| 981 | """ |
| 982 | **`font_data(tuple)`** this tuple can be acquired by calling *FluxityContext.get_editor_value()* on editors of type *EDITOR_PANGO_FONT*. |
| 983 | |
| 984 | Creates objects used to draw text. |
| 985 | |
| 986 | **Returns:** (fluxity.PangoTextLayout) object for drawing text. |
| 987 | """ |
| 988 | return PangoTextLayout(font_data) |
| 989 | |
| 990 | def log_line(self, log_line): |
| 991 | """ |
| 992 | **`log_line(str):`** line of text. |
| 993 | |
| 994 | Adds a line of text to log message displayed after render completion or error. |
| 995 | """ |
| 996 | self.log_msg = self.log_msg + log_line + "\n" |
| 997 | |
| 998 | def set_prints_to_log_file(self, log_file): |
| 999 | """ |
| 1000 | **`log_file(str):`** File path. |
| 1001 | |
| 1002 | Save output from 'print()' to file at given path. Must be called in script method *init_script()*. |
| 1003 | """ |
| 1004 | self.priv_context.error_on_wrong_method("set_prints_to_log_file()", METHOD_INIT_SCRIPT) |
| 1005 | _prints_to_log_file(log_file) |
| 1006 | |
| 1007 | def required_api_version(self, required_version): |
| 1008 | """ |
| 1009 | **`required_version(int):`** Required API version for this script. |
| 1010 | |
| 1011 | Raises error if API version too low. Must be called in script method *`init_script()`*. |
| 1012 | """ |
| 1013 | self.priv_context.error_on_wrong_method("required_api_version()", METHOD_INIT_SCRIPT) |
| 1014 | if required_version > API_VERSION: |
| 1015 | _raise_fluxity_error("Fluxity API version too low for this script. Version " + str(required_version) + " required for this script, this system has Fluxity API version " + str(API_VERSION) + ".") |
| 1016 | |
| 1017 | def add_editor_group(self, group_label): |
| 1018 | """ |
| 1019 | **`group_label(str):`** Label for added group. |
| 1020 | |
| 1021 | Adds editors group. All editors added after adding a group belong in that group until a new group ius added. |
| 1022 | |
| 1023 | If editor groups are used first one needs to be added before any editor. Must be called in script method *`init_script()`*. |
| 1024 | """ |
| 1025 | self.priv_context.error_on_wrong_method("add_editor_group()", METHOD_INIT_SCRIPT) |
| 1026 | if len(self.editors.keys()) > 0 and len(self.groups) == 0: |
| 1027 | _raise_fluxity_error("If editor groups are used first one needs to be added before any editor.") |
| 1028 | |
| 1029 | self.groups[len(self.editors.keys())] = group_label</code></pre> |
| 1030 | </details> |
| 1031 | <h3>Methods</h3> |
| 1032 | <dl> |
| 1033 | <dt id="fluxity.FluxityContext.add_editor"><code class="name flex"> |
| 1034 | <span>def <span class="ident">add_editor</span></span>(<span>self, name, type, default_value, tooltip=None)</span> |
| 1035 | </code></dt> |
| 1036 | <dd> |
| 1037 | <div class="desc"><p><strong><code>name(str):</code></strong> Name for editor.</p> |
| 1038 | <p><strong><code>type(int):</code></strong> Value either <em><code><a title="fluxity.EDITOR_FLOAT" href="#fluxity.EDITOR_FLOAT">EDITOR_FLOAT</a></code>, <code><a title="fluxity.EDITOR_INT" href="#fluxity.EDITOR_INT">EDITOR_INT</a></code>, <code><a title="fluxity.EDITOR_COLOR" href="#fluxity.EDITOR_COLOR">EDITOR_COLOR</a></code>, <code><a title="fluxity.EDITOR_FILE_PATH" href="#fluxity.EDITOR_FILE_PATH">EDITOR_FILE_PATH</a></code>, <code><a title="fluxity.EDITOR_OPTIONS" href="#fluxity.EDITOR_OPTIONS">EDITOR_OPTIONS</a></code>, <code><a title="fluxity.EDITOR_CHECK_BOX" href="#fluxity.EDITOR_CHECK_BOX">EDITOR_CHECK_BOX</a></code>, <code><a title="fluxity.EDITOR_FLOAT_RANGE" href="#fluxity.EDITOR_FLOAT_RANGE">EDITOR_FLOAT_RANGE</a></code>, <code><a title="fluxity.EDITOR_INT_RANGE" href="#fluxity.EDITOR_INT_RANGE">EDITOR_INT_RANGE</a></code>.</em></p> |
| 1039 | <p><strong><code>default_value(str||int||float||tuple):</code></strong> Data type depends on editor type:</p> |
| 1040 | <ul> |
| 1041 | <li> |
| 1042 | <p><code><a title="fluxity.EDITOR_TEXT" href="#fluxity.EDITOR_TEXT">EDITOR_TEXT</a></code>(str),</p> |
| 1043 | </li> |
| 1044 | <li> |
| 1045 | <p><code><a title="fluxity.EDITOR_TEXT_AREA" href="#fluxity.EDITOR_TEXT_AREA">EDITOR_TEXT_AREA</a></code>(str),</p> |
| 1046 | </li> |
| 1047 | <li> |
| 1048 | <p><code><a title="fluxity.EDITOR_FLOAT" href="#fluxity.EDITOR_FLOAT">EDITOR_FLOAT</a></code>(float),</p> |
| 1049 | </li> |
| 1050 | <li> |
| 1051 | <p><code><a title="fluxity.EDITOR_INT" href="#fluxity.EDITOR_INT">EDITOR_INT</a></code>(int), </p> |
| 1052 | </li> |
| 1053 | <li> |
| 1054 | <p><code><a title="fluxity.EDITOR_COLOR" href="#fluxity.EDITOR_COLOR">EDITOR_COLOR</a></code>(4-tuple with float values in range 0-1, (R,G,B,A)), </p> |
| 1055 | </li> |
| 1056 | <li> |
| 1057 | <p><code><a title="fluxity.EDITOR_FILE_PATH" href="#fluxity.EDITOR_FILE_PATH">EDITOR_FILE_PATH</a></code>(str), </p> |
| 1058 | </li> |
| 1059 | <li> |
| 1060 | <p><code><a title="fluxity.EDITOR_OPTIONS" href="#fluxity.EDITOR_OPTIONS">EDITOR_OPTIONS</a></code>(2-tuple (int, [str]), (selected_index,[option_str_1, option_str_2, …]),</p> |
| 1061 | </li> |
| 1062 | <li> |
| 1063 | <p><code><a title="fluxity.EDITOR_CHECK_BOX" href="#fluxity.EDITOR_CHECK_BOX">EDITOR_CHECK_BOX</a></code>(bool), </p> |
| 1064 | </li> |
| 1065 | <li> |
| 1066 | <p><code><a title="fluxity.EDITOR_FLOAT_RANGE" href="#fluxity.EDITOR_FLOAT_RANGE">EDITOR_FLOAT_RANGE</a></code>(3-tuple with float values, (default, min, max)), </p> |
| 1067 | </li> |
| 1068 | <li> |
| 1069 | <p><code><a title="fluxity.EDITOR_INT_RANGE" href="#fluxity.EDITOR_INT_RANGE">EDITOR_INT_RANGE</a></code>(3-tuple with int values, (default, min, max))</p> |
| 1070 | </li> |
| 1071 | <li> |
| 1072 | <p><code><a title="fluxity.EDITOR_HTML_LINK" href="#fluxity.EDITOR_HTML_LINK">EDITOR_HTML_LINK</a></code>((str) A path to a HTML resource, either local or in the web),</p> |
| 1073 | </li> |
| 1074 | <li> |
| 1075 | <p><code><a title="fluxity.EDITOR_PANGO_FONT" href="#fluxity.EDITOR_PANGO_FONT">EDITOR_PANGO_FONT</a></code> (17-tuple (font_family, font_face, font_size, alignment, color_rgba, |
| 1076 | fill_on, outline_color_rgba, outline_on, outline_width, shadow_on, shadow_color_rgb, |
| 1077 | shadow_opacity, shadow_xoff, shadow_yoff, shadow_blur, |
| 1078 | gradient_color_rgba, gradient_direction))</p> |
| 1079 | </li> |
| 1080 | </ul> |
| 1081 | <p><strong><code>tooltip(str, optional):</code></strong> Tooltip for editor if presented in GUI.</p> |
| 1082 | <p>Defines possible GUI editors used to affect script rendering. Edited value is accessed with method <em>get_editor_value(self, name, frame=0)</em>.</p> |
| 1083 | <p>Data describing editors can be accessed with <em>get_script_data(self)</em>. Edited values are made available for script with <em>set_editors_data(self, editors_data_json)</em>.</p> |
| 1084 | <p>EDITOR_HTML_LINK can use global variable fluxity.LOCAL_ROOT to point to installation root directory as part of a path to an installed resource.</p> |
| 1085 | <p>Must be called in script method <em>init_script()</em>.</p></div> |
| 1086 | </dd> |
| 1087 | <dt id="fluxity.FluxityContext.add_editor_group"><code class="name flex"> |
| 1088 | <span>def <span class="ident">add_editor_group</span></span>(<span>self, group_label)</span> |
| 1089 | </code></dt> |
| 1090 | <dd> |
| 1091 | <div class="desc"><p><strong><code>group_label(str):</code></strong> Label for added group.</p> |
| 1092 | <p>Adds editors group. All editors added after adding a group belong in that group until a new group ius added.</p> |
| 1093 | <p>If editor groups are used first one needs to be added before any editor. Must be called in script method <em><code>init_script()</code></em>.</p></div> |
| 1094 | </dd> |
| 1095 | <dt id="fluxity.FluxityContext.create_text_layout"><code class="name flex"> |
| 1096 | <span>def <span class="ident">create_text_layout</span></span>(<span>self, font_data)</span> |
| 1097 | </code></dt> |
| 1098 | <dd> |
| 1099 | <div class="desc"><p><strong><code>font_data(tuple)</code></strong> this tuple can be acquired by calling <em>FluxityContext.get_editor_value()</em> on editors of type <em>EDITOR_PANGO_FONT</em>.</p> |
| 1100 | <p>Creates objects used to draw text.</p> |
| 1101 | <p><strong>Returns:</strong> (fluxity.PangoTextLayout) object for drawing text.</p></div> |
| 1102 | </dd> |
| 1103 | <dt id="fluxity.FluxityContext.get_data_obj"><code class="name flex"> |
| 1104 | <span>def <span class="ident">get_data_obj</span></span>(<span>self, label)</span> |
| 1105 | </code></dt> |
| 1106 | <dd> |
| 1107 | <div class="desc"><p><strong><code>label(str):</code></strong> label of saved data item.</p> |
| 1108 | <p>Gives access to previously saved data.</p> |
| 1109 | <p><strong>Returns:</strong> (obj) Saved data item.</p></div> |
| 1110 | </dd> |
| 1111 | <dt id="fluxity.FluxityContext.get_dimensions"><code class="name flex"> |
| 1112 | <span>def <span class="ident">get_dimensions</span></span>(<span>self)</span> |
| 1113 | </code></dt> |
| 1114 | <dd> |
| 1115 | <div class="desc"><p>Pixel size of output image.</p> |
| 1116 | <p><strong>Returns:</strong> (int, int) Tuple (width, height) of output image size.</p></div> |
| 1117 | </dd> |
| 1118 | <dt id="fluxity.FluxityContext.get_editor_value"><code class="name flex"> |
| 1119 | <span>def <span class="ident">get_editor_value</span></span>(<span>self, name, frame=0)</span> |
| 1120 | </code></dt> |
| 1121 | <dd> |
| 1122 | <div class="desc"><p><strong><code>name(str):</code></strong> Name of editor.</p> |
| 1123 | <p><strong><code>frame(int):</code></strong> Frame in range 0 - (script length - 1).</p> |
| 1124 | <p>Value of edited data at given frame. We currently have no animated values, but they will added with future API updates.</p> |
| 1125 | <p><strong>Returns:</strong> (obj) Value at frame.</p> |
| 1126 | <p>Data type depends on editor type:</p> |
| 1127 | <ul> |
| 1128 | <li> |
| 1129 | <p><code><a title="fluxity.EDITOR_TEXT" href="#fluxity.EDITOR_TEXT">EDITOR_TEXT</a></code>(str),</p> |
| 1130 | </li> |
| 1131 | <li> |
| 1132 | <p><code><a title="fluxity.EDITOR_TEXT_AREA" href="#fluxity.EDITOR_TEXT_AREA">EDITOR_TEXT_AREA</a></code>(str),</p> |
| 1133 | </li> |
| 1134 | <li> |
| 1135 | <p><code><a title="fluxity.EDITOR_FLOAT" href="#fluxity.EDITOR_FLOAT">EDITOR_FLOAT</a></code>(float), </p> |
| 1136 | </li> |
| 1137 | <li> |
| 1138 | <p><code><a title="fluxity.EDITOR_INT" href="#fluxity.EDITOR_INT">EDITOR_INT</a></code>(int), </p> |
| 1139 | </li> |
| 1140 | <li> |
| 1141 | <p><code><a title="fluxity.EDITOR_COLOR" href="#fluxity.EDITOR_COLOR">EDITOR_COLOR</a></code>(4-tuple with float values in range 0-1, (R,G,B,A)), </p> |
| 1142 | </li> |
| 1143 | <li> |
| 1144 | <p><code><a title="fluxity.EDITOR_FILE_PATH" href="#fluxity.EDITOR_FILE_PATH">EDITOR_FILE_PATH</a></code>(str),</p> |
| 1145 | </li> |
| 1146 | <li> |
| 1147 | <p><code><a title="fluxity.EDITOR_OPTIONS" href="#fluxity.EDITOR_OPTIONS">EDITOR_OPTIONS</a></code>(selection index int),</p> |
| 1148 | </li> |
| 1149 | <li> |
| 1150 | <p><code><a title="fluxity.EDITOR_CHECK_BOX" href="#fluxity.EDITOR_CHECK_BOX">EDITOR_CHECK_BOX</a></code>(bool), </p> |
| 1151 | </li> |
| 1152 | <li> |
| 1153 | <p><code><a title="fluxity.EDITOR_FLOAT_RANGE" href="#fluxity.EDITOR_FLOAT_RANGE">EDITOR_FLOAT_RANGE</a></code>(3-tuple with float values, (default, min, max)), </p> |
| 1154 | </li> |
| 1155 | <li> |
| 1156 | <p><code><a title="fluxity.EDITOR_INT_RANGE" href="#fluxity.EDITOR_INT_RANGE">EDITOR_INT_RANGE</a></code>(3-tuple with int values, (default, min, max))</p> |
| 1157 | </li> |
| 1158 | <li> |
| 1159 | <p><code><a title="fluxity.EDITOR_HTML_LINK" href="#fluxity.EDITOR_HTML_LINK">EDITOR_HTML_LINK</a></code>(str),</p> |
| 1160 | </li> |
| 1161 | <li> |
| 1162 | <p><code><a title="fluxity.EDITOR_PANGO_FONT" href="#fluxity.EDITOR_PANGO_FONT">EDITOR_PANGO_FONT</a></code>(17-tuple (font_family, font_face, font_size, alignment, color_rgba, |
| 1163 | fill_on, outline_color_rgba, outline_on, outline_width, shadow_on, shadow_color_rgb, |
| 1164 | shadow_opacity, shadow_xoff, shadow_yoff, shadow_blur, |
| 1165 | gradient_color_rgba, gradient_direction))</p> |
| 1166 | </li> |
| 1167 | </ul></div> |
| 1168 | </dd> |
| 1169 | <dt id="fluxity.FluxityContext.get_editors_values_clone_dict"><code class="name flex"> |
| 1170 | <span>def <span class="ident">get_editors_values_clone_dict</span></span>(<span>self)</span> |
| 1171 | </code></dt> |
| 1172 | <dd> |
| 1173 | <div class="desc"><p>Return dictionary containing values of all edited data.</p> |
| 1174 | <p><strong>Returns:</strong> (dict) Dictionary {name:value} containing all editors.</p></div> |
| 1175 | </dd> |
| 1176 | <dt id="fluxity.FluxityContext.get_frame_cr"><code class="name flex"> |
| 1177 | <span>def <span class="ident">get_frame_cr</span></span>(<span>self)</span> |
| 1178 | </code></dt> |
| 1179 | <dd> |
| 1180 | <div class="desc"><p>For every rendered frame method <em><code>render_frame()</code></em> is called and a new <strong><code>cairo.ImageSurface</code></strong> object is created.</p> |
| 1181 | <p>This method provides access to <strong><code>cairo.Context</code></strong> object that can be used to draw onto that image surface. This is the way that output is achieved with <strong>Flowblade Media Plugins</strong>. </p> |
| 1182 | <p>After method <em><code>render_frame()</code></em> exits, <strong><code>cairo.Context</code></strong> object is no longer valid and contents of <strong><code>cairo.ImageSurface</code></strong> are saved to disk.</p> |
| 1183 | <p>Must be called in script method <em><code>render_frame()</code></em>.</p> |
| 1184 | <p><strong>Returns:</strong> (<strong><code>cairo.Context</code></strong>) Context object that can be drawn onto.</p></div> |
| 1185 | </dd> |
| 1186 | <dt id="fluxity.FluxityContext.get_length"><code class="name flex"> |
| 1187 | <span>def <span class="ident">get_length</span></span>(<span>self)</span> |
| 1188 | </code></dt> |
| 1189 | <dd> |
| 1190 | <div class="desc"><p><strong>Returns:</strong> (int) Length of script in frames.</p></div> |
| 1191 | </dd> |
| 1192 | <dt id="fluxity.FluxityContext.get_profile_property"><code class="name flex"> |
| 1193 | <span>def <span class="ident">get_profile_property</span></span>(<span>self, p_property)</span> |
| 1194 | </code></dt> |
| 1195 | <dd> |
| 1196 | <div class="desc"><p><strong><code>p_property(str):</code></strong> propertyr identyfier, e.g. <code><a title="fluxity.PROFILE_PROGRESSIVE" href="#fluxity.PROFILE_PROGRESSIVE">PROFILE_PROGRESSIVE</a></code>.</p> |
| 1197 | <p>Used to access properties of MLT profile set before running the script that defines e.g. output image size.</p> |
| 1198 | <p><strong>Returns:</strong> (int || boolean || string) Value depends on which profile property is being accessed.</p></div> |
| 1199 | </dd> |
| 1200 | <dt id="fluxity.FluxityContext.get_script_data"><code class="name flex"> |
| 1201 | <span>def <span class="ident">get_script_data</span></span>(<span>self)</span> |
| 1202 | </code></dt> |
| 1203 | <dd> |
| 1204 | <div class="desc"><p>Returns data of all editors and their default values, and script metadata like script author and version. </p> |
| 1205 | <p>Output can be turned into Python object tree using <em>json.loads()</em> method.</p> |
| 1206 | <p><strong>Returns:</strong> (str) string representation of JSON object.</p></div> |
| 1207 | </dd> |
| 1208 | <dt id="fluxity.FluxityContext.get_script_dir"><code class="name flex"> |
| 1209 | <span>def <span class="ident">get_script_dir</span></span>(<span>self)</span> |
| 1210 | </code></dt> |
| 1211 | <dd> |
| 1212 | <div class="desc"><p>Returns path to directory where the script being executed is located. |
| 1213 | </p> |
| 1214 | <p>Sometimes script directory information is not available (e.g. when executing a non-saved script in Flowblade <em>Script Tool</em> application) and <em>None</em> is returned. It is recommended that all Fluxity scripts handle getting <em>None</em> gracefully.</p> |
| 1215 | <p>This functionality is useful when script is being distributed with some associated media files.</p> |
| 1216 | <p><strong>Returns:</strong> (str) script directory path or <em>None</em>.</p></div> |
| 1217 | </dd> |
| 1218 | <dt id="fluxity.FluxityContext.log_line"><code class="name flex"> |
| 1219 | <span>def <span class="ident">log_line</span></span>(<span>self, log_line)</span> |
| 1220 | </code></dt> |
| 1221 | <dd> |
| 1222 | <div class="desc"><p><strong><code>log_line(str):</code></strong> line of text.</p> |
| 1223 | <p>Adds a line of text to log message displayed after render completion or error.</p></div> |
| 1224 | </dd> |
| 1225 | <dt id="fluxity.FluxityContext.required_api_version"><code class="name flex"> |
| 1226 | <span>def <span class="ident">required_api_version</span></span>(<span>self, required_version)</span> |
| 1227 | </code></dt> |
| 1228 | <dd> |
| 1229 | <div class="desc"><p><strong><code>required_version(int):</code></strong> Required API version for this script.</p> |
| 1230 | <p>Raises error if API version too low. Must be called in script method <em><code>init_script()</code></em>.</p></div> |
| 1231 | </dd> |
| 1232 | <dt id="fluxity.FluxityContext.set_author"><code class="name flex"> |
| 1233 | <span>def <span class="ident">set_author</span></span>(<span>self, author)</span> |
| 1234 | </code></dt> |
| 1235 | <dd> |
| 1236 | <div class="desc"><p><strong><code>author(str):</code></strong> name of script creator.</p> |
| 1237 | <p>Sets author of the script. Must be called in script method <em>init_script()</em>.</p></div> |
| 1238 | </dd> |
| 1239 | <dt id="fluxity.FluxityContext.set_data_obj"><code class="name flex"> |
| 1240 | <span>def <span class="ident">set_data_obj</span></span>(<span>self, label, item)</span> |
| 1241 | </code></dt> |
| 1242 | <dd> |
| 1243 | <div class="desc"><p><strong><code>label(str):</code></strong> label used to access data later using <em><code>get_data_obj(self, label)</code></em>.</p> |
| 1244 | <p><strong><code>item(obj):</code></strong> data item being saved.</p> |
| 1245 | <p>Saves data to be used later during execution of script. Using <strong>global</strong> would obviously be possible to replace this, but this is made available as a more clean solution.</p></div> |
| 1246 | </dd> |
| 1247 | <dt id="fluxity.FluxityContext.set_editors_data"><code class="name flex"> |
| 1248 | <span>def <span class="ident">set_editors_data</span></span>(<span>self, editors_data_json)</span> |
| 1249 | </code></dt> |
| 1250 | <dd> |
| 1251 | <div class="desc"><p><strong><code>editors_data_json(str):</code></strong> string representation of JSON object.</p> |
| 1252 | <p>Sets edited data to be used when rendering.</p> |
| 1253 | <p>Input string must describe JSON object that can be turned into usable editor data.</p> |
| 1254 | <p>Example with <code><a title="fluxity.EDITOR_FLOAT" href="#fluxity.EDITOR_FLOAT">EDITOR_FLOAT</a></code> and <code><a title="fluxity.EDITOR_COLOR" href="#fluxity.EDITOR_COLOR">EDITOR_COLOR</a></code>:</p> |
| 1255 | <pre><code>[ |
| 1256 | ["Position X", 2, 1.0], |
| 1257 | ["BG Color", 4, [0.8, 0.2, 0.2, 1.0]] |
| 1258 | ] |
| 1259 | </code></pre> |
| 1260 | <p>General form:</p> |
| 1261 | <pre><code>[ |
| 1262 | [<name>, <type>, <value>], |
| 1263 | ... |
| 1264 | ] |
| 1265 | </code></pre> |
| 1266 | <p>Using this method is not needed when writing <strong>Flowblade Media Plugins</strong>, application handles setting editors data.</p> |
| 1267 | <p>Should be called in script method <em>init_render()</em>.</p></div> |
| 1268 | </dd> |
| 1269 | <dt id="fluxity.FluxityContext.set_frame_name"><code class="name flex"> |
| 1270 | <span>def <span class="ident">set_frame_name</span></span>(<span>self, frame_name)</span> |
| 1271 | </code></dt> |
| 1272 | <dd> |
| 1273 | <div class="desc"><p><strong><code>frame_name(str):</code></strong> name used before number part in rendered frame files.</p></div> |
| 1274 | </dd> |
| 1275 | <dt id="fluxity.FluxityContext.set_length"><code class="name flex"> |
| 1276 | <span>def <span class="ident">set_length</span></span>(<span>self, length)</span> |
| 1277 | </code></dt> |
| 1278 | <dd> |
| 1279 | <div class="desc"><p><strong><code>length(int):</code></strong> New length of script in frames.</p> |
| 1280 | <p>Sets length of script output in frames.</p> |
| 1281 | <p>Must <em>not</em> be called in |
| 1282 | <em><code>render_frames()</code></em>.</p></div> |
| 1283 | </dd> |
| 1284 | <dt id="fluxity.FluxityContext.set_name"><code class="name flex"> |
| 1285 | <span>def <span class="ident">set_name</span></span>(<span>self, name)</span> |
| 1286 | </code></dt> |
| 1287 | <dd> |
| 1288 | <div class="desc"><p><strong><code>name(str):</code></strong> name of script displayed to user.</p> |
| 1289 | <p>Sets name of the script displayed to the user. Must be called in script method <em><code>init_script()</code></em>.</p></div> |
| 1290 | </dd> |
| 1291 | <dt id="fluxity.FluxityContext.set_prints_to_log_file"><code class="name flex"> |
| 1292 | <span>def <span class="ident">set_prints_to_log_file</span></span>(<span>self, log_file)</span> |
| 1293 | </code></dt> |
| 1294 | <dd> |
| 1295 | <div class="desc"><p><strong><code>log_file(str):</code></strong> File path.</p> |
| 1296 | <p>Save output from 'print()' to file at given path. Must be called in script method <em>init_script()</em>.</p></div> |
| 1297 | </dd> |
| 1298 | <dt id="fluxity.FluxityContext.set_version"><code class="name flex"> |
| 1299 | <span>def <span class="ident">set_version</span></span>(<span>self, version)</span> |
| 1300 | </code></dt> |
| 1301 | <dd> |
| 1302 | <div class="desc"><p><strong><code>version(int):</code></strong> version of script, use increasing integer numbering. Default value is <em>1</em>.</p> |
| 1303 | <p>Sets version of script. Must be called in script method <em><code>init_script()</code></em>.</p></div> |
| 1304 | </dd> |
| 1305 | </dl> |
| 1306 | </dd> |
| 1307 | <dt id="fluxity.FluxityUserMessageError"><code class="flex name class"> |
| 1308 | <span>class <span class="ident">FluxityUserMessageError</span></span> |
| 1309 | <span>(</span><span>value)</span> |
| 1310 | </code></dt> |
| 1311 | <dd> |
| 1312 | <div class="desc"><p>Errors used to communicate particular info to user without traceback.</p></div> |
| 1313 | <details class="source"> |
| 1314 | <summary> |
| 1315 | <span>Expand source code</span> |
| 1316 | </summary> |
| 1317 | <pre><code class="python">class FluxityUserMessageError(Exception): |
| 1318 | """ |
| 1319 | Errors used to communicate particular info to user without traceback. |
| 1320 | """ |
| 1321 | def __init__(self, value): |
| 1322 | self.value = value |
| 1323 | def __str__(self): |
| 1324 | return self.value</code></pre> |
| 1325 | </details> |
| 1326 | <h3>Ancestors</h3> |
| 1327 | <ul class="hlist"> |
| 1328 | <li>builtins.Exception</li> |
| 1329 | <li>builtins.BaseException</li> |
| 1330 | </ul> |
| 1331 | </dd> |
| 1332 | <dt id="fluxity.PangoTextLayout"><code class="flex name class"> |
| 1333 | <span>class <span class="ident">PangoTextLayout</span></span> |
| 1334 | <span>(</span><span>font_data)</span> |
| 1335 | </code></dt> |
| 1336 | <dd> |
| 1337 | <div class="desc"><p><strong><code>font_data(tuple)</code></strong> this tuple can be acquired by calling <em><code><a title="fluxity.FluxityContext.get_editor_value" href="#fluxity.FluxityContext.get_editor_value">FluxityContext.get_editor_value()</a></code></em> on editors of type <em><code><a title="fluxity.EDITOR_PANGO_FONT" href="#fluxity.EDITOR_PANGO_FONT">EDITOR_PANGO_FONT</a></code></em>.</p> |
| 1338 | <p>Object for drawing text. Uses internally Pango.</p> |
| 1339 | <p>Instances of this object can be created using <em><code><a title="fluxity.FluxityContext.create_text_layout" href="#fluxity.FluxityContext.create_text_layout">FluxityContext.create_text_layout()</a></code></em>.</p></div> |
| 1340 | <details class="source"> |
| 1341 | <summary> |
| 1342 | <span>Expand source code</span> |
| 1343 | </summary> |
| 1344 | <pre><code class="python">class PangoTextLayout: |
| 1345 | |
| 1346 | """ |
| 1347 | **`font_data(tuple)`** this tuple can be acquired by calling *`FluxityContext.get_editor_value()`* on editors of type *`EDITOR_PANGO_FONT`*. |
| 1348 | |
| 1349 | Object for drawing text. Uses internally Pango. |
| 1350 | |
| 1351 | Instances of this object can be created using *`FluxityContext.create_text_layout()`*. |
| 1352 | """ |
| 1353 | def __init__(self, font_data): |
| 1354 | self.font_family, self.font_face, self.font_size, self.alignment, \ |
| 1355 | self.color_rgba, self.fill_on, self.outline_color_rgba, self.outline_on, \ |
| 1356 | self.outline_width, self.shadow_on, self.shadow_color_rgb, self.shadow_opacity, \ |
| 1357 | self.shadow_xoff, self.shadow_yoff, self.shadow_blur, self.gradient_color_rgba, \ |
| 1358 | self.gradient_direction = font_data |
| 1359 | self.font_desc = None |
| 1360 | self.pango_layout = None |
| 1361 | self.opacity = 1.0 |
| 1362 | self.pixel_size = None |
| 1363 | |
| 1364 | def create_pango_layout(self, cr, text): |
| 1365 | """ |
| 1366 | **`cr(cairo.Context)`** frame cairo context acquired with *`FluxityContext.get_frame_cr()`*. |
| 1367 | |
| 1368 | **`text(str)`** displayed text. |
| 1369 | |
| 1370 | Creates internally *`PangoCairo`* layout object. Calling this is required before calling *`PangoTextLayout.get_pixel_size()`*. |
| 1371 | """ |
| 1372 | self.text = text |
| 1373 | |
| 1374 | fontmap = PangoCairo.font_map_new() |
| 1375 | context = fontmap.create_context() |
| 1376 | font_options = cairo.FontOptions() |
| 1377 | font_options.set_antialias(cairo.Antialias.GOOD) |
| 1378 | PangoCairo.context_set_font_options(context, font_options) |
| 1379 | context.changed() |
| 1380 | |
| 1381 | self.pango_layout = Pango.Layout.new(context) |
| 1382 | |
| 1383 | self.pango_layout.set_text(self.text, -1) |
| 1384 | font_desc = Pango.FontDescription(self.font_family + " " + self.font_face + " " + str(self.font_size)) |
| 1385 | self.pango_layout.set_font_description(font_desc) |
| 1386 | self.pango_layout.set_alignment(self.alignment) |
| 1387 | if self.pixel_size == None: |
| 1388 | metrics = self.pango_layout.get_context().get_metrics(font_desc, None) |
| 1389 | self.ascent = metrics.get_ascent() / Pango.SCALE |
| 1390 | self.descent = metrics.get_descent() / Pango.SCALE |
| 1391 | self.height = metrics.get_height() / Pango.SCALE |
| 1392 | w, h = self.pango_layout.get_size() |
| 1393 | self.pixel_size = (w / Pango.SCALE, self.height) |
| 1394 | |
| 1395 | def get_top_pad(self): |
| 1396 | """ |
| 1397 | Returns pixel distance from layout top to highest possible pixel drawn for any font. |
| 1398 | |
| 1399 | **Returns:** (int)(pad) Top pad size in pixels. |
| 1400 | """ |
| 1401 | return self.height - self.descent - self.ascent |
| 1402 | |
| 1403 | |
| 1404 | def get_pixel_size(self): |
| 1405 | """ |
| 1406 | Returns size of layout. |
| 1407 | |
| 1408 | Before calling this PangoCairo layout object needs to created *`PangoTextLayout.create_pango_layout()`* or *`PangoTextLayout.draw_layout()`.* |
| 1409 | |
| 1410 | **Returns:** (int, int)(width, height) pixel size of layout. |
| 1411 | """ |
| 1412 | return self.pixel_size |
| 1413 | |
| 1414 | def set_opacity(self, opacity): |
| 1415 | """ |
| 1416 | **`opacity(float)`** Opacity in range 0.0 - 1.0. |
| 1417 | |
| 1418 | Sets opacity for the text to be drawn. Default value is 1.0 |
| 1419 | """ |
| 1420 | if opacity < 0.0: |
| 1421 | opacity = 0.0 |
| 1422 | if opacity > 1.0: |
| 1423 | opacity = 1.0 |
| 1424 | |
| 1425 | self.opacity = opacity |
| 1426 | |
| 1427 | # called from vieweditor draw vieweditor-> editorlayer->here |
| 1428 | def draw_layout(self, fctx, text, cr, x, y, rotation=0.0, xscale=1.0, yscale=1.0): |
| 1429 | """ |
| 1430 | ** fctx(fluxity.FluxityContext ** context object. |
| 1431 | |
| 1432 | **`text(str)`** displayed text. |
| 1433 | |
| 1434 | **`cr(cairo.Context)`** frame cairo context acquired with *`FluxityContext.get_frame_cr()`*. |
| 1435 | |
| 1436 | **`x(float)`** Text X position. |
| 1437 | |
| 1438 | **`y(float)`** Text Y position. |
| 1439 | |
| 1440 | **`rotation(float)`** Text rotation. |
| 1441 | |
| 1442 | **`xscale(float)`** Text X scaling. |
| 1443 | |
| 1444 | **`yscale(float)`** Text Y scaling. |
| 1445 | |
| 1446 | Draws text on provided *`cairo.Context`*. |
| 1447 | |
| 1448 | Calls internally *`PangoTextLayout.create_pango_layout()`* so *`PangoTextLayout.get_pixel_size()`* can be called after this. |
| 1449 | """ |
| 1450 | self.text = text |
| 1451 | cr.save() # Created each frame |
| 1452 | |
| 1453 | self.create_pango_layout(cr, text) |
| 1454 | layout = self.pango_layout # this just artifact of dev. history, create_pango_layout() was added later then draw_layout() |
| 1455 | # to be used in typewriter plugin. |
| 1456 | # Shadow |
| 1457 | if self.shadow_on: |
| 1458 | cr.save() |
| 1459 | |
| 1460 | # Get colors. |
| 1461 | r, g, b = self.shadow_color_rgb |
| 1462 | a = (self.shadow_opacity / 100.0) * self.opacity |
| 1463 | |
| 1464 | # Blurred shadow need its own ImageSurface |
| 1465 | if self.shadow_blur != 0.0: |
| 1466 | w, h = fctx.get_dimensions() |
| 1467 | blurred_img = cairo.ImageSurface(cairo.FORMAT_ARGB32, w, h) |
| 1468 | cr_blurred = cairo.Context(blurred_img) |
| 1469 | cr_blurred.set_antialias(cairo.Antialias.GOOD) |
| 1470 | transform_cr = cr_blurred # Set draw transform_cr to context for newly created image. |
| 1471 | else: |
| 1472 | transform_cr = cr # Set draw transform_cr to out context. |
| 1473 | |
| 1474 | # Transform and set color. |
| 1475 | transform_cr.set_source_rgba(r, g, b, a) |
| 1476 | effective_shadow_xoff = self.shadow_xoff * xscale |
| 1477 | effective_shadow_yoff = self.shadow_yoff * yscale |
| 1478 | transform_cr.move_to(x + effective_shadow_xoff, y + effective_shadow_yoff) |
| 1479 | transform_cr.scale(xscale, yscale) |
| 1480 | transform_cr.rotate(rotation) |
| 1481 | |
| 1482 | # If no blur for shadow, just draw layout on out context. |
| 1483 | if self.shadow_blur == 0.0: |
| 1484 | PangoCairo.update_layout(cr, layout) |
| 1485 | PangoCairo.show_layout(cr, layout) |
| 1486 | cr.restore() |
| 1487 | else: |
| 1488 | # If we have blur - draw shadow, blur it and then draw on out context. |
| 1489 | PangoCairo.update_layout(cr_blurred, layout) |
| 1490 | PangoCairo.show_layout(cr_blurred, layout) |
| 1491 | |
| 1492 | img2 = Image.frombuffer("RGBA", (blurred_img.get_width(), blurred_img.get_height()), blurred_img.get_data(), "raw", "RGBA", 0, 1) |
| 1493 | effective_blur = xscale * self.shadow_blur # This is not going to be exact |
| 1494 | # on non-100% scales but let's try to get approximation. |
| 1495 | img2 = img2.filter(ImageFilter.GaussianBlur(radius=int(effective_blur))) |
| 1496 | imgd = img2.tobytes() |
| 1497 | a = array.array('B',imgd) |
| 1498 | |
| 1499 | stride = blurred_img.get_width() * 4 |
| 1500 | draw_surface = cairo.ImageSurface.create_for_data (a, cairo.FORMAT_ARGB32, |
| 1501 | blurred_img.get_width(), blurred_img.get_height(), stride) |
| 1502 | cr.restore() |
| 1503 | cr.set_source_surface(draw_surface, 0, 0) |
| 1504 | cr.paint() |
| 1505 | |
| 1506 | # Text |
| 1507 | if self.fill_on: |
| 1508 | if self.gradient_color_rgba == None: |
| 1509 | cr.set_source_rgba(*self._get_opacity_rgba(self.color_rgba)) |
| 1510 | else: |
| 1511 | w, h = self.pixel_size |
| 1512 | w = float(w) * xscale |
| 1513 | h = float(h) * yscale |
| 1514 | if self.gradient_direction == HORIZONTAL: |
| 1515 | grad = cairo.LinearGradient (x, 0, x + w, 0) |
| 1516 | else: |
| 1517 | grad = cairo.LinearGradient (0, y, 0, y + h) |
| 1518 | |
| 1519 | r, g, b, a = self.color_rgba |
| 1520 | rg, gg, bg, ag = self.gradient_color_rgba |
| 1521 | |
| 1522 | CLIP_COLOR_GRAD_1 = (0, r, g, b, 1.0) |
| 1523 | CLIP_COLOR_GRAD_2 = (1, rg, gg, bg, 1.0) |
| 1524 | grad.add_color_stop_rgba(*CLIP_COLOR_GRAD_1) |
| 1525 | grad.add_color_stop_rgba(*CLIP_COLOR_GRAD_2) |
| 1526 | cr.set_source(grad) |
| 1527 | |
| 1528 | cr.move_to(x, y) |
| 1529 | cr.scale(xscale, yscale) |
| 1530 | cr.rotate(rotation) |
| 1531 | |
| 1532 | PangoCairo.update_layout(cr, layout) |
| 1533 | PangoCairo.show_layout(cr, layout) |
| 1534 | |
| 1535 | # Outline |
| 1536 | if self.outline_on: |
| 1537 | if self.fill_on == False: # case when user only wants outline we need to transform here |
| 1538 | cr.move_to(x, y) |
| 1539 | cr.scale(xscale, yscale) |
| 1540 | cr.rotate(rotation) |
| 1541 | PangoCairo.layout_path(cr, layout) |
| 1542 | cr.set_source_rgba(*self._get_opacity_rgba(self.outline_color_rgba)) |
| 1543 | cr.set_line_width(self.outline_width) |
| 1544 | cr.stroke() |
| 1545 | |
| 1546 | cr.restore() |
| 1547 | |
| 1548 | def get_pango_alignment(self): |
| 1549 | """ |
| 1550 | Returns alignment for his layout. |
| 1551 | |
| 1552 | To interpret enums script must do import *`from gi.repository import Pango`* |
| 1553 | |
| 1554 | **Returns:** (int) alignment enum, either *`Pango.Alignment.CENTER`*, *`Pango.Alignment.LEFT`* or *`Pango.Alignment.RIGHT`*. |
| 1555 | """ |
| 1556 | return self.alignment |
| 1557 | |
| 1558 | def _get_opacity_rgba(self, rbga): |
| 1559 | r, g, b, a = rbga |
| 1560 | return (r, g, b, a * self.opacity)</code></pre> |
| 1561 | </details> |
| 1562 | <h3>Methods</h3> |
| 1563 | <dl> |
| 1564 | <dt id="fluxity.PangoTextLayout.create_pango_layout"><code class="name flex"> |
| 1565 | <span>def <span class="ident">create_pango_layout</span></span>(<span>self, cr, text)</span> |
| 1566 | </code></dt> |
| 1567 | <dd> |
| 1568 | <div class="desc"><p><strong><code>cr(cairo.Context)</code></strong> frame cairo context acquired with <em><code><a title="fluxity.FluxityContext.get_frame_cr" href="#fluxity.FluxityContext.get_frame_cr">FluxityContext.get_frame_cr()</a></code></em>.</p> |
| 1569 | <p><strong><code>text(str)</code></strong> displayed text.</p> |
| 1570 | <p>Creates internally <em><code>PangoCairo</code></em> layout object. Calling this is required before calling <em><code><a title="fluxity.PangoTextLayout.get_pixel_size" href="#fluxity.PangoTextLayout.get_pixel_size">PangoTextLayout.get_pixel_size()</a></code></em>.</p></div> |
| 1571 | </dd> |
| 1572 | <dt id="fluxity.PangoTextLayout.draw_layout"><code class="name flex"> |
| 1573 | <span>def <span class="ident">draw_layout</span></span>(<span>self, fctx, text, cr, x, y, rotation=0.0, xscale=1.0, yscale=1.0)</span> |
| 1574 | </code></dt> |
| 1575 | <dd> |
| 1576 | <div class="desc"><p>** fctx(fluxity.FluxityContext ** context object.</p> |
| 1577 | <p><strong><code>text(str)</code></strong> displayed text.</p> |
| 1578 | <p><strong><code>cr(cairo.Context)</code></strong> frame cairo context acquired with <em><code><a title="fluxity.FluxityContext.get_frame_cr" href="#fluxity.FluxityContext.get_frame_cr">FluxityContext.get_frame_cr()</a></code></em>.</p> |
| 1579 | <p><strong><code>x(float)</code></strong> Text X position.</p> |
| 1580 | <p><strong><code>y(float)</code></strong> Text Y position.</p> |
| 1581 | <p><strong><code>rotation(float)</code></strong> Text rotation.</p> |
| 1582 | <p><strong><code>xscale(float)</code></strong> Text X scaling.</p> |
| 1583 | <p><strong><code>yscale(float)</code></strong> Text Y scaling.</p> |
| 1584 | <p>Draws text on provided <em><code>cairo.Context</code></em>.</p> |
| 1585 | <p>Calls internally <em><code><a title="fluxity.PangoTextLayout.create_pango_layout" href="#fluxity.PangoTextLayout.create_pango_layout">PangoTextLayout.create_pango_layout()</a></code></em> so <em><code><a title="fluxity.PangoTextLayout.get_pixel_size" href="#fluxity.PangoTextLayout.get_pixel_size">PangoTextLayout.get_pixel_size()</a></code></em> can be called after this.</p></div> |
| 1586 | </dd> |
| 1587 | <dt id="fluxity.PangoTextLayout.get_pango_alignment"><code class="name flex"> |
| 1588 | <span>def <span class="ident">get_pango_alignment</span></span>(<span>self)</span> |
| 1589 | </code></dt> |
| 1590 | <dd> |
| 1591 | <div class="desc"><p>Returns alignment for his layout.</p> |
| 1592 | <p>To interpret enums script must do import <em><code>from gi.repository import Pango</code></em></p> |
| 1593 | <p><strong>Returns:</strong> (int) alignment enum, either <em><code>Pango.Alignment.CENTER</code></em>, <em><code>Pango.Alignment.LEFT</code></em> or <em><code>Pango.Alignment.RIGHT</code></em>.</p></div> |
| 1594 | </dd> |
| 1595 | <dt id="fluxity.PangoTextLayout.get_pixel_size"><code class="name flex"> |
| 1596 | <span>def <span class="ident">get_pixel_size</span></span>(<span>self)</span> |
| 1597 | </code></dt> |
| 1598 | <dd> |
| 1599 | <div class="desc"><p>Returns size of layout.</p> |
| 1600 | <p>Before calling this PangoCairo layout object needs to created <em><code><a title="fluxity.PangoTextLayout.create_pango_layout" href="#fluxity.PangoTextLayout.create_pango_layout">PangoTextLayout.create_pango_layout()</a></code></em> or <em><code><a title="fluxity.PangoTextLayout.draw_layout" href="#fluxity.PangoTextLayout.draw_layout">PangoTextLayout.draw_layout()</a></code>.</em></p> |
| 1601 | <p><strong>Returns:</strong> (int, int)(width, height) pixel size of layout.</p></div> |
| 1602 | </dd> |
| 1603 | <dt id="fluxity.PangoTextLayout.get_top_pad"><code class="name flex"> |
| 1604 | <span>def <span class="ident">get_top_pad</span></span>(<span>self)</span> |
| 1605 | </code></dt> |
| 1606 | <dd> |
| 1607 | <div class="desc"><p>Returns pixel distance from layout top to highest possible pixel drawn for any font. </p> |
| 1608 | <p><strong>Returns:</strong> (int)(pad) Top pad size in pixels.</p></div> |
| 1609 | </dd> |
| 1610 | <dt id="fluxity.PangoTextLayout.set_opacity"><code class="name flex"> |
| 1611 | <span>def <span class="ident">set_opacity</span></span>(<span>self, opacity)</span> |
| 1612 | </code></dt> |
| 1613 | <dd> |
| 1614 | <div class="desc"><p><strong><code>opacity(float)</code></strong> Opacity in range 0.0 - 1.0.</p> |
| 1615 | <p>Sets opacity for the text to be drawn. Default value is 1.0</p></div> |
| 1616 | </dd> |
| 1617 | </dl> |
| 1618 | </dd> |
| 1619 | </dl> |
| 1620 | </section> |
| 1621 | </article> |
| 1622 | <nav id="sidebar"> |
| 1623 | <div class="toc"> |
| 1624 | <ul> |
| 1625 | <li><a href="#gpl-licence-text">GPL Licence text</a></li> |
| 1626 | <li><a href="#fluxity-scripting">FLUXITY SCRIPTING</a><ul> |
| 1627 | <li><a href="#script-interface">SCRIPT INTERFACE</a></li> |
| 1628 | <li><a href="#script-lifecycle">SCRIPT LIFECYCLE</a></li> |
| 1629 | <li><a href="#example-script">EXAMPLE SCRIPT</a><ul> |
| 1630 | <li><a href="#init_script">init_script()</a></li> |
| 1631 | <li><a href="#init_render">init_render()</a></li> |
| 1632 | <li><a href="#render_frame">render_frame()</a></li> |
| 1633 | </ul> |
| 1634 | </li> |
| 1635 | <li><a href="#developing-fluxity-scripts">DEVELOPING FLUXITY SCRIPTS</a></li> |
| 1636 | <li><a href="#fluxity-api-versions">FLUXITY API VERSIONS</a></li> |
| 1637 | </ul> |
| 1638 | </li> |
| 1639 | <li><a href="#fluxity-api">FLUXITY API</a></li> |
| 1640 | </ul> |
| 1641 | </div> |
| 1642 | <ul id="index"> |
| 1643 | <li><h3><a href="#header-variables">Global variables</a></h3> |
| 1644 | <ul class=""> |
| 1645 | <li><code><a title="fluxity.API_VERSION" href="#fluxity.API_VERSION">API_VERSION</a></code></li> |
| 1646 | <li><code><a title="fluxity.EDITOR_CHECK_BOX" href="#fluxity.EDITOR_CHECK_BOX">EDITOR_CHECK_BOX</a></code></li> |
| 1647 | <li><code><a title="fluxity.EDITOR_COLOR" href="#fluxity.EDITOR_COLOR">EDITOR_COLOR</a></code></li> |
| 1648 | <li><code><a title="fluxity.EDITOR_FILE_PATH" href="#fluxity.EDITOR_FILE_PATH">EDITOR_FILE_PATH</a></code></li> |
| 1649 | <li><code><a title="fluxity.EDITOR_FLOAT" href="#fluxity.EDITOR_FLOAT">EDITOR_FLOAT</a></code></li> |
| 1650 | <li><code><a title="fluxity.EDITOR_FLOAT_RANGE" href="#fluxity.EDITOR_FLOAT_RANGE">EDITOR_FLOAT_RANGE</a></code></li> |
| 1651 | <li><code><a title="fluxity.EDITOR_HTML_LINK" href="#fluxity.EDITOR_HTML_LINK">EDITOR_HTML_LINK</a></code></li> |
| 1652 | <li><code><a title="fluxity.EDITOR_INT" href="#fluxity.EDITOR_INT">EDITOR_INT</a></code></li> |
| 1653 | <li><code><a title="fluxity.EDITOR_INT_RANGE" href="#fluxity.EDITOR_INT_RANGE">EDITOR_INT_RANGE</a></code></li> |
| 1654 | <li><code><a title="fluxity.EDITOR_OPTIONS" href="#fluxity.EDITOR_OPTIONS">EDITOR_OPTIONS</a></code></li> |
| 1655 | <li><code><a title="fluxity.EDITOR_PANGO_FONT" href="#fluxity.EDITOR_PANGO_FONT">EDITOR_PANGO_FONT</a></code></li> |
| 1656 | <li><code><a title="fluxity.EDITOR_PANGO_FONT_DEFAULT_VALUES" href="#fluxity.EDITOR_PANGO_FONT_DEFAULT_VALUES">EDITOR_PANGO_FONT_DEFAULT_VALUES</a></code></li> |
| 1657 | <li><code><a title="fluxity.EDITOR_TEXT" href="#fluxity.EDITOR_TEXT">EDITOR_TEXT</a></code></li> |
| 1658 | <li><code><a title="fluxity.EDITOR_TEXT_AREA" href="#fluxity.EDITOR_TEXT_AREA">EDITOR_TEXT_AREA</a></code></li> |
| 1659 | <li><code><a title="fluxity.KEYFRAME_DISCRETE" href="#fluxity.KEYFRAME_DISCRETE">KEYFRAME_DISCRETE</a></code></li> |
| 1660 | <li><code><a title="fluxity.KEYFRAME_LINEAR" href="#fluxity.KEYFRAME_LINEAR">KEYFRAME_LINEAR</a></code></li> |
| 1661 | <li><code><a title="fluxity.KEYFRAME_SMOOTH" href="#fluxity.KEYFRAME_SMOOTH">KEYFRAME_SMOOTH</a></code></li> |
| 1662 | <li><code><a title="fluxity.LOCAL_ROOT" href="#fluxity.LOCAL_ROOT">LOCAL_ROOT</a></code></li> |
| 1663 | <li><code><a title="fluxity.PROFILE_COLORSPACE" href="#fluxity.PROFILE_COLORSPACE">PROFILE_COLORSPACE</a></code></li> |
| 1664 | <li><code><a title="fluxity.PROFILE_DESCRIPTION" href="#fluxity.PROFILE_DESCRIPTION">PROFILE_DESCRIPTION</a></code></li> |
| 1665 | <li><code><a title="fluxity.PROFILE_DISPLAY_ASPECT_DEN" href="#fluxity.PROFILE_DISPLAY_ASPECT_DEN">PROFILE_DISPLAY_ASPECT_DEN</a></code></li> |
| 1666 | <li><code><a title="fluxity.PROFILE_DISPLAY_ASPECT_NUM" href="#fluxity.PROFILE_DISPLAY_ASPECT_NUM">PROFILE_DISPLAY_ASPECT_NUM</a></code></li> |
| 1667 | <li><code><a title="fluxity.PROFILE_FRAME_RATE_DEN" href="#fluxity.PROFILE_FRAME_RATE_DEN">PROFILE_FRAME_RATE_DEN</a></code></li> |
| 1668 | <li><code><a title="fluxity.PROFILE_FRAME_RATE_NUM" href="#fluxity.PROFILE_FRAME_RATE_NUM">PROFILE_FRAME_RATE_NUM</a></code></li> |
| 1669 | <li><code><a title="fluxity.PROFILE_HEIGHT" href="#fluxity.PROFILE_HEIGHT">PROFILE_HEIGHT</a></code></li> |
| 1670 | <li><code><a title="fluxity.PROFILE_PROGRESSIVE" href="#fluxity.PROFILE_PROGRESSIVE">PROFILE_PROGRESSIVE</a></code></li> |
| 1671 | <li><code><a title="fluxity.PROFILE_SAMPLE_ASPECT_DEN" href="#fluxity.PROFILE_SAMPLE_ASPECT_DEN">PROFILE_SAMPLE_ASPECT_DEN</a></code></li> |
| 1672 | <li><code><a title="fluxity.PROFILE_SAMPLE_ASPECT_NUM" href="#fluxity.PROFILE_SAMPLE_ASPECT_NUM">PROFILE_SAMPLE_ASPECT_NUM</a></code></li> |
| 1673 | <li><code><a title="fluxity.PROFILE_WIDTH" href="#fluxity.PROFILE_WIDTH">PROFILE_WIDTH</a></code></li> |
| 1674 | </ul> |
| 1675 | </li> |
| 1676 | <li><h3><a href="#header-functions">Functions</a></h3> |
| 1677 | <ul class=""> |
| 1678 | <li><code><a title="fluxity.get_script_default_edit_data" href="#fluxity.get_script_default_edit_data">get_script_default_edit_data</a></code></li> |
| 1679 | </ul> |
| 1680 | </li> |
| 1681 | <li><h3><a href="#header-classes">Classes</a></h3> |
| 1682 | <ul> |
| 1683 | <li> |
| 1684 | <h4><code><a title="fluxity.AffineTransform" href="#fluxity.AffineTransform">AffineTransform</a></code></h4> |
| 1685 | <ul class=""> |
| 1686 | <li><code><a title="fluxity.AffineTransform.apply_transform" href="#fluxity.AffineTransform.apply_transform">apply_transform</a></code></li> |
| 1687 | </ul> |
| 1688 | </li> |
| 1689 | <li> |
| 1690 | <h4><code><a title="fluxity.AnimatedValue" href="#fluxity.AnimatedValue">AnimatedValue</a></code></h4> |
| 1691 | <ul class=""> |
| 1692 | <li><code><a title="fluxity.AnimatedValue.add_keyframe_at_frame" href="#fluxity.AnimatedValue.add_keyframe_at_frame">add_keyframe_at_frame</a></code></li> |
| 1693 | <li><code><a title="fluxity.AnimatedValue.get_value" href="#fluxity.AnimatedValue.get_value">get_value</a></code></li> |
| 1694 | </ul> |
| 1695 | </li> |
| 1696 | <li> |
| 1697 | <h4><code><a title="fluxity.FluxityContext" href="#fluxity.FluxityContext">FluxityContext</a></code></h4> |
| 1698 | <ul class=""> |
| 1699 | <li><code><a title="fluxity.FluxityContext.add_editor" href="#fluxity.FluxityContext.add_editor">add_editor</a></code></li> |
| 1700 | <li><code><a title="fluxity.FluxityContext.add_editor_group" href="#fluxity.FluxityContext.add_editor_group">add_editor_group</a></code></li> |
| 1701 | <li><code><a title="fluxity.FluxityContext.create_text_layout" href="#fluxity.FluxityContext.create_text_layout">create_text_layout</a></code></li> |
| 1702 | <li><code><a title="fluxity.FluxityContext.get_data_obj" href="#fluxity.FluxityContext.get_data_obj">get_data_obj</a></code></li> |
| 1703 | <li><code><a title="fluxity.FluxityContext.get_dimensions" href="#fluxity.FluxityContext.get_dimensions">get_dimensions</a></code></li> |
| 1704 | <li><code><a title="fluxity.FluxityContext.get_editor_value" href="#fluxity.FluxityContext.get_editor_value">get_editor_value</a></code></li> |
| 1705 | <li><code><a title="fluxity.FluxityContext.get_editors_values_clone_dict" href="#fluxity.FluxityContext.get_editors_values_clone_dict">get_editors_values_clone_dict</a></code></li> |
| 1706 | <li><code><a title="fluxity.FluxityContext.get_frame_cr" href="#fluxity.FluxityContext.get_frame_cr">get_frame_cr</a></code></li> |
| 1707 | <li><code><a title="fluxity.FluxityContext.get_length" href="#fluxity.FluxityContext.get_length">get_length</a></code></li> |
| 1708 | <li><code><a title="fluxity.FluxityContext.get_profile_property" href="#fluxity.FluxityContext.get_profile_property">get_profile_property</a></code></li> |
| 1709 | <li><code><a title="fluxity.FluxityContext.get_script_data" href="#fluxity.FluxityContext.get_script_data">get_script_data</a></code></li> |
| 1710 | <li><code><a title="fluxity.FluxityContext.get_script_dir" href="#fluxity.FluxityContext.get_script_dir">get_script_dir</a></code></li> |
| 1711 | <li><code><a title="fluxity.FluxityContext.log_line" href="#fluxity.FluxityContext.log_line">log_line</a></code></li> |
| 1712 | <li><code><a title="fluxity.FluxityContext.required_api_version" href="#fluxity.FluxityContext.required_api_version">required_api_version</a></code></li> |
| 1713 | <li><code><a title="fluxity.FluxityContext.set_author" href="#fluxity.FluxityContext.set_author">set_author</a></code></li> |
| 1714 | <li><code><a title="fluxity.FluxityContext.set_data_obj" href="#fluxity.FluxityContext.set_data_obj">set_data_obj</a></code></li> |
| 1715 | <li><code><a title="fluxity.FluxityContext.set_editors_data" href="#fluxity.FluxityContext.set_editors_data">set_editors_data</a></code></li> |
| 1716 | <li><code><a title="fluxity.FluxityContext.set_frame_name" href="#fluxity.FluxityContext.set_frame_name">set_frame_name</a></code></li> |
| 1717 | <li><code><a title="fluxity.FluxityContext.set_length" href="#fluxity.FluxityContext.set_length">set_length</a></code></li> |
| 1718 | <li><code><a title="fluxity.FluxityContext.set_name" href="#fluxity.FluxityContext.set_name">set_name</a></code></li> |
| 1719 | <li><code><a title="fluxity.FluxityContext.set_prints_to_log_file" href="#fluxity.FluxityContext.set_prints_to_log_file">set_prints_to_log_file</a></code></li> |
| 1720 | <li><code><a title="fluxity.FluxityContext.set_version" href="#fluxity.FluxityContext.set_version">set_version</a></code></li> |
| 1721 | </ul> |
| 1722 | </li> |
| 1723 | <li> |
| 1724 | <h4><code><a title="fluxity.FluxityUserMessageError" href="#fluxity.FluxityUserMessageError">FluxityUserMessageError</a></code></h4> |
| 1725 | </li> |
| 1726 | <li> |
| 1727 | <h4><code><a title="fluxity.PangoTextLayout" href="#fluxity.PangoTextLayout">PangoTextLayout</a></code></h4> |
| 1728 | <ul class="two-column"> |
| 1729 | <li><code><a title="fluxity.PangoTextLayout.create_pango_layout" href="#fluxity.PangoTextLayout.create_pango_layout">create_pango_layout</a></code></li> |
| 1730 | <li><code><a title="fluxity.PangoTextLayout.draw_layout" href="#fluxity.PangoTextLayout.draw_layout">draw_layout</a></code></li> |
| 1731 | <li><code><a title="fluxity.PangoTextLayout.get_pango_alignment" href="#fluxity.PangoTextLayout.get_pango_alignment">get_pango_alignment</a></code></li> |
| 1732 | <li><code><a title="fluxity.PangoTextLayout.get_pixel_size" href="#fluxity.PangoTextLayout.get_pixel_size">get_pixel_size</a></code></li> |
| 1733 | <li><code><a title="fluxity.PangoTextLayout.get_top_pad" href="#fluxity.PangoTextLayout.get_top_pad">get_top_pad</a></code></li> |
| 1734 | <li><code><a title="fluxity.PangoTextLayout.set_opacity" href="#fluxity.PangoTextLayout.set_opacity">set_opacity</a></code></li> |
| 1735 | </ul> |
| 1736 | </li> |
| 1737 | </ul> |
| 1738 | </li> |
| 1739 | </ul> |
| 1740 | </nav> |
| 1741 | </main> |
| 1742 | <footer id="footer"> |
| 1743 | <p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.1</a>.</p> |
| 1744 | </footer> |
| 1745 | </body> |
| 1746 | </html> |