<?xml version="1.0" encoding="UTF-8" standalone="yes"?><oembed><version><![CDATA[1.0]]></version><provider_name><![CDATA[The Osmosian Order of Plain English Programmers Welcomes You]]></provider_name><provider_url><![CDATA[http://osmosianplainenglishprogramming.blog]]></provider_url><author_name><![CDATA[gerryrzeppa]]></author_name><author_url><![CDATA[https://osmosianplainenglishprogramming.blog/author/gerryrzeppa/]]></author_url><title><![CDATA[Painting Like Monet]]></title><type><![CDATA[link]]></type><html><![CDATA[<header class="entry-header">
<h1 class="entry-title"></h1>
</header>
<div class="entry-content">
<p>Claude Monet (1840-1926) was a French impressionist painter known for the “dab, dab, dab” style of his paintings. I can imagine him at work, peering at a spot on his subject, mixing an appropriate color of paint, then dabbing the corresponding spot on his canvas.</p>
<p>Let’s take a look at a Plain English program that does essentially the same thing as ol’ Monsieur Monet. We begin with some type definitions:</p>
<p><span style="color:#00ccff;">A subject is a string.</span><br />
<span style="color:#00ccff;"> A model is a picture.</span><br />
<span style="color:#00ccff;"> A painting is a picture.</span><br />
<span style="color:#00ccff;"> A frame is a box.</span></p>
<p>And that leads us to the general outline of the program as a whole:</p>
<p><span style="color:#00ccff;">To run:</span><br />
<span style="color:#00ccff;"> Start up.</span><br />
<span style="color:#00ccff;"> Put &#8220;Purple Grapes&#8221; into a subject.</span><br />
<span style="color:#00ccff;"> Find a model of the subject on Google.</span><br />
<span style="color:#00ccff;"> Paint a painting using the model.</span><br />
<span style="color:#00ccff;"> Reveal the painting with the subject as the title.</span><br />
<span style="color:#00ccff;"> Wait for the escape key.</span><br />
<span style="color:#00ccff;"> Shut down.</span></p>
<p>The critical routine is the one that does the actual painting. This is it:</p>
<p><span style="color:#00ccff;">To paint a painting using a model:</span><br />
<span style="color:#00ccff;"> Resize the model to 4 inches by 4 inches.</span><br />
<span style="color:#00ccff;"> Center the model in the screen&#8217;s box.</span><br />
<span style="color:#00ccff;"> Move the model left 3 inches.</span><br />
<span style="color:#00ccff;"> Draw the canvas.</span><br />
<span style="color:#00ccff;"> Draw the model.</span><br />
<span style="color:#00ccff;"> Loop.</span><br />
<span style="color:#00ccff;"> Pick a spot anywhere near the model&#8217;s box.</span><br />
<span style="color:#00ccff;"> Mix a color given the spot.</span><br />
<span style="color:#00ccff;"> Move the spot right 6 inches.</span><br />
<span style="color:#00ccff;"> Dab the color on the spot.</span><br />
<span style="color:#00ccff;"> If a counter is past 30000, break.</span><br />
<span style="color:#00ccff;"> Repeat.</span><br />
<span style="color:#00ccff;"> Make a frame 4 inches by 4 inches.</span><br />
<span style="color:#00ccff;"> Center the frame in the screen&#8217;s box.</span><br />
<span style="color:#00ccff;"> Move the frame right 3 inches.</span><br />
<span style="color:#00ccff;"> Outdent the frame 1/4 inch.</span><br />
<span style="color:#00ccff;"> Draw the frame with the black color and the clear color.</span><br />
<span style="color:#00ccff;"> Refresh the screen.</span><br />
<span style="color:#00ccff;"> Extract the painting given the frame.</span></p>
<p>It begins by setting up the model a little left of center on the screen. Then it loops around, painting. Like Monsieur Monet, it picks spot on (or near) the model, mixes up an appropriate color, and dabs it on the corresponding spot on the canvas on right side of the screen.</p>
<p>This is the routine that does the actual dabbing:</p>
<p><span style="color:#00ccff;">To dab a color on a spot:</span><br />
<span style="color:#00ccff;"> Pick an ellipse&#8217;s left-top within 3/32 inch of the spot.</span><br />
<span style="color:#00ccff;"> Pick the ellipse&#8217;s right-bottom within 3/32 inch of the spot.</span><br />
<span style="color:#00ccff;"> Draw the ellipse with the color and the color.</span></p>
<p>This is a screenshot of our<em> Purple Grapes</em> model (left) and painting (right) after about 2,000 such dabs:</p>
<p><img loading="lazy" class="alignnone size-large wp-image-324493" src="https://cdncontribute.geeksforgeeks.org/wp-content/uploads/purple-grapes-in-progress-1-1024x819.jpg" alt="" width="665" height="532" /></p>
<p>Colors are matched exactly, unless they are very very light, in which case a color that will better match the background canvas is chosen. This is the routine that does the mixing:</p>
<p><span style="color:#00ccff;">To mix a color given a spot:</span><br />
<span style="color:#00ccff;"> Get the color given the spot.</span><br />
<span style="color:#00ccff;"> If the color is not very very light, exit.</span><br />
<span style="color:#00ccff;"> Pick the color between the lightest gray color and the white color.</span></p>
<p>And here is a screenshot of the finished work, after 30,000 dabs, with a frame and a title:</p>
<p><img loading="lazy" class="alignnone size-large wp-image-324471" src="https://cdncontribute.geeksforgeeks.org/wp-content/uploads/purple-grapes-1024x819.jpg" alt="" width="665" height="532" /></p>
<p>Since we fetch our models from Google, the program is capable of painting almost any imaginable subject. (We don’t have to worry about usage issues, by the way, because this kind of <em>transformative </em>art falls under the “Fair Use” section of the Copyright Act of 1976, 17 U.S.C. § 107.) Here, for example, is a painting of a forest path:</p>
<p><img loading="lazy" class="alignnone size-large wp-image-324470" src="https://cdncontribute.geeksforgeeks.org/wp-content/uploads/forest-path-1024x819.jpg" alt="" width="665" height="532" /></p>
<p>And here is a painting of one of a geek’s most indispensable accessories:</p>
<p><img loading="lazy" class="alignnone size-large wp-image-324494" src="https://cdncontribute.geeksforgeeks.org/wp-content/uploads/pocket-protector-1-1024x819.jpg" alt="" width="665" height="532" /></p>
<p>Dab, dab, dab.</p>
</div>
]]></html><thumbnail_url><![CDATA[https://i2.wp.com/cdncontribute.geeksforgeeks.org/wp-content/uploads/purple-grapes-in-progress-1-1024x819.jpg?fit=440%2C330&ssl=1]]></thumbnail_url><thumbnail_width><![CDATA[413]]></thumbnail_width><thumbnail_height><![CDATA[330]]></thumbnail_height></oembed>