| 1 | |
| 2 | |
| 3 | <refentry id="imagesetpixel"> |
| 4 | <indexterm id="IndexImagesetpixel"><primary>imagegetpixel</primary></indexterm> |
| 5 | <refentryinfo><title>Image Processing Opcodes</title></refentryinfo> |
| 6 | <refmeta> |
| 7 | <refentrytitle>imagesetpixel</refentrytitle> |
| 8 | </refmeta> |
| 9 | <refnamediv> |
| 10 | <refname>imagesetpixel</refname> |
| 11 | <refpurpose> |
| 12 | Set the RGB value of a pixel inside a previously opened or created image. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para>Plugin opcode in image. This opcode is part of the plugin repository and has to be installed separately. |
| 19 | The plugin repository can be found here: <ulink url="https://github.com/csound/plugins"><citetitle>https://github.com/csound/plugins</citetitle></ulink></para> |
| 20 | <para>Set the RGB value of a pixel inside a previously opened or created image. An image can be loaded with <link linkend="imageload"><citetitle>imageload</citetitle></link>. An empty image can be created with <link linkend="imagecreate"><citetitle>imagecreate</citetitle></link> and saved with <link linkend="imagesave"><citetitle>imagesave</citetitle></link>. |
| 21 | </para> |
| 22 | </refsect1> |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis><command>imagesetpixel</command> iimagenum, ax, ay, ared, agreen, ablue</synopsis> |
| 26 | <synopsis><command>imagesetpixel</command> iimagenum, kx, ky, kred, kgreen, kblue</synopsis> |
| 27 | </refsect1> |
| 28 | |
| 29 | <refsect1> |
| 30 | <title>Initialization</title> |
| 31 | <para> |
| 32 | <emphasis>iimagenum</emphasis> -- the reference of the image.. It should be a value returned by <link linkend="imageload"><citetitle>imageload</citetitle></link> or <link linkend="imagecreate"><citetitle>imagecreate</citetitle></link>. |
| 33 | </para> |
| 34 | </refsect1> |
| 35 | |
| 36 | <refsect1> |
| 37 | <title>Performance</title> |
| 38 | <para> |
| 39 | <emphasis>ax (kx)</emphasis> -- horizontal pixel position (must be a float from 0 to 1). |
| 40 | </para> |
| 41 | <para> |
| 42 | <emphasis>ay (ky)</emphasis> -- vertical pixel position (must be a float from 0 to 1). |
| 43 | </para> |
| 44 | <para> |
| 45 | <emphasis>ared (kred)</emphasis> -- red value of the pixel (mapped to a float from 0 to 1). |
| 46 | </para> |
| 47 | <para> |
| 48 | <emphasis>agreen (kgreen)</emphasis> -- green value of the pixel (mapped to a float from 0 to 1). |
| 49 | </para> |
| 50 | <para> |
| 51 | <emphasis>ablue (kblue)</emphasis> -- blue value of the pixel (mapped to a float from 0 to 1). |
| 52 | </para> |
| 53 | </refsect1> |
| 54 | |
| 55 | <refsect1> |
| 56 | <title>Examples</title> |
| 57 | <para> |
| 58 | Here is an example of the imagesetpixel opcode. It uses the file <ulink url="examples/imagesetpixel.csd"><citetitle>imagesetpixel.csd</citetitle></ulink> and <ulink url="examples/imageOpcode02.png"><citetitle>imageOpcode02.png</citetitle></ulink>. |
| 59 | <example> |
| 60 | <title>Example of the imagesetpixel opcode.</title> |
| 61 | <xi:include href="examples-xml/imagesetpixel.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 62 | </example> |
| 63 | <para> |
| 64 | This is what the image <citetitle>imageOpcode02.png</citetitle> looks like: |
| 65 | </para> |
| 66 | <imageobject> |
| 67 | <imagedata fileref="images/imageOpcode02small.png" format="PNG"/> |
| 68 | </imageobject> |
| 69 | <para> |
| 70 | and these are the new images <citetitle>imageNEW1.png</citetitle>, <citetitle>imageNEW2.png</citetitle> and <citetitle>imageNEW3.png</citetitle>: |
| 71 | </para> |
| 72 | <imageobject> |
| 73 | <imagedata fileref="images/imageNEW1small.png" format="PNG"/> |
| 74 | </imageobject> |
| 75 | <imageobject> |
| 76 | <imagedata fileref="images/imageNEW2small.png" format="PNG"/> |
| 77 | </imageobject> |
| 78 | <imageobject> |
| 79 | <imagedata fileref="images/imageNEW3small.png" format="PNG"/> |
| 80 | </imageobject> |
| 81 | </para> |
| 82 | </refsect1> |
| 83 | |
| 84 | <refsect1> |
| 85 | <title>See also</title> |
| 86 | <para><link linkend="ImageopcodesTop"><citetitle>Image processing opcodes</citetitle></link></para> |
| 87 | </refsect1> |
| 88 | |
| 89 | <refsect1> |
| 90 | <title>Credits</title> |
| 91 | <para> |
| 92 | <simplelist> |
| 93 | <member>Author: Cesare Marilungo</member> |
| 94 | </simplelist> |
| 95 | </para> |
| 96 | |
| 97 | <para>New in version 5.08</para> |
| 98 | </refsect1> |
| 99 | </refentry> |