<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Class: Fox::FXImage
— FXRuby API Documentation
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" />
<link rel="stylesheet" href="../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Fox::FXImage";
relpath = '../';
</script>
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../_index.html">Index (F)</a> »
<span class='title'><span class='object_link'><a href="../Fox.html" title="Fox (module)">Fox</a></span></span>
»
<span class="title">FXImage</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Class: Fox::FXImage
</h1>
<div class="box_info">
<dl>
<dt>Inherits:</dt>
<dd>
<span class="inheritName"><span class='object_link'><a href="FXDrawable.html" title="Fox::FXDrawable (class)">FXDrawable</a></span></span>
<ul class="fullTree">
<li>Object</li>
<li class="next"><span class='object_link'><a href="FXObject.html" title="Fox::FXObject (class)">FXObject</a></span></li>
<li class="next"><span class='object_link'><a href="FXId.html" title="Fox::FXId (class)">FXId</a></span></li>
<li class="next"><span class='object_link'><a href="FXDrawable.html" title="Fox::FXDrawable (class)">FXDrawable</a></span></li>
<li class="next">Fox::FXImage</li>
</ul>
<a href="#" class="inheritanceTree">show all</a>
</dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>rdoc-sources/FXImage.rb<span class="defines">,<br />
lib/fox16/core.rb</span>
</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>An Image is a rectangular array of pixels. It supports two representations of these pixels: a client-side pixel buffer which is stored as an array of FXColor, and a server-side pixmap which is stored in an organization directly compatible with the screen, for fast drawing onto the device. The server-side representation is not directly accessible from the current process as it lives in the process of the X Server or GDI.</p>
<h3 id="label-Image+rendering+hints">Image rendering hints</h3>
<dl class="rdoc-list note-list"><dt><code>IMAGE_KEEP</code>
<dd>
<p>Keep pixel data in client. By default, FOX discards of the client-side pixel data for an image after you call create() for that image. When the <code>IMAGE_KEEP</code> option is set for FXImage (or one of its subclasses), the client-side buffer is maintained. You will typically want to set this option if you intend to do repeated re-rendering of the image after it has been created.</p>
</dd><dt><code>IMAGE_OWNED</code>
<dd>
<p>If <code>IMAGE_OWNED</code> is set, the image pixel data is copied into the image. If <code>IMAGE_OWNED</code> is not set, a image pixel string is directly used as memory buffer of the image, without copying the data. If pixel data is given as an Array instead of a string, data is copied in any case.</p>
</dd><dt><code>IMAGE_DITHER</code>
<dd>
<p>Dither image to look better</p>
</dd><dt><code>IMAGE_NEAREST</code>
<dd>
<p>Turn off dithering and map to nearest color</p>
</dd><dt><code>IMAGE_OPAQUE</code>
<dd>
<p>Force opaque background</p>
</dd><dt><code>IMAGE_ALPHACOLOR</code>
<dd>
<p>By default, FOX will use the transparency color obtained from the image file as the transparency (alpha) color. If you pass the <code>IMAGE_ALPHACOLOR</code> flag, the user-specified transparency color will be used instead.</p>
</dd><dt><code>IMAGE_SHMI</code>
<dd>
<p>Using shared memory image</p>
</dd><dt><code>IMAGE_SHMP</code>
<dd>
<p>Using shared memory pixmap</p>
</dd><dt><code>IMAGE_ALPHAGUESS</code>
<dd>
<p>Guess transparency color from corners</p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><div id="subclasses">
<h2>Direct Known Subclasses</h2>
<p class="children"><span class='object_link'><a href="FXBMPImage.html" title="Fox::FXBMPImage (class)">FXBMPImage</a></span>, <span class='object_link'><a href="FXGIFImage.html" title="Fox::FXGIFImage (class)">FXGIFImage</a></span>, <span class='object_link'><a href="FXICOImage.html" title="Fox::FXICOImage (class)">FXICOImage</a></span>, <span class='object_link'><a href="FXIcon.html" title="Fox::FXIcon (class)">FXIcon</a></span>, <span class='object_link'><a href="FXJPGImage.html" title="Fox::FXJPGImage (class)">FXJPGImage</a></span>, <span class='object_link'><a href="FXPCXImage.html" title="Fox::FXPCXImage (class)">FXPCXImage</a></span>, <span class='object_link'><a href="FXPNGImage.html" title="Fox::FXPNGImage (class)">FXPNGImage</a></span>, <span class='object_link'><a href="FXPPMImage.html" title="Fox::FXPPMImage (class)">FXPPMImage</a></span>, <span class='object_link'><a href="FXRGBImage.html" title="Fox::FXRGBImage (class)">FXRGBImage</a></span>, <span class='object_link'><a href="FXTGAImage.html" title="Fox::FXTGAImage (class)">FXTGAImage</a></span>, <span class='object_link'><a href="FXTIFImage.html" title="Fox::FXTIFImage (class)">FXTIFImage</a></span>, <span class='object_link'><a href="FXXBMImage.html" title="Fox::FXXBMImage (class)">FXXBMImage</a></span>, <span class='object_link'><a href="FXXPMImage.html" title="Fox::FXXPMImage (class)">FXXPMImage</a></span></p>
</div>
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#data-instance_method" title="#data (instance method)">#<strong>data</strong> ⇒ Object </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'><dl class="rdoc-list label-list"><dt>deprecated
<dd>
<p>Pixel data <span class='object_link'><a href="FXMemoryBuffer.html" title="Fox::FXMemoryBuffer (class)">FXMemoryBuffer</a></span>.</p>
</dd></dl>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#dataPtr-instance_method" title="#dataPtr (instance method)">#<strong>dataPtr</strong> ⇒ Object </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'>
<p>The pointer to the raw color representation of all image pixels.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#options-instance_method" title="#options (instance method)">#<strong>options</strong> ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Option flags [Integer].</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#pixels-instance_method" title="#pixels (instance method)">#<strong>pixels</strong> ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Array of colors of all image pixels.</p>
</div></span>
</li>
</ul>
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="FXDrawable.html" title="Fox::FXDrawable (class)">FXDrawable</a></span></h3>
<p class="inherited"><span class='object_link'><a href="FXDrawable.html#height-instance_method" title="Fox::FXDrawable#height (method)">#height</a></span>, <span class='object_link'><a href="FXDrawable.html#visual-instance_method" title="Fox::FXDrawable#visual (method)">#visual</a></span>, <span class='object_link'><a href="FXDrawable.html#width-instance_method" title="Fox::FXDrawable#width (method)">#width</a></span></p>
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="FXId.html" title="Fox::FXId (class)">FXId</a></span></h3>
<p class="inherited"><span class='object_link'><a href="FXId.html#app-instance_method" title="Fox::FXId#app (method)">#app</a></span>, <span class='object_link'><a href="FXId.html#userData-instance_method" title="Fox::FXId#userData (method)">#userData</a></span>, <span class='object_link'><a href="FXId.html#xid-instance_method" title="Fox::FXId#xid (method)">#xid</a></span></p>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#blend-instance_method" title="#blend (instance method)">#<strong>blend</strong>(color) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Blend image over uniform color.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#crop-instance_method" title="#crop (instance method)">#<strong>crop</strong>(x, y, w, h, color = 0) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Crop image to given rectangle and then re-render the server-side image from the client-side pixel buffer.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#fade-instance_method" title="#fade (instance method)">#<strong>fade</strong>(color, factor = 255) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Fade an image to a certain color by a certain factor.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#fill-instance_method" title="#fill (instance method)">#<strong>fill</strong>(color) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Fill image with uniform color.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#getPixel-instance_method" title="#getPixel (instance method)">#<strong>getPixel</strong>(x, y) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Return the color of the pixel at (<em>x</em>, <em>y</em>).</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#gradient-instance_method" title="#gradient (instance method)">#<strong>gradient</strong>(topleft, topright, bottomleft, bottomright) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Fill image using a bilinear gradient.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#hasAlpha%3F-instance_method" title="#hasAlpha? (instance method)">#<strong>hasAlpha?</strong> ⇒ Boolean </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Scan the image and return <code>false</code> if it’s fully opaque.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#hgradient-instance_method" title="#hgradient (instance method)">#<strong>hgradient</strong>(left, right) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Fill image using a horizontal gradient.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(a, pix, *args) ⇒ FXImage </a>
</span>
<span class="note title constructor">constructor</span>
<span class="summary_desc"><div class='inline'>
<p>Create an image.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#initialize_without_data_string-instance_method" title="#initialize_without_data_string (instance method)">#<strong>initialize_without_data_string</strong> ⇒ FXImage </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Create an image.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#loadPixels-instance_method" title="#loadPixels (instance method)">#<strong>loadPixels</strong>(store) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Load pixel data from a stream.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#mirror-instance_method" title="#mirror (instance method)">#<strong>mirror</strong>(horizontal, vertical) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Mirror image horizontally and/or vertically and then re-render the server-side image from the client-side pixel buffer.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#pixel_string-instance_method" title="#pixel_string (instance method)">#<strong>pixel_string</strong>(offset = nil, size = nil) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Return a String of the raw color representation of all image pixels.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#release-instance_method" title="#release (instance method)">#<strong>release</strong> ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Release the client-side pixels buffer, free it if it was owned (i.e. if the <code>IMAGE_OWNED</code> option is set)..</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#render-instance_method" title="#render (instance method)">#<strong>render</strong> ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Render the image from client-side pixel buffer, if there is data and if the image width and height are greater than zero.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#restore-instance_method" title="#restore (instance method)">#<strong>restore</strong> ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Restore client-side pixel buffer from image.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#rotate-instance_method" title="#rotate (instance method)">#<strong>rotate</strong>(degrees) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Rotate image counter-clockwise by some number of degrees and then re-render the server-side image from the client-side pixel buffer.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#savePixels-instance_method" title="#savePixels (instance method)">#<strong>savePixels</strong>(store) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Save pixel data to a stream.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#scale-instance_method" title="#scale (instance method)">#<strong>scale</strong>(w, h, quality = 0) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Rescale pixels image to the specified width and height and then re-render the server-side image from the client-side pixel buffer.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#setPixel-instance_method" title="#setPixel (instance method)">#<strong>setPixel</strong>(x, y, clr) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Set pixel at (<em>x</em>, <em>y</em>) to <em>clr</em>.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#setPixels-instance_method" title="#setPixels (instance method)">#<strong>setPixels</strong>(pix, *args) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Populate the image with new pixel data of the same size or of a new size.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#setPixels_without_data_string-instance_method" title="#setPixels_without_data_string (instance method)">#<strong>setPixels_without_data_string</strong> ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Populate the image with new pixel data of the same size or of a new size.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#vgradient-instance_method" title="#vgradient (instance method)">#<strong>vgradient</strong>(top, bottom) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Fill image using a vertical gradient.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#xshear-instance_method" title="#xshear (instance method)">#<strong>xshear</strong>(shear, color = 0) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Shear image horizontally and then re-render the server-side image from the client-side pixel buffer.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#yshear-instance_method" title="#yshear (instance method)">#<strong>yshear</strong>(shear, color = 0) ⇒ Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Shear image verticallyand then re-render the server-side image from the client-side pixel buffer.</p>
</div></span>
</li>
</ul>
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="FXDrawable.html" title="Fox::FXDrawable (class)">FXDrawable</a></span></h3>
<p class="inherited"><span class='object_link'><a href="FXDrawable.html#resize-instance_method" title="Fox::FXDrawable#resize (method)">#resize</a></span></p>
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="FXId.html" title="Fox::FXId (class)">FXId</a></span></h3>
<p class="inherited"><span class='object_link'><a href="FXId.html#create-instance_method" title="Fox::FXId#create (method)">#create</a></span>, <span class='object_link'><a href="FXId.html#created%3F-instance_method" title="Fox::FXId#created? (method)">#created?</a></span>, <span class='object_link'><a href="FXId.html#destroy-instance_method" title="Fox::FXId#destroy (method)">#destroy</a></span>, <span class='object_link'><a href="FXId.html#detach-instance_method" title="Fox::FXId#detach (method)">#detach</a></span>, <span class='object_link'><a href="FXId.html#runOnUiThread-instance_method" title="Fox::FXId#runOnUiThread (method)">#runOnUiThread</a></span></p>
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="FXObject.html" title="Fox::FXObject (class)">FXObject</a></span></h3>
<p class="inherited"><span class='object_link'><a href="FXObject.html#bind-instance_method" title="Fox::FXObject#bind (method)">#bind</a></span>, <span class='object_link'><a href="FXObject.html#handle-instance_method" title="Fox::FXObject#handle (method)">#handle</a></span>, <span class='object_link'><a href="FXObject.html#load-instance_method" title="Fox::FXObject#load (method)">#load</a></span>, <span class='object_link'><a href="FXObject.html#save-instance_method" title="Fox::FXObject#save (method)">#save</a></span>, <span class='object_link'><a href="FXObject.html#subclasses-class_method" title="Fox::FXObject.subclasses (method)">subclasses</a></span></p>
<div id="constructor_details" class="method_details_list">
<h2>Constructor Details</h2>
<div class="method_details first">
<h3 class="signature first" id="initialize-instance_method">
#<strong>initialize</strong>(a, pix, *args) ⇒ <tt><span class='object_link'><a href="" title="Fox::FXImage (class)">FXImage</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Create an image. If a client-side pixel buffer has been specified, the image owns the pixel buffer. If the <code>IMAGE_OWNED</code> flag is set but a <code>nil</code> pixel buffer is passed, a pixel buffer will be automatically created and will be owned by the image. The flags <code>IMAGE_SHMI</code> and <code>IMAGE_SHMP</code> may be specified for large images to instruct <span class='object_link'><a href="#render-instance_method" title="Fox::FXImage#render (method)">#render</a></span> to use shared memory to communicate with the server.</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>a</code>
<dd>
<p>an application instance <span class='object_link'><a href="FXApp.html" title="Fox::FXApp (class)">Fox::FXApp</a></span></p>
</dd><dt><code>pixels</code>
<dd>
<p>pixels [Array of FXColor values or string of raw [RGBA] values]</p>
</dd><dt><code>opts</code>
<dd>
<p>image options [Integer]</p>
</dd><dt><code>width</code>
<dd>
<p>image width [Integer]</p>
</dd><dt><code>height</code>
<dd>
<p>image height [Integer]</p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
77
78</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 77</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span> <span class='id identifier rubyid_pixels'>pixels</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='op'>=</span><span class='int'>0</span><span class='comma'>,</span> <span class='id identifier rubyid_width'>width</span><span class='op'>=</span><span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_height'>height</span><span class='op'>=</span><span class='int'>1</span><span class='rparen'>)</span> <span class='comment'># :yields: theImage
</span><span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_attr_details" class="attr_details">
<h2>Instance Attribute Details</h2>
<span id=""></span>
<div class="method_details first">
<h3 class="signature first" id="data-instance_method">
#<strong>data</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<dl class="rdoc-list label-list"><dt>deprecated
<dd>
<p>Pixel data <span class='object_link'><a href="FXMemoryBuffer.html" title="Fox::FXMemoryBuffer (class)">Fox::FXMemoryBuffer</a></span></p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
46
47
48</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 46</span>
<span class='kw'>def</span> <span class='id identifier rubyid_data'>data</span>
<span class='ivar'>@data</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id=""></span>
<div class="method_details ">
<h3 class="signature " id="dataPtr-instance_method">
#<strong>dataPtr</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>The pointer to the raw color representation of all image pixels.</p>
<p>It can be used to pass raw image data to FFI, Fiddle or OpenGL.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
51
52
53</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 51</span>
<span class='kw'>def</span> <span class='id identifier rubyid_dataPtr'>dataPtr</span>
<span class='ivar'>@dataPtr</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id="options=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="options-instance_method">
#<strong>options</strong> ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Option flags [Integer]</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
58
59
60</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 58</span>
<span class='kw'>def</span> <span class='id identifier rubyid_options'>options</span>
<span class='ivar'>@options</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id="pixels=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="pixels-instance_method">
#<strong>pixels</strong> ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Array of colors of all image pixels. Can also be written as String of raw [RGBA] values.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
54
55
56</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 54</span>
<span class='kw'>def</span> <span class='id identifier rubyid_pixels'>pixels</span>
<span class='ivar'>@pixels</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="blend-instance_method">
#<strong>blend</strong>(color) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Blend image over uniform color.</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>color</code>
<dd>
<p>the blended color <span class='object_link'><a href="FXColor.html" title="Fox::FXColor (class)">Fox::FXColor</a></span></p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
292</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 292</span>
<span class='kw'>def</span> <span class='id identifier rubyid_blend'>blend</span><span class='lparen'>(</span><span class='id identifier rubyid_color'>color</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="crop-instance_method">
#<strong>crop</strong>(x, y, w, h, color = 0) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Crop image to given rectangle and then re-render the server-side image from the client-side pixel buffer. This method calls resize() to adjust the client and server side representations. The new image may be smaller or larger than the old one; blank areas are filled with color. There must be at least one pixel of overlap between the old and the new image.</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>x</code>
<dd>
<p>x-coordinate for top left corner of the clip rectangle [Integer]</p>
</dd><dt><code>y</code>
<dd>
<p>y-coordinate for top left corner of the clip rectangle [Integer]</p>
</dd><dt><code>width</code>
<dd>
<p>width of the clip rectangle [Integer]</p>
</dd><dt><code>height</code>
<dd>
<p>height of the clip rectangle [Integer]</p>
</dd><dt><code>color</code>
<dd>
<p>fill color for blank areas after crop <span class='object_link'><a href="FXColor.html" title="Fox::FXColor (class)">Fox::FXColor</a></span></p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
210</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 210</span>
<span class='kw'>def</span> <span class='id identifier rubyid_crop'>crop</span><span class='lparen'>(</span><span class='id identifier rubyid_x'>x</span><span class='comma'>,</span> <span class='id identifier rubyid_y'>y</span><span class='comma'>,</span> <span class='id identifier rubyid_w'>w</span><span class='comma'>,</span> <span class='id identifier rubyid_h'>h</span><span class='comma'>,</span> <span class='id identifier rubyid_color'>color</span><span class='op'>=</span><span class='int'>0</span><span class='rparen'>)</span> <span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="fade-instance_method">
#<strong>fade</strong>(color, factor = 255) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Fade an image to a certain color by a certain factor. The <em>factor</em> is some integer value between 0 and 255 inclusive, where a factor of 255 indicates no fading and a factor of zero indicates that the image is completely faded to the fade <em>color</em>.</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>color</code>
<dd>
<p>the fade color <span class='object_link'><a href="FXColor.html" title="Fox::FXColor (class)">Fox::FXColor</a></span></p>
</dd><dt><code>factor</code>
<dd>
<p>fading factor [Integer]</p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
225</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 225</span>
<span class='kw'>def</span> <span class='id identifier rubyid_fade'>fade</span><span class='lparen'>(</span><span class='id identifier rubyid_color'>color</span><span class='comma'>,</span> <span class='id identifier rubyid_factor'>factor</span><span class='op'>=</span><span class='int'>255</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="fill-instance_method">
#<strong>fill</strong>(color) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Fill image with uniform color.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
213</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 213</span>
<span class='kw'>def</span> <span class='id identifier rubyid_fill'>fill</span><span class='lparen'>(</span><span class='id identifier rubyid_color'>color</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="getPixel-instance_method">
#<strong>getPixel</strong>(x, y) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Return the color of the pixel at (<em>x</em>, <em>y</em>).</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>x</code>
<dd>
<p>x-coordinate of the pixel of interest [Integer]</p>
</dd><dt><code>y</code>
<dd>
<p>y-coordinate of the pixel of interest [Integer]</p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
115</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 115</span>
<span class='kw'>def</span> <span class='id identifier rubyid_getPixel'>getPixel</span><span class='lparen'>(</span><span class='id identifier rubyid_x'>x</span><span class='comma'>,</span> <span class='id identifier rubyid_y'>y</span><span class='rparen'>)</span> <span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="gradient-instance_method">
#<strong>gradient</strong>(topleft, topright, bottomleft, bottomright) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Fill image using a bilinear gradient.</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>topleft</code>
<dd>
<p>pixel color for top-left corner <span class='object_link'><a href="FXColor.html" title="Fox::FXColor (class)">Fox::FXColor</a></span></p>
</dd><dt><code>topright</code>
<dd>
<p>pixel color for top-right corner <span class='object_link'><a href="FXColor.html" title="Fox::FXColor (class)">Fox::FXColor</a></span></p>
</dd><dt><code>bottomleft</code>
<dd>
<p>pixel color for bottom-left corner <span class='object_link'><a href="FXColor.html" title="Fox::FXColor (class)">Fox::FXColor</a></span></p>
</dd><dt><code>bottomright</code>
<dd>
<p>pixel color for bottom-right corner <span class='object_link'><a href="FXColor.html" title="Fox::FXColor (class)">Fox::FXColor</a></span></p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
283</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 283</span>
<span class='kw'>def</span> <span class='id identifier rubyid_gradient'>gradient</span><span class='lparen'>(</span><span class='id identifier rubyid_topleft'>topleft</span><span class='comma'>,</span> <span class='id identifier rubyid_topright'>topright</span><span class='comma'>,</span> <span class='id identifier rubyid_bottomleft'>bottomleft</span><span class='comma'>,</span> <span class='id identifier rubyid_bottomright'>bottomright</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="hasAlpha?-instance_method">
#<strong>hasAlpha?</strong> ⇒ <tt>Boolean</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Scan the image and return <code>false</code> if it’s fully opaque.</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Boolean</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
129</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 129</span>
<span class='kw'>def</span> <span class='id identifier rubyid_hasAlpha?'>hasAlpha?</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="hgradient-instance_method">
#<strong>hgradient</strong>(left, right) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Fill image using a horizontal gradient.</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>left</code>
<dd>
<p>starting color, for leftmost pixels <span class='object_link'><a href="FXColor.html" title="Fox::FXColor (class)">Fox::FXColor</a></span></p>
</dd><dt><code>right</code>
<dd>
<p>ending color, for rightmost pixels <span class='object_link'><a href="FXColor.html" title="Fox::FXColor (class)">Fox::FXColor</a></span></p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
261</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 261</span>
<span class='kw'>def</span> <span class='id identifier rubyid_hgradient'>hgradient</span><span class='lparen'>(</span><span class='id identifier rubyid_left'>left</span><span class='comma'>,</span> <span class='id identifier rubyid_right'>right</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="initialize_without_data_string-instance_method">
#<strong>initialize_without_data_string</strong> ⇒ <tt><span class='object_link'><a href="" title="Fox::FXImage (class)">FXImage</a></span></tt>
</h3><div class="docstring">
<div class="discussion">
<p>Create an image. If a client-side pixel buffer has been specified, the image owns the pixel buffer. If the <code>IMAGE_OWNED</code> flag is set but a <code>nil</code> pixel buffer is passed, a pixel buffer will be automatically created and will be owned by the image. The flags <code>IMAGE_SHMI</code> and <code>IMAGE_SHMP</code> may be specified for large images to instruct <span class='object_link'><a href="#render-instance_method" title="Fox::FXImage#render (method)">#render</a></span> to use shared memory to communicate with the server.</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>a</code>
<dd>
<p>an application instance <span class='object_link'><a href="FXApp.html" title="Fox::FXApp (class)">Fox::FXApp</a></span></p>
</dd><dt><code>pixels</code>
<dd>
<p>pixels [Array of FXColor values or string of raw [RGBA] values]</p>
</dd><dt><code>opts</code>
<dd>
<p>image options [Integer]</p>
</dd><dt><code>width</code>
<dd>
<p>image width [Integer]</p>
</dd><dt><code>height</code>
<dd>
<p>image height [Integer]</p>
</dd></dl>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="" title="Fox::FXImage (class)">FXImage</a></span></tt>)</span>
—
<div class='inline'>
<p>a new instance of FXImage</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
693
694</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/fox16/core.rb', line 693</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span> <span class='id identifier rubyid_pixels'>pixels</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='op'>=</span><span class='int'>0</span><span class='comma'>,</span> <span class='id identifier rubyid_width'>width</span><span class='op'>=</span><span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_height'>height</span><span class='op'>=</span><span class='int'>1</span><span class='rparen'>)</span> <span class='comment'># :yields: theImage
</span><span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="loadPixels-instance_method">
#<strong>loadPixels</strong>(store) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Load pixel data from a stream.</p>
<p>Note that the base class version of <span class='object_link'><a href="#loadPixels-instance_method" title="Fox::FXImage#loadPixels (method)">#loadPixels</a></span> expects to read the the pixel data in a neutral format (i.e. without any image format specific information). For example, if you have a 1024x768 image without an alpha channel (and thus only the red, green and blue channels), <span class='object_link'><a href="#loadPixels-instance_method" title="Fox::FXImage#loadPixels (method)">#loadPixels</a></span> will attempt to read a total of 1024*768*3*8 bytes from the stream. The behavior of <span class='object_link'><a href="#loadPixels-instance_method" title="Fox::FXImage#loadPixels (method)">#loadPixels</a></span> is different for subclasses such as FXPNGImage, where <span class='object_link'><a href="#loadPixels-instance_method" title="Fox::FXImage#loadPixels (method)">#loadPixels</a></span> will instead expects to read the image data in a specific image file format (i.e. the PNG file format).</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>store</code>
<dd>
<p>opened stream from which to read the pixel data <span class='object_link'><a href="FXStream.html" title="Fox::FXStream (class)">Fox::FXStream</a></span></p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
329</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 329</span>
<span class='kw'>def</span> <span class='id identifier rubyid_loadPixels'>loadPixels</span><span class='lparen'>(</span><span class='id identifier rubyid_store'>store</span><span class='rparen'>)</span> <span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="mirror-instance_method">
#<strong>mirror</strong>(horizontal, vertical) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Mirror image horizontally and/or vertically and then re-render the server-side image from the client-side pixel buffer.</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>horizontal</code>
<dd>
<p>if <code>true</code>, the image will be flipped from left to right [Boolean]</p>
</dd><dt><code>vertical</code>
<dd>
<p>if <code>true</code>, the image will be flipped from top to bottom [Boolean]</p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
183</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 183</span>
<span class='kw'>def</span> <span class='id identifier rubyid_mirror'>mirror</span><span class='lparen'>(</span><span class='id identifier rubyid_horizontal'>horizontal</span><span class='comma'>,</span> <span class='id identifier rubyid_vertical'>vertical</span><span class='rparen'>)</span> <span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="pixel_string-instance_method">
#<strong>pixel_string</strong>(offset = nil, size = nil) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Return a String of the raw color representation of all image pixels.</p>
<p>Image pixels are stored bytewise as [RGBA] values.</p>
<p>Optional offset and size can be used to retrieve a part of the image data. Both are counted in bytes.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
105</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 105</span>
<span class='kw'>def</span> <span class='id identifier rubyid_pixel_string'>pixel_string</span><span class='lparen'>(</span><span class='id identifier rubyid_offset'>offset</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_size'>size</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span> <span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="release-instance_method">
#<strong>release</strong> ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Release the client-side pixels buffer, free it if it was owned (i.e. if the <code>IMAGE_OWNED</code> option is set).. If it is not owned, the image just forgets about the buffer.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
152</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 152</span>
<span class='kw'>def</span> <span class='id identifier rubyid_release'>release</span><span class='lparen'>(</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="render-instance_method">
#<strong>render</strong> ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Render the image from client-side pixel buffer, if there is data and if the image width and height are greater than zero.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
145</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 145</span>
<span class='kw'>def</span> <span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="restore-instance_method">
#<strong>restore</strong> ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Restore client-side pixel buffer from image. This operation overwrites any current values for the client-side pixel buffer with values corresponding to the server-side image. If the image data is <code>nil</code> at the time <span class='object_link'><a href="#restore-instance_method" title="Fox::FXImage#restore (method)">#restore</a></span> is called, the image will first allocate an (owned) pixel buffer to use for this operation.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
139</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 139</span>
<span class='kw'>def</span> <span class='id identifier rubyid_restore'>restore</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="rotate-instance_method">
#<strong>rotate</strong>(degrees) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Rotate image counter-clockwise by some number of degrees and then re-render the server-side image from the client-side pixel buffer.</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>degrees</code>
<dd>
<p>number of degrees by which to rotate the image [Integer]</p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
193</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 193</span>
<span class='kw'>def</span> <span class='id identifier rubyid_rotate'>rotate</span><span class='lparen'>(</span><span class='id identifier rubyid_degrees'>degrees</span><span class='rparen'>)</span> <span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="savePixels-instance_method">
#<strong>savePixels</strong>(store) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Save pixel data to a stream.</p>
<p>Note that the base class version of <span class='object_link'><a href="#savePixels-instance_method" title="Fox::FXImage#savePixels (method)">#savePixels</a></span> saves the pixel data as-is, without any image format specific information. For example, if you have a 1024x768 image without an alpha channel (and thus only the red, green and blue channels) the total number of bytes written to the stream will be 1024*768*3*8. The behavior of <span class='object_link'><a href="#savePixels-instance_method" title="Fox::FXImage#savePixels (method)">#savePixels</a></span> is different for subclasses such as FXPNGImage, where <span class='object_link'><a href="#savePixels-instance_method" title="Fox::FXImage#savePixels (method)">#savePixels</a></span> will instead save the image data in a specific image file format (i.e. the PNG file format).</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>store</code>
<dd>
<p>opened stream to which to save the pixel data <span class='object_link'><a href="FXStream.html" title="Fox::FXStream (class)">Fox::FXStream</a></span></p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
310</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 310</span>
<span class='kw'>def</span> <span class='id identifier rubyid_savePixels'>savePixels</span><span class='lparen'>(</span><span class='id identifier rubyid_store'>store</span><span class='rparen'>)</span> <span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="scale-instance_method">
#<strong>scale</strong>(w, h, quality = 0) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Rescale pixels image to the specified width and height and then re-render the server-side image from the client-side pixel buffer. Note that this serves a slightly different purpose than the base class resize() method, which simply resizes the client-side pixel data buffer but doesn’t transform the image.</p>
<p>The optional third argument specifies the <em>quality</em> of the scaling algorithm used. By default, <span class='object_link'><a href="#scale-instance_method" title="Fox::FXImage#scale (method)">#scale</a></span> uses a fast (but low quality) nearest-neighbor algorithm for scaling the image to its new size. To use the higher-quality scaling algorithm from FOX 1.0, you should pass in a value of 1 as the third argument to <span class='object_link'><a href="#scale-instance_method" title="Fox::FXImage#scale (method)">#scale</a></span>.</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>width</code>
<dd>
<p>new image width, in pixels [Integer]</p>
</dd><dt><code>height</code>
<dd>
<p>new image height, in pixels [Integer]</p>
</dd><dt><code>quality</code>
<dd>
<p>scaling algorithm quality, either 0 or 1 (see above) [Integer]</p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
172</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 172</span>
<span class='kw'>def</span> <span class='id identifier rubyid_scale'>scale</span><span class='lparen'>(</span><span class='id identifier rubyid_w'>w</span><span class='comma'>,</span> <span class='id identifier rubyid_h'>h</span><span class='comma'>,</span> <span class='id identifier rubyid_quality'>quality</span><span class='op'>=</span><span class='int'>0</span><span class='rparen'>)</span> <span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="setPixel-instance_method">
#<strong>setPixel</strong>(x, y, clr) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Set pixel at (<em>x</em>, <em>y</em>) to <em>clr</em>.</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>x</code>
<dd>
<p>x-coordinate of the pixel of interest [Integer]</p>
</dd><dt><code>y</code>
<dd>
<p>y-coordinate of the pixel of interest [Integer]</p>
</dd><dt><code>clr</code>
<dd>
<p>new color value for this pixel <span class='object_link'><a href="FXColor.html" title="Fox::FXColor (class)">Fox::FXColor</a></span></p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
126</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 126</span>
<span class='kw'>def</span> <span class='id identifier rubyid_setPixel'>setPixel</span><span class='lparen'>(</span><span class='id identifier rubyid_x'>x</span><span class='comma'>,</span> <span class='id identifier rubyid_y'>y</span><span class='comma'>,</span> <span class='id identifier rubyid_clr'>clr</span><span class='rparen'>)</span> <span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="setPixels-instance_method">
#<strong>setPixels</strong>(pix, *args) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Populate the image with new pixel data of the same size or of a new size</p>
<p>Pixel data is copied and IMAGE_OWNED option is set. If called with <code>width</code> and <code>height</code>, the size of the serverside representation of the image, if it exists, is adjusted but the contents are not updated yet. This can be done by calling render().</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>pixels</code>
<dd>
<p>pixels [Array of FXColor values or string of raw [RGBA] values]</p>
</dd><dt><code>opts</code>
<dd>
<p>image options [Integer]</p>
</dd><dt><code>width</code>
<dd>
<p>image width [Integer]</p>
</dd><dt><code>height</code>
<dd>
<p>image height [Integer]</p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
95
96</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 95</span>
<span class='kw'>def</span> <span class='id identifier rubyid_setPixels'>setPixels</span><span class='lparen'>(</span><span class='id identifier rubyid_pixels'>pixels</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='op'>=</span><span class='int'>0</span><span class='comma'>,</span> <span class='id identifier rubyid_width'>width</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_height'>height</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="setPixels_without_data_string-instance_method">
#<strong>setPixels_without_data_string</strong> ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Populate the image with new pixel data of the same size or of a new size</p>
<p>Pixel data is copied and IMAGE_OWNED option is set. If called with <code>width</code> and <code>height</code>, the size of the serverside representation of the image, if it exists, is adjusted but the contents are not updated yet. This can be done by calling render().</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>pixels</code>
<dd>
<p>pixels [Array of FXColor values or string of raw [RGBA] values]</p>
</dd><dt><code>opts</code>
<dd>
<p>image options [Integer]</p>
</dd><dt><code>width</code>
<dd>
<p>image width [Integer]</p>
</dd><dt><code>height</code>
<dd>
<p>image height [Integer]</p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
699
700</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/fox16/core.rb', line 699</span>
<span class='kw'>def</span> <span class='id identifier rubyid_setPixels'>setPixels</span><span class='lparen'>(</span><span class='id identifier rubyid_pixels'>pixels</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='op'>=</span><span class='int'>0</span><span class='comma'>,</span> <span class='id identifier rubyid_width'>width</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_height'>height</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="vgradient-instance_method">
#<strong>vgradient</strong>(top, bottom) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Fill image using a vertical gradient.</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>top</code>
<dd>
<p>starting color, for topmost pixels <span class='object_link'><a href="FXColor.html" title="Fox::FXColor (class)">Fox::FXColor</a></span></p>
</dd><dt><code>bottom</code>
<dd>
<p>ending color, for bottommost pixels <span class='object_link'><a href="FXColor.html" title="Fox::FXColor (class)">Fox::FXColor</a></span></p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
271</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 271</span>
<span class='kw'>def</span> <span class='id identifier rubyid_vgradient'>vgradient</span><span class='lparen'>(</span><span class='id identifier rubyid_top'>top</span><span class='comma'>,</span> <span class='id identifier rubyid_bottom'>bottom</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="xshear-instance_method">
#<strong>xshear</strong>(shear, color = 0) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Shear image horizontally and then re-render the server-side image from the client-side pixel buffer. The number of pixels is equal to the <em>shear</em> parameter times 256. The area outside the image is filled with transparent black, unless another <em>color</em> is specified.</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>shear</code>
<dd>
<p>how far to shear [Integer]</p>
</dd><dt><code>color</code>
<dd>
<p>fill color for areas outside the sheared image <span class='object_link'><a href="FXColor.html" title="Fox::FXColor (class)">Fox::FXColor</a></span></p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
238</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 238</span>
<span class='kw'>def</span> <span class='id identifier rubyid_xshear'>xshear</span><span class='lparen'>(</span><span class='id identifier rubyid_shear'>shear</span><span class='comma'>,</span> <span class='id identifier rubyid_color'>color</span><span class='op'>=</span><span class='int'>0</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="yshear-instance_method">
#<strong>yshear</strong>(shear, color = 0) ⇒ <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Shear image verticallyand then re-render the server-side image from the client-side pixel buffer. The number of pixels is equal to the <em>shear</em> parameter times 256. The area outside the image is filled with transparent black, unless another <em>color</em> is specified.</p>
<h4 id="label-Parameters-3A">Parameters:</h4>
<dl class="rdoc-list note-list"><dt><code>shear</code>
<dd>
<p>how far to shear [Integer]</p>
</dd><dt><code>color</code>
<dd>
<p>fill color for areas outside the sheared image <span class='object_link'><a href="FXColor.html" title="Fox::FXColor (class)">Fox::FXColor</a></span></p>
</dd></dl>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
251</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'rdoc-sources/FXImage.rb', line 251</span>
<span class='kw'>def</span> <span class='id identifier rubyid_yshear'>yshear</span><span class='lparen'>(</span><span class='id identifier rubyid_shear'>shear</span><span class='comma'>,</span> <span class='id identifier rubyid_color'>color</span><span class='op'>=</span><span class='int'>0</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Mon Jan 2 11:47:25 2023 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.28 (ruby-3.1.2).
</div>
</div>
</body>
</html>