XIV-Character-Cards/CardCreator.html
Documentation ddcb0e9ac8 Updates
2021-08-21 20:28:45 +00:00

722 lines
No EOL
8.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: CardCreator</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: CardCreator</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>CardCreator<span class="signature">()</span><span class="type-signature"></span></h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="CardCreator"><span class="type-signature"></span>new CardCreator<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Creates a new card creator.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="create-card.js.html">create-card.js</a>, <a href="create-card.js.html#line87">line 87</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="canvasSize"><span class="type-signature"></span>canvasSize<span class="type-signature"> :<a href="CardCreator.html#~CanvasDimensions">CardCreator~CanvasDimensions</a></span></h4>
<div class="description">
The canvas's dimensions.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="CardCreator.html#~CanvasDimensions">CardCreator~CanvasDimensions</a></span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="create-card.js.html">create-card.js</a>, <a href="create-card.js.html#line101">line 101</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="createCard"><span class="type-signature">(async) </span>createCard<span class="signature">(charaId, customImage)</span><span class="type-signature"> &rarr; {Promise.&lt;Buffer>}</span></h4>
<div class="description">
Creates a character card for a character.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>charaId</code></td>
<td class="type">
<span class="param-type">number</span>
|
<span class="param-type">string</span>
</td>
<td class="description last">The Lodestone ID of the character to generate a card for.</td>
</tr>
<tr>
<td class="name"><code>customImage</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">Buffer</span>
|
<span class="param-type">null</span>
|
<span class="param-type">undefined</span>
</td>
<td class="description last">Optional parameter providing a custom
image to be drawn between the background of the character card and the black information boxes.
The image should be the same resolution as the default image. The default image size can be
retrieved with <a href="CardCreator.html#canvasSize">CardCreator#canvasSize</a>. May be a URL, `data: `URI, a local file path,
or a Buffer instance.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="create-card.js.html">create-card.js</a>, <a href="create-card.js.html#line302">line 302</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
A promise representating the construction of the card's image data.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Buffer></span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>const fs = require("fs");
const card = new CardCreator();
const lodestoneId = "13821878";
await card.ensureInit();
const png = await card.createCard(lodestoneId);
fs.writeFile("./test.png", png, err => {
if (err) console.error(err);
});</code></pre>
<h4 class="name" id="ensureInit"><span class="type-signature">(async) </span>ensureInit<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<div class="description">
Ensures that the instance is ready to generate character cards.
This function must be resolved before using character card
generation methods.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="create-card.js.html">create-card.js</a>, <a href="create-card.js.html#line114">line 114</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
A promise representing the initialization state of this generator.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id="~CanvasDimensions">CanvasDimensions</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>width</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">The width of the canvas.</td>
</tr>
<tr>
<td class="name"><code>height</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">The height of the canvas.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="create-card.js.html">create-card.js</a>, <a href="create-card.js.html#line91">line 91</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="CardCreator.html">CardCreator</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Sat Aug 21 2021 20:28:44 GMT+0000 (Coordinated Universal Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>