2
0

PatternStyle.html 16 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Class: PatternStyle</title>
  6. <script src="scripts/prettify/prettify.js"> </script>
  7. <script src="scripts/prettify/lang-css.js"> </script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  12. <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  13. </head>
  14. <body>
  15. <div id="main">
  16. <h1 class="page-title">Class: PatternStyle</h1>
  17. <section>
  18. <header>
  19. <h2><span class="attribs"><span class="type-signature"></span></span>PatternStyle<span class="signature">(source)</span><span class="type-signature"></span></h2>
  20. </header>
  21. <article>
  22. <div class="container-overview">
  23. <h4 class="name" id="PatternStyle"><span class="type-signature"></span>new PatternStyle<span class="signature">(source)</span><span class="type-signature"></span></h4>
  24. <div class="description">
  25. Pattern style represents an opaque object describing a pattern, based on an image, a canvas, or a video.
  26. The get method returns a CanvasPattern object https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern created by the context.createPattern() method.
  27. </div>
  28. <h5>Parameters:</h5>
  29. <table class="params">
  30. <thead>
  31. <tr>
  32. <th>Name</th>
  33. <th>Type</th>
  34. <th class="last">Description</th>
  35. </tr>
  36. </thead>
  37. <tbody>
  38. <tr>
  39. <td class="name"><code>source</code></td>
  40. <td class="type">
  41. <span class="param-type">CanvasImageSource</span>
  42. </td>
  43. <td class="description last">Source element of the pattern.</td>
  44. </tr>
  45. </tbody>
  46. </table>
  47. <dl class="details">
  48. <dt class="tag-source">Source:</dt>
  49. <dd class="tag-source"><ul class="dummy"><li>
  50. <a href="objects_style_PatternStyle.js.html">objects/style/PatternStyle.js</a>, <a href="objects_style_PatternStyle.js.html#line14">line 14</a>
  51. </li></ul></dd>
  52. </dl>
  53. </div>
  54. <h3 class="subsection-title">Extends</h3>
  55. <ul>
  56. <li><a href="Style.html">Style</a></li>
  57. </ul>
  58. <h3 class="subsection-title">Members</h3>
  59. <h4 class="name" id="cache"><span class="type-signature"></span>cache<span class="type-signature"> :string|CanvasGradient|CanvasPattern</span></h4>
  60. <div class="description">
  61. Cached style object pre-generated from previous calls. To avoid regenerating the same style object every cycle.
  62. Inherited classes should write their own get method that returns the style object and stores it in this property.
  63. </div>
  64. <h5>Type:</h5>
  65. <ul>
  66. <li>
  67. <span class="param-type">string</span>
  68. |
  69. <span class="param-type">CanvasGradient</span>
  70. |
  71. <span class="param-type">CanvasPattern</span>
  72. </li>
  73. </ul>
  74. <dl class="details">
  75. <dt class="tag-overrides">Overrides:</dt>
  76. <dd class="tag-overrides"><ul class="dummy"><li>
  77. <a href="Style.html#cache">Style#cache</a>
  78. </li></ul></dd>
  79. <dt class="tag-source">Source:</dt>
  80. <dd class="tag-source"><ul class="dummy"><li>
  81. <a href="objects_style_Style.js.html">objects/style/Style.js</a>, <a href="objects_style_Style.js.html#line17">line 17</a>
  82. </li></ul></dd>
  83. </dl>
  84. <h4 class="name" id="matrix"><span class="type-signature"></span>matrix<span class="type-signature"> :<a href="Matrix.html">Matrix</a></span></h4>
  85. <div class="description">
  86. Transformation matrix applied to the pattern.
  87. The transformation allows to move, rotate and scale the pattern freely
  88. </div>
  89. <h5>Type:</h5>
  90. <ul>
  91. <li>
  92. <span class="param-type"><a href="Matrix.html">Matrix</a></span>
  93. </li>
  94. </ul>
  95. <dl class="details">
  96. <dt class="tag-source">Source:</dt>
  97. <dd class="tag-source"><ul class="dummy"><li>
  98. <a href="objects_style_PatternStyle.js.html">objects/style/PatternStyle.js</a>, <a href="objects_style_PatternStyle.js.html#line45">line 45</a>
  99. </li></ul></dd>
  100. </dl>
  101. <h4 class="name" id="needsUpdate"><span class="type-signature"></span>needsUpdate<span class="type-signature"> :boolean</span></h4>
  102. <div class="description">
  103. Indicates if the style object needs to be updated, should be used after applying changed to the style in order to generate a new object.
  104. Inherited classes should implement this functionality.
  105. </div>
  106. <h5>Type:</h5>
  107. <ul>
  108. <li>
  109. <span class="param-type">boolean</span>
  110. </li>
  111. </ul>
  112. <dl class="details">
  113. <dt class="tag-overrides">Overrides:</dt>
  114. <dd class="tag-overrides"><ul class="dummy"><li>
  115. <a href="Style.html#needsUpdate">Style#needsUpdate</a>
  116. </li></ul></dd>
  117. <dt class="tag-source">Source:</dt>
  118. <dd class="tag-source"><ul class="dummy"><li>
  119. <a href="objects_style_Style.js.html">objects/style/Style.js</a>, <a href="objects_style_Style.js.html#line26">line 26</a>
  120. </li></ul></dd>
  121. </dl>
  122. <h4 class="name" id="repetition"><span class="type-signature"></span>repetition<span class="type-signature"> :string</span></h4>
  123. <div class="description">
  124. Repetition indicates how the pattern image should be repeated.
  125. Possible values are "repeat", "repeat-x", "repeat-y" or "no-repeat".
  126. More information about this attribute here https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createPattern.
  127. </div>
  128. <h5>Type:</h5>
  129. <ul>
  130. <li>
  131. <span class="param-type">string</span>
  132. </li>
  133. </ul>
  134. <dl class="details">
  135. <dt class="tag-source">Source:</dt>
  136. <dd class="tag-source"><ul class="dummy"><li>
  137. <a href="objects_style_PatternStyle.js.html">objects/style/PatternStyle.js</a>, <a href="objects_style_PatternStyle.js.html#line36">line 36</a>
  138. </li></ul></dd>
  139. </dl>
  140. <h4 class="name" id="source"><span class="type-signature"></span>source<span class="type-signature"> :CanvasImageSource</span></h4>
  141. <div class="description">
  142. Source of the pattern style. Can be a image, video or another canvas element
  143. By default a empty image element is created.
  144. </div>
  145. <h5>Type:</h5>
  146. <ul>
  147. <li>
  148. <span class="param-type">CanvasImageSource</span>
  149. </li>
  150. </ul>
  151. <dl class="details">
  152. <dt class="tag-source">Source:</dt>
  153. <dd class="tag-source"><ul class="dummy"><li>
  154. <a href="objects_style_PatternStyle.js.html">objects/style/PatternStyle.js</a>, <a href="objects_style_PatternStyle.js.html#line25">line 25</a>
  155. </li></ul></dd>
  156. </dl>
  157. <h3 class="subsection-title">Methods</h3>
  158. <h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(context)</span><span class="type-signature"> &rarr; {string|CanvasGradient|CanvasPattern}</span></h4>
  159. <div class="description">
  160. Get generated style object from style data and the drawing context.
  161. </div>
  162. <h5>Parameters:</h5>
  163. <table class="params">
  164. <thead>
  165. <tr>
  166. <th>Name</th>
  167. <th>Type</th>
  168. <th class="last">Description</th>
  169. </tr>
  170. </thead>
  171. <tbody>
  172. <tr>
  173. <td class="name"><code>context</code></td>
  174. <td class="type">
  175. <span class="param-type">CanvasRenderingContext2D</span>
  176. </td>
  177. <td class="description last">Context being used to draw the object.</td>
  178. </tr>
  179. </tbody>
  180. </table>
  181. <dl class="details">
  182. <dt class="tag-overrides">Overrides:</dt>
  183. <dd class="tag-overrides"><ul class="dummy"><li>
  184. <a href="Style.html#get">Style#get</a>
  185. </li></ul></dd>
  186. <dt class="tag-source">Source:</dt>
  187. <dd class="tag-source"><ul class="dummy"><li>
  188. <a href="objects_style_Style.js.html">objects/style/Style.js</a>, <a href="objects_style_Style.js.html#line35">line 35</a>
  189. </li></ul></dd>
  190. </dl>
  191. <h5>Returns:</h5>
  192. <div class="param-desc">
  193. Return the canvas style object generated.
  194. </div>
  195. <dl>
  196. <dt>
  197. Type
  198. </dt>
  199. <dd>
  200. <span class="param-type">string</span>
  201. |
  202. <span class="param-type">CanvasGradient</span>
  203. |
  204. <span class="param-type">CanvasPattern</span>
  205. </dd>
  206. </dl>
  207. <h4 class="name" id="parse"><span class="type-signature"></span>parse<span class="signature">(data)</span><span class="type-signature"></span></h4>
  208. <div class="description">
  209. Parse the style attributes from JSON object data created with the serialize() method.
  210. </div>
  211. <h5>Parameters:</h5>
  212. <table class="params">
  213. <thead>
  214. <tr>
  215. <th>Name</th>
  216. <th>Type</th>
  217. <th class="last">Description</th>
  218. </tr>
  219. </thead>
  220. <tbody>
  221. <tr>
  222. <td class="name"><code>data</code></td>
  223. <td class="type">
  224. <span class="param-type">Object</span>
  225. </td>
  226. <td class="description last">Serialized style data.</td>
  227. </tr>
  228. </tbody>
  229. </table>
  230. <dl class="details">
  231. <dt class="tag-overrides">Overrides:</dt>
  232. <dd class="tag-overrides"><ul class="dummy"><li>
  233. <a href="Style.html#parse">Style#parse</a>
  234. </li></ul></dd>
  235. <dt class="tag-source">Source:</dt>
  236. <dd class="tag-source"><ul class="dummy"><li>
  237. <a href="objects_style_Style.js.html">objects/style/Style.js</a>, <a href="objects_style_Style.js.html#line49">line 49</a>
  238. </li></ul></dd>
  239. </dl>
  240. <h4 class="name" id="serialize"><span class="type-signature"></span>serialize<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>
  241. <div class="description">
  242. Serialize the style to JSON object, called by the objects using these styles.
  243. </div>
  244. <dl class="details">
  245. <dt class="tag-overrides">Overrides:</dt>
  246. <dd class="tag-overrides"><ul class="dummy"><li>
  247. <a href="Style.html#serialize">Style#serialize</a>
  248. </li></ul></dd>
  249. <dt class="tag-source">Source:</dt>
  250. <dd class="tag-source"><ul class="dummy"><li>
  251. <a href="objects_style_Style.js.html">objects/style/Style.js</a>, <a href="objects_style_Style.js.html#line42">line 42</a>
  252. </li></ul></dd>
  253. </dl>
  254. <h5>Returns:</h5>
  255. <div class="param-desc">
  256. Serialized style data.
  257. </div>
  258. <dl>
  259. <dt>
  260. Type
  261. </dt>
  262. <dd>
  263. <span class="param-type">Object</span>
  264. </dd>
  265. </dl>
  266. <h4 class="name" id="setTransform"><span class="type-signature"></span>setTransform<span class="signature">(transform)</span><span class="type-signature"></span></h4>
  267. <div class="description">
  268. Applies an 2x3 transformation matrix representing a linear transform to the pattern.
  269. </div>
  270. <h5>Parameters:</h5>
  271. <table class="params">
  272. <thead>
  273. <tr>
  274. <th>Name</th>
  275. <th>Type</th>
  276. <th class="last">Description</th>
  277. </tr>
  278. </thead>
  279. <tbody>
  280. <tr>
  281. <td class="name"><code>transform</code></td>
  282. <td class="type">
  283. <span class="param-type">Array.&lt;number></span>
  284. </td>
  285. <td class="description last">2x3 Transformation matrix.</td>
  286. </tr>
  287. </tbody>
  288. </table>
  289. <dl class="details">
  290. <dt class="tag-source">Source:</dt>
  291. <dd class="tag-source"><ul class="dummy"><li>
  292. <a href="objects_style_PatternStyle.js.html">objects/style/PatternStyle.js</a>, <a href="objects_style_PatternStyle.js.html#line56">line 56</a>
  293. </li></ul></dd>
  294. </dl>
  295. </article>
  296. </section>
  297. </div>
  298. <nav>
  299. <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnimationTimer.html">AnimationTimer</a></li><li><a href="BarGraph.html">BarGraph</a></li><li><a href="BezierCurve.html">BezierCurve</a></li><li><a href="Box.html">Box</a></li><li><a href="Box2.html">Box2</a></li><li><a href="BoxMask.html">BoxMask</a></li><li><a href="Circle.html">Circle</a></li><li><a href="ColorStyle.html">ColorStyle</a></li><li><a href="DOM.html">DOM</a></li><li><a href="EventManager.html">EventManager</a></li><li><a href="FileUtils.html">FileUtils</a></li><li><a href="Gauge.html">Gauge</a></li><li><a href="GradientColorStop.html">GradientColorStop</a></li><li><a href="GradientStyle.html">GradientStyle</a></li><li><a href="Graph.html">Graph</a></li><li><a href="Helpers.html">Helpers</a></li><li><a href="Image.html">Image</a></li><li><a href="Key.html">Key</a></li><li><a href="Line.html">Line</a></li><li><a href="LinearGradientStyle.html">LinearGradientStyle</a></li><li><a href="Mask.html">Mask</a></li><li><a href="Matrix.html">Matrix</a></li><li><a href="MultiLineText.html">MultiLineText</a></li><li><a href="Node.html">Node</a></li><li><a href="NodeConnector.html">NodeConnector</a></li><li><a href="NodeGraph.html">NodeGraph</a></li><li><a href="NodeSocket.html">NodeSocket</a></li><li><a href="Object2D.html">Object2D</a></li><li><a href="Path.html">Path</a></li><li><a href="Pattern.html">Pattern</a></li><li><a href="PatternStyle.html">PatternStyle</a></li><li><a href="PieChart.html">PieChart</a></li><li><a href="Pointer.html">Pointer</a></li><li><a href="QuadraticCurve.html">QuadraticCurve</a></li><li><a href="RadialGradientStyle.html">RadialGradientStyle</a></li><li><a href="Renderer.html">Renderer</a></li><li><a href="RoundedBox.html">RoundedBox</a></li><li><a href="ScatterGraph.html">ScatterGraph</a></li><li><a href="Style.html">Style</a></li><li><a href="Text.html">Text</a></li><li><a href="UUID.html">UUID</a></li><li><a href="Vector2.html">Vector2</a></li><li><a href="Viewport.html">Viewport</a></li><li><a href="ViewportControls.html">ViewportControls</a></li></ul><h3>Global</h3><ul><li><a href="global.html#writeFile">writeFile</a></li></ul>
  300. </nav>
  301. <br class="clear">
  302. <footer>
  303. Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Sat Sep 17 2022 14:24:36 GMT+0100 (Hora de verão da Europa Ocidental)
  304. </footer>
  305. <script> prettyPrint(); </script>
  306. <script src="scripts/linenumber.js"> </script>
  307. </body>
  308. </html>