PatternStyle.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188
  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. </div>
  63. <h5>Type:</h5>
  64. <ul>
  65. <li>
  66. <span class="param-type">string</span>
  67. |
  68. <span class="param-type">CanvasGradient</span>
  69. |
  70. <span class="param-type">CanvasPattern</span>
  71. </li>
  72. </ul>
  73. <dl class="details">
  74. <dt class="tag-overrides">Overrides:</dt>
  75. <dd class="tag-overrides"><ul class="dummy"><li>
  76. <a href="Style.html#cache">Style#cache</a>
  77. </li></ul></dd>
  78. <dt class="tag-source">Source:</dt>
  79. <dd class="tag-source"><ul class="dummy"><li>
  80. <a href="objects_style_Style.js.html">objects/style/Style.js</a>, <a href="objects_style_Style.js.html#line15">line 15</a>
  81. </li></ul></dd>
  82. </dl>
  83. <h4 class="name" id="matrix"><span class="type-signature"></span>matrix<span class="type-signature"> :<a href="Matrix.html">Matrix</a></span></h4>
  84. <div class="description">
  85. Transformation matrix applied to the pattern.
  86. The transformation allows to move, rotate and scale the pattern freely
  87. </div>
  88. <h5>Type:</h5>
  89. <ul>
  90. <li>
  91. <span class="param-type"><a href="Matrix.html">Matrix</a></span>
  92. </li>
  93. </ul>
  94. <dl class="details">
  95. <dt class="tag-source">Source:</dt>
  96. <dd class="tag-source"><ul class="dummy"><li>
  97. <a href="objects_style_PatternStyle.js.html">objects/style/PatternStyle.js</a>, <a href="objects_style_PatternStyle.js.html#line45">line 45</a>
  98. </li></ul></dd>
  99. </dl>
  100. <h4 class="name" id="needsUpdate"><span class="type-signature"></span>needsUpdate<span class="type-signature"> :boolean</span></h4>
  101. <div class="description">
  102. 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.
  103. </div>
  104. <h5>Type:</h5>
  105. <ul>
  106. <li>
  107. <span class="param-type">boolean</span>
  108. </li>
  109. </ul>
  110. <dl class="details">
  111. <dt class="tag-overrides">Overrides:</dt>
  112. <dd class="tag-overrides"><ul class="dummy"><li>
  113. <a href="Style.html#needsUpdate">Style#needsUpdate</a>
  114. </li></ul></dd>
  115. <dt class="tag-source">Source:</dt>
  116. <dd class="tag-source"><ul class="dummy"><li>
  117. <a href="objects_style_Style.js.html">objects/style/Style.js</a>, <a href="objects_style_Style.js.html#line23">line 23</a>
  118. </li></ul></dd>
  119. </dl>
  120. <h4 class="name" id="repetition"><span class="type-signature"></span>repetition<span class="type-signature"> :string</span></h4>
  121. <div class="description">
  122. Repetition indicates how the pattern image should be repeated.
  123. Possible values are "repeat", "repeat-x", "repeat-y" or "no-repeat".
  124. More information about this attribute here https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createPattern.
  125. </div>
  126. <h5>Type:</h5>
  127. <ul>
  128. <li>
  129. <span class="param-type">string</span>
  130. </li>
  131. </ul>
  132. <dl class="details">
  133. <dt class="tag-source">Source:</dt>
  134. <dd class="tag-source"><ul class="dummy"><li>
  135. <a href="objects_style_PatternStyle.js.html">objects/style/PatternStyle.js</a>, <a href="objects_style_PatternStyle.js.html#line36">line 36</a>
  136. </li></ul></dd>
  137. </dl>
  138. <h4 class="name" id="source"><span class="type-signature"></span>source<span class="type-signature"> :CanvasImageSource</span></h4>
  139. <div class="description">
  140. Source of the pattern style. Can be a image, video or another canvas element
  141. By default a empty image element is created.
  142. </div>
  143. <h5>Type:</h5>
  144. <ul>
  145. <li>
  146. <span class="param-type">CanvasImageSource</span>
  147. </li>
  148. </ul>
  149. <dl class="details">
  150. <dt class="tag-source">Source:</dt>
  151. <dd class="tag-source"><ul class="dummy"><li>
  152. <a href="objects_style_PatternStyle.js.html">objects/style/PatternStyle.js</a>, <a href="objects_style_PatternStyle.js.html#line25">line 25</a>
  153. </li></ul></dd>
  154. </dl>
  155. <h3 class="subsection-title">Methods</h3>
  156. <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>
  157. <div class="description">
  158. Get generated style object from style data and the drawing context.
  159. </div>
  160. <h5>Parameters:</h5>
  161. <table class="params">
  162. <thead>
  163. <tr>
  164. <th>Name</th>
  165. <th>Type</th>
  166. <th class="last">Description</th>
  167. </tr>
  168. </thead>
  169. <tbody>
  170. <tr>
  171. <td class="name"><code>context</code></td>
  172. <td class="type">
  173. <span class="param-type">CanvasRenderingContext2D</span>
  174. </td>
  175. <td class="description last">Context being used to draw the object.</td>
  176. </tr>
  177. </tbody>
  178. </table>
  179. <dl class="details">
  180. <dt class="tag-overrides">Overrides:</dt>
  181. <dd class="tag-overrides"><ul class="dummy"><li>
  182. <a href="Style.html#get">Style#get</a>
  183. </li></ul></dd>
  184. <dt class="tag-source">Source:</dt>
  185. <dd class="tag-source"><ul class="dummy"><li>
  186. <a href="objects_style_Style.js.html">objects/style/Style.js</a>, <a href="objects_style_Style.js.html#line33">line 33</a>
  187. </li></ul></dd>
  188. </dl>
  189. <h5>Returns:</h5>
  190. <div class="param-desc">
  191. Return the canvas style object generated.
  192. </div>
  193. <dl>
  194. <dt>
  195. Type
  196. </dt>
  197. <dd>
  198. <span class="param-type">string</span>
  199. |
  200. <span class="param-type">CanvasGradient</span>
  201. |
  202. <span class="param-type">CanvasPattern</span>
  203. </dd>
  204. </dl>
  205. <h4 class="name" id="parse"><span class="type-signature"></span>parse<span class="signature">(data)</span><span class="type-signature"></span></h4>
  206. <div class="description">
  207. Parse the style attributes from JSON object data created with the serialize() method.
  208. </div>
  209. <h5>Parameters:</h5>
  210. <table class="params">
  211. <thead>
  212. <tr>
  213. <th>Name</th>
  214. <th>Type</th>
  215. <th class="last">Description</th>
  216. </tr>
  217. </thead>
  218. <tbody>
  219. <tr>
  220. <td class="name"><code>data</code></td>
  221. <td class="type">
  222. <span class="param-type">Object</span>
  223. </td>
  224. <td class="description last">Serialized style data.</td>
  225. </tr>
  226. </tbody>
  227. </table>
  228. <dl class="details">
  229. <dt class="tag-overrides">Overrides:</dt>
  230. <dd class="tag-overrides"><ul class="dummy"><li>
  231. <a href="Style.html#parse">Style#parse</a>
  232. </li></ul></dd>
  233. <dt class="tag-source">Source:</dt>
  234. <dd class="tag-source"><ul class="dummy"><li>
  235. <a href="objects_style_Style.js.html">objects/style/Style.js</a>, <a href="objects_style_Style.js.html#line47">line 47</a>
  236. </li></ul></dd>
  237. </dl>
  238. <h4 class="name" id="serialize"><span class="type-signature"></span>serialize<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>
  239. <div class="description">
  240. Serialize the style to JSON object, called by the objects using these styles.
  241. </div>
  242. <dl class="details">
  243. <dt class="tag-overrides">Overrides:</dt>
  244. <dd class="tag-overrides"><ul class="dummy"><li>
  245. <a href="Style.html#serialize">Style#serialize</a>
  246. </li></ul></dd>
  247. <dt class="tag-source">Source:</dt>
  248. <dd class="tag-source"><ul class="dummy"><li>
  249. <a href="objects_style_Style.js.html">objects/style/Style.js</a>, <a href="objects_style_Style.js.html#line40">line 40</a>
  250. </li></ul></dd>
  251. </dl>
  252. <h5>Returns:</h5>
  253. <div class="param-desc">
  254. Serialized style data.
  255. </div>
  256. <dl>
  257. <dt>
  258. Type
  259. </dt>
  260. <dd>
  261. <span class="param-type">Object</span>
  262. </dd>
  263. </dl>
  264. <h4 class="name" id="setTransform"><span class="type-signature"></span>setTransform<span class="signature">(transform)</span><span class="type-signature"></span></h4>
  265. <div class="description">
  266. Applies an 2x3 transformation matrix representing a linear transform to the pattern.
  267. </div>
  268. <h5>Parameters:</h5>
  269. <table class="params">
  270. <thead>
  271. <tr>
  272. <th>Name</th>
  273. <th>Type</th>
  274. <th class="last">Description</th>
  275. </tr>
  276. </thead>
  277. <tbody>
  278. <tr>
  279. <td class="name"><code>transform</code></td>
  280. <td class="type">
  281. <span class="param-type">Array.&lt;number></span>
  282. </td>
  283. <td class="description last">2x3 Transformation matrix.</td>
  284. </tr>
  285. </tbody>
  286. </table>
  287. <dl class="details">
  288. <dt class="tag-source">Source:</dt>
  289. <dd class="tag-source"><ul class="dummy"><li>
  290. <a href="objects_style_PatternStyle.js.html">objects/style/PatternStyle.js</a>, <a href="objects_style_PatternStyle.js.html#line56">line 56</a>
  291. </li></ul></dd>
  292. </dl>
  293. </article>
  294. </section>
  295. </div>
  296. <nav>
  297. <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnimationTimer.html">AnimationTimer</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="Pattern.html">Pattern</a></li><li><a href="PatternStyle.html">PatternStyle</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="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>
  298. </nav>
  299. <br class="clear">
  300. <footer>
  301. Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a> on Sun Jun 14 2020 20:43:33 GMT+0100 (Western European Summer Time)
  302. </footer>
  303. <script> prettyPrint(); </script>
  304. <script src="scripts/linenumber.js"> </script>
  305. </body>
  306. </html>