2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
import{_ as a,a as t,b as r,ag as d}from"./chunks/framework.BcrMLAmg.js";const g=JSON.parse('{"title":"Image","description":"","frontmatter":{},"headers":[],"relativePath":"references/elements/Image.md","filePath":"references/elements/Image.md","lastUpdated":1757844696000}'),i={name:"references/elements/Image.md"};function o(h,e,l,n,s,c){return r(),t("div",null,e[0]||(e[0]=[d('<h1 id="image" tabindex="-1">Image <a class="header-anchor" href="#image" aria-label="Permalink to "Image""></a></h1><p><em>This is the Image element class which can be used to display bimg formatted images.</em><em>Bimg is a universal ComputerCraft image format.</em><em>See: <a href="https://github.com/SkyTheCodeMaster/bimg" target="_blank" rel="noreferrer">https://github.com/SkyTheCodeMaster/bimg</a></em></p><p>Extends: <code>VisualElement</code></p><h2 id="properties" tabindex="-1">Properties <a class="header-anchor" href="#properties" aria-label="Permalink to "Properties""></a></h2><table tabindex="0"><thead><tr><th>Property</th><th>Type</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td>bimg</td><td>table</td><td>{}</td><td>The bimg image data</td></tr><tr><td>currentFrame</td><td>number</td><td>1</td><td>Current animation frame</td></tr><tr><td>autoResize</td><td>boolean</td><td>false</td><td>Whether to automatically resize the image when content exceeds bounds</td></tr><tr><td>offsetX</td><td>number</td><td>0</td><td>Horizontal offset for viewing larger images</td></tr><tr><td>offsetY</td><td>number</td><td>0</td><td>Vertical offset for viewing larger images</td></tr></tbody></table><h2 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-label="Permalink to "Functions""></a></h2><table tabindex="0"><thead><tr><th>Method</th><th>Returns</th><th>Description</th></tr></thead><tbody><tr><td><a href="#image-resizeimage-width-height">Image:resizeImage</a></td><td>Image</td><td>Resizes the image to the specified width and height</td></tr><tr><td><a href="#image-getimagesize">Image:getImageSize</a></td><td>number, number</td><td>Gets the size of the image</td></tr><tr><td><a href="#image-getpixeldata-x-y">Image:getPixelData</a></td><td>fg, bg, char</td><td>Gets pixel information at position</td></tr><tr><td><a href="#image-settext-x-y-text">Image:setText</a></td><td>Image</td><td>Sets the text at the specified position</td></tr><tr><td><a href="#image-gettext-x-y-length">Image:getText</a></td><td>string</td><td>Gets the text at the specified position</td></tr><tr><td><a href="#image-setfg-x-y-pattern">Image:setFg</a></td><td>Image</td><td>Sets the foreground color at the specified position</td></tr><tr><td><a href="#image-getfg-x-y-length">Image:getFg</a></td><td>string</td><td>Gets the foreground color at the specified position</td></tr><tr><td><a href="#image-setbg-x-y-pattern">Image:setBg</a></td><td>Image</td><td>Sets the background color at the specified position</td></tr><tr><td><a href="#image-getbg-x-y-length">Image:getBg</a></td><td>string</td><td>Gets the background color at the specified position</td></tr><tr><td><a href="#image-setpixel-x-y-char-fg-bg">Image:setPixel</a></td><td>Image</td><td>Sets the pixel at the specified position</td></tr><tr><td><a href="#image-nextframe">Image:nextFrame</a></td><td>Image</td><td>Advances to the next frame in the animation</td></tr><tr><td><a href="#image-addframe">Image:addFrame</a></td><td>Image</td><td>Adds a new frame to the image</td></tr><tr><td><a href="#image-updateframe-frameindex-frame">Image:updateFrame</a></td><td>Image</td><td>Updates the specified frame with the provided data</td></tr><tr><td><a href="#image-getframe-frameindex">Image:getFrame</a></td><td>table</td><td>Gets the specified frame</td></tr><tr><td><a href="#image-getmetadata">Image:getMetadata</a></td><td>table</td><td>Gets the metadata of the image</td></tr><tr><td><a href="#image-setmetadata-key-value">Image:setMetadata</a></td><td>Image</td><td>Sets the metadata of the image</td></tr></tbody></table><h2 id="image-resizeimage-width-height" tabindex="-1">Image:resizeImage(width, height) <a class="header-anchor" href="#image-resizeimage-width-height" aria-label="Permalink to "Image:resizeImage(width, height)""></a></h2><p>Resizes the image to the specified width and height</p><h3 id="parameters" tabindex="-1">Parameters <a class="header-anchor" href="#parameters" aria-label="Permalink to "Parameters""></a></h3><ul><li><code>width</code> <code>number</code> The new width of the image</li><li><code>height</code> <code>number</code> The new height of the image</li></ul><h3 id="returns" tabindex="-1">Returns <a class="header-anchor" href="#returns" aria-label="Permalink to "Returns""></a></h3><ul><li><code>Image</code> <code>self</code> The Image instance</li></ul><h2 id="image-getimagesize" tabindex="-1">Image:getImageSize() <a class="header-anchor" href="#image-getimagesize" aria-label="Permalink to "Image:getImageSize()""></a></h2><p>Gets the size of the image</p><h3 id="returns-1" tabindex="-1">Returns <a class="header-anchor" href="#returns-1" aria-label="Permalink to "Returns""></a></h3><ul><li><code>number</code> <code>width</code> The width of the image</li><li><code>number</code> <code>height</code> The height of the image</li></ul><h2 id="image-getpixeldata-x-y" tabindex="-1">Image:getPixelData(x, y) <a class="header-anchor" href="#image-getpixeldata-x-y" aria-label="Permalink to "Image:getPixelData(x, y)""></a></h2><p>Gets pixel information at position</p><h3 id="parameters-1" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-1" aria-label="Permalink to "Parameters""></a></h3><ul><li><code>x</code> <code>number</code> X position</li><li><code>y</code> <code>number</code> Y position</li></ul><h3 id="returns-2" tabindex="-1">Returns <a class="header-anchor" href="#returns-2" aria-label="Permalink to "Returns""></a></h3><ul><li><code>fg</code> <code>Foreground</code> color</li><li><code>bg</code> <code>Background</code> color</li><li><code>char</code> <code>Character</code> at position</li></ul><h2 id="image-settext-x-y-text" tabindex="-1">Image:setText(x, y, text) <a class="header-anchor" href="#image-settext-x-y-text" aria-label="Permalink to "Image:setText(x, y, text)""></a></h2><p>Sets the text at the specified position</p><h3 id="parameters-2" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-2" aria-label="Permalink to "Parameters""></a></h3><ul><li><code>x</code> <code>number</code> The x position</li><li><code>y</code> <code>number</code> The y position</li><li><code>text</code> <code>string</code> The text to set</li></ul><h3 id="returns-3" tabindex="-1">Returns <a class="header-anchor" href="#returns-3" aria-label="Permalink to "Returns""></a></h3><ul><li><code>Image</code> <code>self</code> The Image instance</li></ul><h2 id="image-gettext-x-y-length" tabindex="-1">Image:getText(x, y, length) <a class="header-anchor" href="#image-gettext-x-y-length" aria-label="Permalink to "Image:getText(x, y, length)""></a></h2><p>Gets the text at the specified position</p><h3 id="parameters-3" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-3" aria-label="Permalink to "Parameters""></a></h3><ul><li><code>x</code> <code>number</code> The x position</li><li><code>y</code> <code>number</code> The y position</li><li><code>length</code> <code>number</code> The length of the text to get</li></ul><h3 id="returns-4" tabindex="-1">Returns <a class="header-anchor" href="#returns-4" aria-label="Permalink to "Returns""></a></h3><ul><li><code>string</code> <code>text</code> The text at the specified position</li></ul><h2 id="image-setfg-x-y-pattern" tabindex="-1">Image:setFg(x, y, pattern) <a class="header-anchor" href="#image-setfg-x-y-pattern" aria-label="Permalink to "Image:setFg(x, y, pattern)""></a></h2><p>Sets the foreground color at the specified position</p><h3 id="parameters-4" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-4" aria-label="Permalink to "Parameters""></a></h3><ul><li><code>x</code> <code>number</code> The x position</li><li><code>y</code> <code>number</code> The y position</li><li><code>pattern</code> <code>string</code> The foreground color pattern</li></ul><h3 id="returns-5" tabindex="-1">Returns <a class="header-anchor" href="#returns-5" aria-label="Permalink to "Returns""></a></h3><ul><li><code>Image</code> <code>self</code> The Image instance</li></ul><h2 id="image-getfg-x-y-length" tabindex="-1">Image:getFg(x, y, length) <a class="header-anchor" href="#image-getfg-x-y-length" aria-label="Permalink to "Image:getFg(x, y, length)""></a></h2><p>Gets the foreground color at the specified position</p><h3 id="parameters-5" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-5" aria-label="Permalink to "Parameters""></a></h3><ul><li><code>x</code> <code>number</code> The x position</li><li><code>y</code> <code>number</code> The y position</li><li><code>length</code> <code>number</code> The length of the foreground color pattern to get</li></ul><h3 id="returns-6" tabindex="-1">Returns <a class="header-anchor" href="#returns-6" aria-label="Permalink to "Returns""></a></h3><ul><li><code>string</code> <code>fg</code> The foreground color pattern</li></ul><h2 id="image-setbg-x-y-pattern" tabindex="-1">Image:setBg(x, y, pattern) <a class="header-anchor" href="#image-setbg-x-y-pattern" aria-label="Permalink to "Image:setBg(x, y, pattern)""></a></h2><p>Sets the background color at the specified position</p><h3 id="parameters-6" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-6" aria-label="Permalink to "Parameters""></a></h3><ul><li><code>x</code> <code>number</code> The x position</li><li><code>y</code> <code>number</code> The y position</li><li><code>pattern</code> <code>string</code> The background color pattern</li></ul><h3 id="returns-7" tabindex="-1">Returns <a class="header-anchor" href="#returns-7" aria-label="Permalink to "Returns""></a></h3><ul><li><code>Image</code> <code>self</code> The Image instance</li></ul><h2 id="image-getbg-x-y-length" tabindex="-1">Image:getBg(x, y, length) <a class="header-anchor" href="#image-getbg-x-y-length" aria-label="Permalink to "Image:getBg(x, y, length)""></a></h2><p>Gets the background color at the specified position</p><h3 id="parameters-7" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-7" aria-label="Permalink to "Parameters""></a></h3><ul><li><code>x</code> <code>number</code> The x position</li><li><code>y</code> <code>number</code> The y position</li><li><code>length</code> <code>number</code> The length of the background color pattern to get</li></ul><h3 id="returns-8" tabindex="-1">Returns <a class="header-anchor" href="#returns-8" aria-label="Permalink to "Returns""></a></h3><ul><li><code>string</code> <code>bg</code> The background color pattern</li></ul><h2 id="image-setpixel-x-y-char-fg-bg" tabindex="-1">Image:setPixel(x, y, char, fg, bg) <a class="header-anchor" href="#image-setpixel-x-y-char-fg-bg" aria-label="Permalink to "Image:setPixel(x, y, char, fg, bg)""></a></h2><p>Sets the pixel at the specified position</p><h3 id="parameters-8" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-8" aria-label="Permalink to "Parameters""></a></h3><ul><li><code>x</code> <code>number</code> The x position</li><li><code>y</code> <code>number</code> The y position</li><li><code>char</code> <code>string</code> The character to set</li><li><code>fg</code> <code>string</code> The foreground color pattern</li><li><code>bg</code> <code>string</code> The background color pattern</li></ul><h3 id="returns-9" tabindex="-1">Returns <a class="header-anchor" href="#returns-9" aria-label="Permalink to "Returns""></a></h3><ul><li><code>Image</code> <code>self</code> The Image instance</li></ul><h2 id="image-nextframe" tabindex="-1">Image:nextFrame() <a class="header-anchor" href="#image-nextframe" aria-label="Permalink to "Image:nextFrame()""></a></h2><p>Advances to the next frame in the animation</p><h3 id="returns-10" tabindex="-1">Returns <a class="header-anchor" href="#returns-10" aria-label="Permalink to "Returns""></a></h3><ul><li><code>Image</code> <code>self</code> The Image instance</li></ul><h2 id="image-addframe" tabindex="-1">Image:addFrame() <a class="header-anchor" href="#image-addframe" aria-label="Permalink to "Image:addFrame()""></a></h2><p>Adds a new frame to the image</p><h3 id="returns-11" tabindex="-1">Returns <a class="header-anchor" href="#returns-11" aria-label="Permalink to "Returns""></a></h3><ul><li><code>Image</code> <code>self</code> The Image instance</li></ul><h2 id="image-updateframe-frameindex-frame" tabindex="-1">Image:updateFrame(frameIndex, frame) <a class="header-anchor" href="#image-updateframe-frameindex-frame" aria-label="Permalink to "Image:updateFrame(frameIndex, frame)""></a></h2><p>Updates the specified frame with the provided data</p><h3 id="parameters-9" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-9" aria-label="Permalink to "Parameters""></a></h3><ul><li><code>frameIndex</code> <code>number</code> The index of the frame to update</li><li><code>frame</code> <code>table</code> The new frame data</li></ul><h3 id="returns-12" tabindex="-1">Returns <a class="header-anchor" href="#returns-12" aria-label="Permalink to "Returns""></a></h3><ul><li><code>Image</code> <code>self</code> The Image instance</li></ul><h2 id="image-getframe-frameindex" tabindex="-1">Image:getFrame(frameIndex) <a class="header-anchor" href="#image-getframe-frameindex" aria-label="Permalink to "Image:getFrame(frameIndex)""></a></h2><p>Gets the specified frame</p><h3 id="parameters-10" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-10" aria-label="Permalink to "Parameters""></a></h3><ul><li><code>frameIndex</code> <code>number</code> The index of the frame to get</li></ul><h3 id="returns-13" tabindex="-1">Returns <a class="header-anchor" href="#returns-13" aria-label="Permalink to "Returns""></a></h3><ul><li><code>table</code> <code>frame</code> The frame data</li></ul><h2 id="image-getmetadata" tabindex="-1">Image:getMetadata() <a class="header-anchor" href="#image-getmetadata" aria-label="Permalink to "Image:getMetadata()""></a></h2><p>Gets the metadata of the image</p><h3 id="returns-14" tabindex="-1">Returns <a class="header-anchor" href="#returns-14" aria-label="Permalink to "Returns""></a></h3><ul><li><code>table</code> <code>metadata</code> The metadata of the image</li></ul><h2 id="image-setmetadata-key-value" tabindex="-1">Image:setMetadata(key, value) <a class="header-anchor" href="#image-setmetadata-key-value" aria-label="Permalink to "Image:setMetadata(key, value)""></a></h2><p>Sets the metadata of the image</p><h3 id="parameters-11" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-11" aria-label="Permalink to "Parameters""></a></h3><ul><li><code>key</code> <code>string</code> The key of the metadata to set</li><li><code>value</code> <code>string</code> The value of the metadata to set</li></ul><h3 id="returns-15" tabindex="-1">Returns <a class="header-anchor" href="#returns-15" aria-label="Permalink to "Returns""></a></h3><ul><li><code>Image</code> <code>self</code> The Image instance</li></ul>',95)]))}const u=a(i,[["render",o]]);export{g as __pageData,u as default};
|