]> git.vanrenterghem.biz Git - www.vanrenterghem.biz.git/blob - Linux/website_quarter_circle_ll.pl.shtml
The Matrix instead of Friendica.
[www.vanrenterghem.biz.git] / Linux / website_quarter_circle_ll.pl.shtml
1 <html>
2 <head>
3 <title>vanrenterghem.biz - website_quarter_circle_ll.pl.html</title>
4 <meta name="Generator" content="Vim/6.1">
5 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-15">
6 <meta name="author" content="Frederik Vanrenterghem">
7 <META NAME="Description" CONTENT="Personal homepage - Gimp perl script">
8 </head>
9 <!--#include virtual="/header.shtml" -->
10 <body bgcolor="#ffffff" text="#000000">
12 <h1>website_quarter_circle_ll.pl</h1>
13 <p>
14 <b>Purpose:</b> This script was written to create the lowerleft quarter circle of the main navigation bar on the site. It should be no surprise I wrote 3 more scripts generate the 3 other circle parts. I chose scripting these pictures over drawing them manually out of consciousness of my own lack of drawing skills.<br>
15 </p>
16 <p>
18 <b>Requirements:</b> <a href="http://www.gimp.org">The GNU Image Manipulation Program, aka the GIMP</a> and <a href="http://www.perl.org">Perl</A>
19 </p>
20 <P>
21 <b>Output:</b> <img src="/Pics/BBlowerleft.png" border="0" hspace="0" vspace="0" alt="Sample output image of the script" width="15" height="16">
22 </P>
23 <p>
24 <table border="1" cellpadding="6" bgcolor="#ffeeee" width=100%><tr><td>
25 <pre>
26 <font color="#a020f0">#!/usr/bin/perl -w</font>
28 <font color="#a52a2a"><b>use </b></font>Gimp <font color="#ff00ff">qw(</font><font color="#ff00ff"> :auto </font><font color="#ff00ff">)</font>;
29 <font color="#a52a2a"><b>use </b></font>Gimp::Fu;
31 <font color="#0000ff">#Gimp::set_trace(TRACE_CALL);</font>
33 <font color="#a52a2a"><b>sub</b></font><font color="#008b8b"> </font><font color="#008b8b">website_quarter_circle_ll</font><font color="#008b8b"> </font>{
34         <font color="#a52a2a"><b>my</b></font> <font color="#008b8b">$width</font>=<font color="#ff00ff">8</font>;
35         <font color="#a52a2a"><b>my</b></font> <font color="#008b8b">$height</font>=<font color="#008b8b">$width</font>;
36         <font color="#a52a2a"><b>my</b></font> (<font color="#008b8b">$image</font>,<font color="#008b8b">$layer</font>);
37         <font color="#a52a2a"><b>my</b></font> <font color="#008b8b">$circle_color</font> = [<font color="#ff00ff">187</font>,<font color="#ff00ff">221</font>,<font color="#ff00ff">255</font>];
38         <font color="#a52a2a"><b>my</b></font> <font color="#008b8b">$webpage_color</font> = [<font color="#ff00ff">255</font>,<font color="#ff00ff">255</font>,<font color="#ff00ff">255</font>];
40         gimp_palette_set_background(<font color="#008b8b">$circle_color</font>);
42         <font color="#008b8b">$image</font> = gimp_image_new(<font color="#008b8b">$width</font>, <font color="#008b8b">$height</font>, RGB);
43         <font color="#008b8b">$layer</font> = gimp_layer_new(<font color="#008b8b">$image</font>, <font color="#008b8b">$width</font>, <font color="#008b8b">$height</font>, RGBA_IMAGE, <font color="#ff00ff">&quot;</font><font color="#ff00ff">Button</font><font color="#ff00ff">&quot;</font>, <font color="#ff00ff">100</font>, NORMAL_MODE);
45         gimp_image_add_layer(<font color="#008b8b">$image</font>, <font color="#008b8b">$layer</font>, <font color="#ff00ff">0</font>);
46     gimp_edit_clear(<font color="#008b8b">$layer</font>);
49     gimp_ellipse_select(<font color="#008b8b">$image</font>,<font color="#ff00ff">-0</font>*<font color="#008b8b">$height</font>, <font color="#ff00ff">-1</font>*<font color="#008b8b">$width</font>, <font color="#008b8b">$width</font>*<font color="#ff00ff">2</font>, <font color="#008b8b">$height</font>*<font color="#ff00ff">2</font>, <font color="#ff00ff">0</font>, <font color="#ff00ff">1</font>, <font color="#ff00ff">0</font>, <font color="#ff00ff">0.5</font>);
52     gimp_bucket_fill(<font color="#008b8b">$layer</font>, BG_BUCKET_FILL, NORMAL_MODE, <font color="#ff00ff">100</font>, <font color="#ff00ff">0</font>, <font color="#ff00ff">0</font>, <font color="#ff00ff">5</font>, <font color="#ff00ff">5</font>);
54         gimp_selection_invert(<font color="#008b8b">$image</font>);
55         gimp_palette_set_background(<font color="#008b8b">$webpage_color</font>);
56         gimp_bucket_fill(<font color="#008b8b">$layer</font>, BG_BUCKET_FILL, NORMAL_MODE, <font color="#ff00ff">100</font>, <font color="#ff00ff">0</font>, <font color="#ff00ff">0</font>, <font color="#ff00ff">5</font>, <font color="#ff00ff">5</font>);
57         gimp_selection_none(<font color="#008b8b">$image</font>);
59         gimp_convert_indexed(<font color="#008b8b">$image</font>, <font color="#ff00ff">0</font>, <font color="#ff00ff">0</font>, <font color="#ff00ff">8</font>,<font color="#ff00ff">0</font>,<font color="#ff00ff">0</font>, <font color="#ff00ff">&quot;&quot;</font>);
60                 <font color="#a52a2a"><b>return</b></font> <font color="#008b8b">$image</font>;
61     }
63 register
64       <font color="#ff00ff">&quot;</font><font color="#ff00ff">website_quarter_circle_ll</font><font color="#ff00ff">&quot;</font>,                 <font color="#0000ff"># fill in name </font>
65       <font color="#ff00ff">&quot;</font><font color="#ff00ff">Create Website Toolbar lowerleft corner button</font><font color="#ff00ff">&quot;</font>,  <font color="#0000ff"># a small description </font>
66       <font color="#ff00ff">&quot;</font><font color="#ff00ff">A script to create a quarter circle in Gimp</font><font color="#ff00ff">&quot;</font>,       <font color="#0000ff"># a help text </font>
67       <font color="#ff00ff">&quot;</font><font color="#ff00ff">Frederik Vanrenterghem</font><font color="#ff00ff">&quot;</font>,            <font color="#0000ff"># Your name </font>
68       <font color="#ff00ff">&quot;&quot;</font>,        <font color="#0000ff"># Your copyright </font>
69       <font color="#ff00ff">&quot;</font><font color="#ff00ff">2002-10-21</font><font color="#ff00ff">&quot;</font>,              <font color="#0000ff"># Date </font>
70       <font color="#ff00ff">&quot;</font><font color="#ff00ff">&lt;Toolbox&gt;/Xtns/Perl-Fu/Website/CreateQuarterCircleLL</font><font color="#ff00ff">&quot;</font>,   <font color="#0000ff"># menu path </font>
71       <font color="#ff00ff">&quot;</font><font color="#ff00ff">*</font><font color="#ff00ff">&quot;</font>,                       <font color="#0000ff"># Image types </font>
72       [
74       ],
75       <font color="#008b8b">\&amp;website_quarter_circle_ll</font>;
77 <font color="#a52a2a"><b>exit</b></font> main()
78 </pre>
80        </td></tr></table>
81 </P>
82 <!--#include virtual="/footer.shtml" -->
83 </body>
84 </html>