<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pentalis&#039; blog on Krita development</title>
	<atom:link href="http://pentalis.org/kritablog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://pentalis.org/kritablog</link>
	<description>Diagrams, news, explanations, opinion, and more (or less)</description>
	<lastBuildDate>Tue, 07 Jun 2011 13:19:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>New Preset Selector Strip for Krita</title>
		<link>http://pentalis.org/kritablog/?p=251</link>
		<comments>http://pentalis.org/kritablog/?p=251#comments</comments>
		<pubDate>Tue, 07 Jun 2011 13:19:44 +0000</pubDate>
		<dc:creator>Pentalis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://pentalis.org/kritablog/?p=251</guid>
		<description><![CDATA[I present you the new time-saving widget for Krita, in the form of a strip embedded in our brush configuration popup!, ready to load your preset specs and reconfigure them with ease, as well as creating new ones.]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been more than a year since I joined the Krita project (and Calligra and KDE as a consequence) as part of Google&#8217;s Summer of Code. There is so much to tell!, But I won&#8217;t bore you with that for now  =)  .</p>
<p>Krita, a painting application, offers a collection of brush engines; each of those can be configured to create your own personalized brushes. To do that you simply have to select a brush engine in the Brush Configuration Popup (visible in the screenshots), and set parameters at your leisure. Each fixed set of parameters is what we call a preset, which are known as brushes in other painting software.</p>
<p>Now&#8230;</p>
<p>&#8230;I present you the new time-saving widget for Krita, in the form of a strip embedded in our brush configuration popup!, ready to load your preset specs.</p>
<p>Look, old popup, without strip:<br />
<a href="http://pentalis.org/kritablog/wp-content/uploads/2011/06/Popup_without_strip.png"><img class="aligncenter size-large wp-image-252" title="Popup_without_strip" src="http://pentalis.org/kritablog/wp-content/uploads/2011/06/Popup_without_strip-1023x454.png" alt="" width="450" height="199" /></a></p>
<p>Now, behold, the same popup, with strip:<br />
<a href="http://pentalis.org/kritablog/wp-content/uploads/2011/06/Popup_with_strip.png"><img class="aligncenter size-large wp-image-253" title="Popup_with_strip" src="http://pentalis.org/kritablog/wp-content/uploads/2011/06/Popup_with_strip-1024x506.png" alt="" width="450" height="222" /></a></p>
<p>Why is this strip exciting or even worth blogging about?, Ho!, For people who use Krita often, the problem of needing too many clicks to modify a set of presets may be all too familiar.</p>
<p>With the old popup, you had to click outside to close it, select your preset in the docker*, open the popup again, and configure your preset inside, that&#8217;s 2 extra clicks overhead (to close and open the config popup) and a lot of mouse movement, for every preset: now imagine if you have to personalize a pack with over 30 of those&#8230; this new strip saves the artist all that extra mouse work, and looks good while doing it.</p>
<p><small>* We have a docker (the preset chooser docker) that presents the user with his presets and lets him select and erase some, but to access that docker, the brush config popup must be closed (it&#8217;s still a popup even though it&#8217;s huge).</small></p>
<p>See that little red icon at the lower corner of the selected preset?, It&#8217;s the delete button; when you click on a preset icon, the delete button will appear, it allows you to delete that preset immediately with a single click. Everything is placed close together such as to save the artist as much time as possible.</p>
<p>For all artists looking for an end-to-end painting application, try Krita!, Our upcoming version is looking very good. For distributions without a prepackaged version, you can take a look at <a href="http://forum.kde.org/viewtopic.php?f=139&amp;t=92880">Bugsbane&#8217;s install script</a>!.</p>
]]></content:encoded>
			<wfw:commentRss>http://pentalis.org/kritablog/?feed=rss2&amp;p=251</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Krita phong filter GUI linked, thoughts on Impasto Effect</title>
		<link>http://pentalis.org/kritablog/?p=239</link>
		<comments>http://pentalis.org/kritablog/?p=239#comments</comments>
		<pubDate>Mon, 16 Aug 2010 19:30:35 +0000</pubDate>
		<dc:creator>Pentalis</dc:creator>
				<category><![CDATA[GSoC]]></category>
		<category><![CDATA[Impasto]]></category>

		<guid isPermaLink="false">http://pentalis.org/kritablog/?p=239</guid>
		<description><![CDATA[Hello everybody, this is my last blog post as part of the Google Summer of Code 2010, and I&#8217;m here to tell you as briefly  as possible, what happened to getting the Impasto effect in Krita.
Short story: didn&#8217;t happen.
Long story:
Turns out that creating new height-enabled color spaces for Krita wasn&#8217;t as easy as I [...]]]></description>
			<content:encoded><![CDATA[<p>Hello everybody, this is my last blog post as part of the Google Summer of Code 2010, and I&#8217;m here to tell you as briefly  as possible, what happened to getting the Impasto effect in Krita.</p>
<p>Short story: didn&#8217;t happen.</p>
<p>Long story:</p>
<p>Turns out that creating new height-enabled color spaces for Krita wasn&#8217;t as easy as I thought. It began as an horribly mysterious thing that took me really long to grasp from end to end; not the concept of color spaces themselves (that&#8217;s crystal clear in my head), but the code that implements them in Krita.</p>
<p>Color spaces are plugins to color engines which are plugins too. Everything here is heavily optimized for speed and full of templates everywhere. So, there&#8217;s no way to create a single height-enabled colorspace for testing, because every tool is made to interact with each other. Either one makes a complete set of fully working height-enabled colorspaces, or nothing. Certainly creating such beautiful thing would take more than one week, possibly more than one month, so I didn&#8217;t do that.</p>
<p>But then arose the emergency plan!.</p>
<p>It consisted of adding, to a normal image, a hidden greyscale layer working as an heightmap, and a hidden phongbumpmap filter layer doing the magic on top. That was much simpler to do and I was about to make it happen. Until I decided it was going to be a rushed effort, that it was going to generate code MADE to be replaced, and that it wasn&#8217;t an easy hack anyway. I often make simple hacks to test things, or to upload working copies while I polish them further. But this approach had several shortcomings. For example it required painting operations to write to 2 devices at the same time.</p>
<p>So, I created a paintop that wrote to 2 layers at the same time to test this feature. It wrote to the normal layer and a secondary layer. It achieved the desired effect but it broke undo, pressing ctrl + Z only undid the painting in 1 layer.</p>
<p>And then came the problem of compositing the bumpmap to the image. What&#8217;s the most correct way to composite the bumpmap to the image to achieve a good impasto effect?, and what kind of heightfield should brush engines generate to make it look GOOD?.</p>
<p>Certainly all this testing gave me more questions than answers. And thorough my life I&#8217;ve learned that rushing toward a goal without a clear vision is nothing wise to do. At worst I&#8217;d get nothing done, at best a patched-together design. So I decided to accept that the impasto effect wasn&#8217;t going to be done within the timeframe of this GSoC and will instead design it with time, patience and calm.</p>
<p>Then I switched my focus to completely link the GUI of my filter just to call it &#8220;beta complete&#8221; right before the hard pencils down deadline!.</p>
<p>I made an ugly heightmap such that if it looks pretty I can blame it all on the filter. Here, enjoy the images and goodbye!.</p>

<a href='http://pentalis.org/kritablog/?attachment_id=241' title='Heightmap'><img width="150" height="150" src="http://pentalis.org/kritablog/wp-content/uploads/2010/08/Phong-Bumpmap-LINKED-_-0-150x150.png" class="attachment-thumbnail" alt="" title="Heightmap" /></a>
<a href='http://pentalis.org/kritablog/?attachment_id=242' title='Phong Bumpmap LINKED _ 1'><img width="150" height="150" src="http://pentalis.org/kritablog/wp-content/uploads/2010/08/Phong-Bumpmap-LINKED-_-1-150x150.png" class="attachment-thumbnail" alt="" title="Phong Bumpmap LINKED _ 1" /></a>
<a href='http://pentalis.org/kritablog/?attachment_id=243' title='Phong Bumpmap LINKED _ 2'><img width="150" height="150" src="http://pentalis.org/kritablog/wp-content/uploads/2010/08/Phong-Bumpmap-LINKED-_-2-150x150.png" class="attachment-thumbnail" alt="" title="Phong Bumpmap LINKED _ 2" /></a>
<a href='http://pentalis.org/kritablog/?attachment_id=244' title='Phong Bumpmap LINKED _ 3'><img width="150" height="150" src="http://pentalis.org/kritablog/wp-content/uploads/2010/08/Phong-Bumpmap-LINKED-_-3-150x150.png" class="attachment-thumbnail" alt="" title="Phong Bumpmap LINKED _ 3" /></a>
<a href='http://pentalis.org/kritablog/?attachment_id=245' title='Phong Bumpmap LINKED _ 4'><img width="150" height="150" src="http://pentalis.org/kritablog/wp-content/uploads/2010/08/Phong-Bumpmap-LINKED-_-4-150x150.png" class="attachment-thumbnail" alt="" title="Phong Bumpmap LINKED _ 4" /></a>

]]></content:encoded>
			<wfw:commentRss>http://pentalis.org/kritablog/?feed=rss2&amp;p=239</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Phong bumpmaps, and using the deform brush to make molten gold</title>
		<link>http://pentalis.org/kritablog/?p=225</link>
		<comments>http://pentalis.org/kritablog/?p=225#comments</comments>
		<pubDate>Sun, 08 Aug 2010 20:17:50 +0000</pubDate>
		<dc:creator>Pentalis</dc:creator>
				<category><![CDATA[GSoC]]></category>
		<category><![CDATA[Impasto]]></category>

		<guid isPermaLink="false">http://pentalis.org/kritablog/?p=225</guid>
		<description><![CDATA[There&#8217;s so much I&#8217;d like to say, but I don&#8217;t want to type another wall of text to present a new feature coming together. So!, I will let the first image speak for itself.

Here, molten gold, gold paste, you name it. My old and painfully slow python script has grown into a fast filter that [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s so much I&#8217;d like to say, but I don&#8217;t want to type another wall of text to present a new feature coming together. So!, I will let the first image speak for itself.</p>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/08/gold-paste.png"><img src="http://pentalis.org/kritablog/wp-content/uploads/2010/08/gold-paste.png" alt="Gold paste" title="Gold paste" width="400" height="400" class="aligncenter size-full wp-image-226" /></a></p>
<p>Here, molten gold, gold paste, you name it. My old and painfully slow python script has grown into a fast filter that applies the Phong Illumination Model on any single channel used as heightmap. It updates fast, enough to work in real time, so it&#8217;s almost ready to give people a taste of impasto!. Look at this!:</p>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/08/Like-mixing-paint-2.png"><img src="http://pentalis.org/kritablog/wp-content/uploads/2010/08/Like-mixing-paint-2-1024x640.png" alt="" title="Like mixing paint 2" width="450" height="281" class="aligncenter size-large wp-image-228" /></a></p>
<p>And look on what it becomes!</p>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/08/Like-mixing-paint.png"><img src="http://pentalis.org/kritablog/wp-content/uploads/2010/08/Like-mixing-paint-1024x640.png" alt="" title="Like mixing paint" width="450" height="281" class="aligncenter size-large wp-image-229" /></a></p>
<p>For you observant people, those are 2 filter layers there, right?. One of them is Gaussian Blur. Gaussian Blur mixed with Phong Bumpmap really creates the feeling of paste mixing. But the Gaussian Blur filter is too slow to see this effect in real time, so you&#8217;re not missing much in those screenshots.</p>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/08/Phong-Bumpmap-GUI.png"><img src="http://pentalis.org/kritablog/wp-content/uploads/2010/08/Phong-Bumpmap-GUI-300x163.png" alt="" title="Phong Bumpmap GUI" width="300" height="163" class="aligncenter size-medium wp-image-232" /></a><br />
<a href="http://pentalis.org/kritablog/wp-content/uploads/2010/08/Phong-Bumpmap-GUI-2.png"><img src="http://pentalis.org/kritablog/wp-content/uploads/2010/08/Phong-Bumpmap-GUI-2-300x161.png" alt="" title="Phong Bumpmap GUI 2" width="300" height="161" class="aligncenter size-medium wp-image-233" /></a><br />
This is the configuration interface. I tried to do the most with the widgets I had at hand. If I went overboad trying to design a cool GUI, for example making a new widget, then I&#8217;d have run out of time.</p>
<p>Many of you may be wondering what this funky bumpmap filter has to do with Impasto. Well, you don&#8217;t need all the features of this filter to give the feeling of paint volume, it&#8217;s enough with just one white light source, but I thought many would appreciate the ability to make very interesting surfaces with just this filter and the many brushes that Krita provides. I think it can even work as a basis for textures to be used in 3D.</p>
<p>The pencils down date is approaching, and now all my effort will be focused on two fronts to get a working pre-beta Impasto out there:<br />
1.- Finally complete at least one height-enabled colorspace.<br />
2.- Give brush engines the ability to write to the height-channel in addition to the normal channels, or at least create a sample brush engine that does so!.</p>
<p>I hope you liked the screenshots.<br />
I could tell you stories about how I took 2 hours to fix a stupid bug that consisted of a missing comma, or how I broke my Fedora with a custom kernel package but I&#8217;ll spare you the details of those frustrating things  <img src='http://pentalis.org/kritablog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://pentalis.org/kritablog/?feed=rss2&amp;p=225</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Under the hood, impasto in Krita</title>
		<link>http://pentalis.org/kritablog/?p=222</link>
		<comments>http://pentalis.org/kritablog/?p=222#comments</comments>
		<pubDate>Mon, 26 Jul 2010 11:56:16 +0000</pubDate>
		<dc:creator>Pentalis</dc:creator>
				<category><![CDATA[GSoC]]></category>
		<category><![CDATA[Impasto]]></category>

		<guid isPermaLink="false">http://pentalis.org/kritablog/?p=222</guid>
		<description><![CDATA[A quick update on the progress of implementing impasto in Krita: this week all was under the hood progress so far. I had to understand more about Krita&#8217;s inner workings than ever before. Colorspaces and filters are plugins and I need to implement both to get a prototype impasto system in Krita. Apparently simple, but [...]]]></description>
			<content:encoded><![CDATA[<p>A quick update on the progress of implementing impasto in Krita: this week all was under the hood progress so far. I had to understand more about Krita&#8217;s inner workings than ever before. Colorspaces and filters are plugins and I need to implement both to get a prototype impasto system in Krita. Apparently simple, but not so simple.</p>
<p>Being a self taught coder (like many out there), I had to actually learn and grasp for the first time what a template really is and how to read templates calling templates calling templates, as well as actually getting to understand and grasp how polymorphism works.</p>
<p>The other hard step is understanding the way Krita works internally. I learned about unit tests, singletons (I&#8217;ve used them before but I didn&#8217;t know they had a name and a specific purpose in programs), the colorspace registry, CMake building (specifically how to link libraries), filter building (not complex, it&#8217;s simpler than <del datetime="2010-07-26T11:46:29+00:00">paintops</del> brush engines in my opinion), and many other things.</p>
<p>Overall a week full of learning.</p>
<p>This new week (26-31) I&#8217;m going to put those things to work. Stay tuned!.</p>
]]></content:encoded>
			<wfw:commentRss>http://pentalis.org/kritablog/?feed=rss2&amp;p=222</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Impasto!, Bumpmapping prototype in Python</title>
		<link>http://pentalis.org/kritablog/?p=157</link>
		<comments>http://pentalis.org/kritablog/?p=157#comments</comments>
		<pubDate>Sat, 17 Jul 2010 10:50:37 +0000</pubDate>
		<dc:creator>Pentalis</dc:creator>
				<category><![CDATA[GSoC]]></category>
		<category><![CDATA[Hatching brush]]></category>
		<category><![CDATA[Impasto]]></category>

		<guid isPermaLink="false">http://pentalis.org/kritablog/?p=157</guid>
		<description><![CDATA[Halftone Brush Beta!
Bumpmapping Script in Action!
Krita is getting little spiffy additions in this year's GSoC...]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been about a month since my last blog entry, so let me remind you what I&#8217;m doing as part of my Google&#8217;s Summer of Code (which down here is Autumn/Winter!):</p>
<ol>
<li>A hatching and halftones brush for Krita.</li>
<li>Implementing impasto in Krita.</li>
</ol>
<p>Part 1 is virtually complete, there&#8217;s no halftones brush yet, but it&#8217;s trivial to create one from the hatching brush which is now <strong>beta!</strong>. That&#8217;s right!, all GUI is linked and you can start toying with it and have fun, change the settings to anything you like without touching the source code!  =D  here&#8217;s a little picture reminding you of what it looked like:</p>
<h2 style="text-align: center;">Halftone Brush Beta!</h2>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/06/Zoomed_single_hatching.png"><img class="aligncenter size-medium wp-image-149" title="Zoomed single hatching" src="http://pentalis.org/kritablog/wp-content/uploads/2010/06/Zoomed_single_hatching-300x228.png" alt="" width="300" height="228" /></a><br />
<a href="http://community.kde.org/Paintops/Hatching_brush">Documentation!</a></p>
<p><a href="http://wiki.koffice.org/index.php?title=Building/Building_KOffice">How to install Krita trunk and start playing!</a></p>
<p>Remember there is no way to download only Krita, you have to download all of KOffice&#8217;s source code and then you can specify the applications you want to build. If you wonder why this is so, you can check the mailing list.</p>
<p><strong>And now take a look at this&#8230;</strong></p>
<h2 style="text-align: center;"><strong>Bumpmapping Script in Action!</strong></h2>

<a href='http://pentalis.org/kritablog/?attachment_id=158' title='Angelgirl bumpmapped'><img width="150" height="150" src="http://pentalis.org/kritablog/wp-content/uploads/2010/07/angelgirl_bumpmapped-150x150.png" class="attachment-thumbnail" alt="" title="Angelgirl bumpmapped" /></a>
<a href='http://pentalis.org/kritablog/?attachment_id=159' title='Gimp Brushes Bumpmapped'><img width="150" height="150" src="http://pentalis.org/kritablog/wp-content/uploads/2010/07/gimp_brushes_bumpmapped-150x150.png" class="attachment-thumbnail" alt="" title="Gimp Brushes Bumpmapped" /></a>
<a href='http://pentalis.org/kritablog/?attachment_id=161' title='Hairy Brush Bumpmapped'><img width="150" height="150" src="http://pentalis.org/kritablog/wp-content/uploads/2010/07/hairy_brush_bumpmapped1-150x150.png" class="attachment-thumbnail" alt="" title="Hairy Brush Bumpmapped" /></a>
<a href='http://pentalis.org/kritablog/?attachment_id=162' title='Sparks bumpmapped'><img width="150" height="150" src="http://pentalis.org/kritablog/wp-content/uploads/2010/07/sparks_bumpmapped-150x150.png" class="attachment-thumbnail" alt="" title="Sparks bumpmapped" /></a>
<a href='http://pentalis.org/kritablog/?attachment_id=166' title='Wood Gradient Bumpmapped'><img width="150" height="150" src="http://pentalis.org/kritablog/wp-content/uploads/2010/07/wood_gradient_bumpmapped-150x150.png" class="attachment-thumbnail" alt="" title="Wood Gradient Bumpmapped" /></a>
<a href='http://pentalis.org/kritablog/?attachment_id=167' title='Wood Gradient Original'><img width="150" height="150" src="http://pentalis.org/kritablog/wp-content/uploads/2010/07/wood_gradient_original-150x150.png" class="attachment-thumbnail" alt="" title="Wood Gradient Original" /></a>

<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/07/bumpy_source.txt">Source code!</a></p>
<p>References!</p>
<ul>
<li><a href="http://www.mini.pw.edu.pl/~kotowski/Grafika/IlluminationModel/Index.html">Phong Illumination Model!</a></li>
<li><a href="http://www.gamedev.net/columns/hardcore/cgbumpmapping/">Cg bumpmapping tutorial!</a></li>
</ul>
<p>Ah, the story behind this script is so long. But to not bore you with a huge blog entry that will take as long to write as the script (hah&#8230; nah, that&#8217;s not going to happen =)  ), I&#8217;ll <del datetime="2010-07-17T09:13:21+00:00">summarize it</del> try to be brief and hope it helps you when you find yourself facing a brick wall:</p>
<ol>
<li>&#8220;So&#8230; impasto&#8230; um&#8230; where do I start?&#8221;  ===&gt;  e-mail to the community</li>
<li>&#8220;Community gave feedback!, yay!, hhm, bumpmapping&#8230; so&#8230; um&#8230; how do I bumpmap anyway?, where in Krita&#8217;s code do I even begin hacking?&#8221;  ===&gt; divide and conquer, get a bumpmap working first, then put this into Krita&#8217;s code!.</li>
<li>&#8220;Alright, let&#8217;s just make a bumpmapping algorithm&#8230;&#8221; at first I thought about raytracing, Google search&#8230; &#8220;Phong, what is this Phong thing about?&#8230; ooh!, looks interesting!&#8230;&#8221;, I tried to begin implementing it, but after realizing I was very stupid that night, I went to sleep. The next day I should be able to think clearly.</li>
<li>Checking the notes I went on with my research. I tried to immediately turn what I was doing into a program. And you know what?, In the end that was just what I needed. Because after I started making the <del>problem</del> program, I discovered what I was missing, I discovered new <strong>KEYWORDS!</strong>: &#8220;<em>Heightmap&#8221;</em> and &#8220;<em>Bumpmapping</em>&#8220;, of course I was looking for a bumpmapping algorithm, but I looked for mixtures of &#8220;<em>bumpmapping</em>&#8221; and <em>&#8220;Phong&#8221;</em>, and &#8220;<em>raytracing</em>&#8220;, but not &#8220;<em>bumpmapping</em>&#8221; and &#8220;<em>heightmap</em>&#8221; together!.</li>
<li>So again I was faced against many webpages saying essentially the same things I was reading a couple days ago. The difference is that I could actually understand what I was reading now, because I was already <em>doing it. &#8212; </em>Note that while I am well versed in the natural sciences, my problem was sadly my poor ability with math; when I saw so many formulas I couldn&#8217;t immediately grasp them, I couldn&#8217;t grasp those uses of vectors or the (now obvious) fact that the dot product of two unit vectors is the cosine of the angle between them. &#8212; But thanks to the <strong>NEW KEYWORDS</strong> (please always remember that part), I found a place which solved my vector problem much more elegantly!. That&#8217;s the second source I quoted!, <a href="http://www.gamedev.net/columns/hardcore/cgbumpmapping/">the Cg bumpmapping tutorial</a>; they were bumpmapping a bitmap, which is exactly what I wanted to do!, and they already had a solution to my exact problem!, and it was so simple, minimal, and mathematically beautiful, that I felt stupid  =)   but I learned, I learned math is something I need to improve upon.</li>
</ol>
<p>Well, that&#8217;s as far as I&#8217;ll tell the story, the lesson I want you to never forget is <strong>KEYWORDS</strong>. Keywords are KEY! (no **** Sherlock!). When you&#8217;ve finished studying, 10 years later, what do you remember about your college days?, the KEYWORDS, You know where knowledge is, you know the elements you have, the elements you require, and the elements you are missing; every one is linked to a source where you can research, and to find that source you already have all you need: the keywords.</p>
<p>Keywords I said!.</p>
<p>Until next time!</p>
<p><em>PS:</em></p>
<p><em>The odyssey also included a quest for the perfect IDE to develop in Python, because I wanted to have something better than just an editor.</em></p>
<p><em>At the moment I&#8217;m using Eclipse with PyDev, but let me tell you something: I MISS KDevelop&#8217;s highlighting of syntax!, It&#8217;s the BEST highlighting I&#8217;ve ever seen, there&#8217;s no application I have ever used that compares to it, and I&#8217;ve used commercial applications too (and I&#8217;ve searched in screenshots for equivalents). The fact that they highlight every parameter in a function with a unique color is PRICELESS.</em></p>
<p><em>Don&#8217;t get fooled by appearances, don&#8217;t you ever think KDevelop is &#8220;just another KDE app&#8221;, it is THE KDE APP, It&#8217;s a JEWEL that completely reverted my bias against KDE. Seriously guys, if you&#8217;re still reading to this point, and you&#8217;ve taken part in developing KDevelop, just let me tell you: Good Work.</em></p>
<p><em>PS 2:</em></p>
<p><em>Dmitry Kazakov helped me with the bumpmapping previews (all those with a blue titled PyGame window). The <a href="http://forum.kde.org/viewtopic.php?f=138&#038;t=88378">angel girl</a> is a digital painting in Krita made by Deevad, can you spot which bumpmap it is?.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://pentalis.org/kritablog/?feed=rss2&amp;p=157</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Week 21-26 June, Sneak peak of the hatching brush approaching beta.</title>
		<link>http://pentalis.org/kritablog/?p=146</link>
		<comments>http://pentalis.org/kritablog/?p=146#comments</comments>
		<pubDate>Sun, 27 Jun 2010 22:17:15 +0000</pubDate>
		<dc:creator>Pentalis</dc:creator>
				<category><![CDATA[GSoC]]></category>
		<category><![CDATA[Hatching brush]]></category>

		<guid isPermaLink="false">http://pentalis.org/kritablog/?p=146</guid>
		<description><![CDATA[Hello everybody!, I&#8217;ve been developing a hatching brush for Krita as part of my Google Summer of Code project.
And the brush has been advancing steadily. This time I don&#8217;t want to give details on how I overcame each step, it&#8217;s just the same than before. I had to learn new things about Krita codebase, I [...]]]></description>
			<content:encoded><![CDATA[<p>Hello everybody!, I&#8217;ve been developing a hatching brush for Krita as part of my Google Summer of Code project.</p>
<p>And the brush has been advancing steadily. This time I don&#8217;t want to give details on how I overcame each step, it&#8217;s just the same than before. I had to learn new things about Krita codebase, I made mistakes, someone corrected me, I learned more, and then a new feature was born.</p>
<p>This time I learned to change the default values of brushes, even the curves (I had to hard code them). I also benefited from my previous weeks of preparations and, thanks to my now much cleaner code and nearly completely linked GUI, I managed to slip in many new features in a seemingly short time. But never get tricked by those apparent bursts of productivity, it&#8217;s just a result of what was built before behind the scenes.</p>
<p>So this will be just a short opening the curtain for you all to see how the brush is looking. If you are curious and want to try it, you can download Krita&#8217;s lastest source code and build it according to this tutorial!</p>
<p>http://wiki.koffice.org/index.php?title=Building/Building_KOffice</p>
<p>When the brush reaches beta I&#8217;ll finish documenting it, and then my blog post will be just a link to the documentation  <img src='http://pentalis.org/kritablog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />    full of images and (hopefully) entertaining explanations.</p>
<p>Next week I&#8217;ll be making preparations to work on implementing Impasto for Krita. The Halftone brush will remain on hold until the Hatching brush is completely done. Why?, because the logic of both brushes is so similar, that once the hatching brush is polished and ready, I can copypaste the code and create the new brush with just a few changes  <img src='http://pentalis.org/kritablog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>And now, TO THE SNEAK PEEK!, Image barrage!, RAWR!:</p>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/06/Zoomed_single_hatching.png"><img src="http://pentalis.org/kritablog/wp-content/uploads/2010/06/Zoomed_single_hatching.png" alt="" title="Zoomed_single_hatching" width="605" height="460" class="aligncenter size-full wp-image-149" /></a></p>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/06/Triple_crosshatching.png"><img src="http://pentalis.org/kritablog/wp-content/uploads/2010/06/Triple_crosshatching.png" alt="" title="Triple_crosshatching" width="540" height="430" class="aligncenter size-full wp-image-152" /></a></p>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/06/Single_hatching.png"><img src="http://pentalis.org/kritablog/wp-content/uploads/2010/06/Single_hatching.png" alt="" title="Single_hatching" width="506" height="318" class="aligncenter size-full wp-image-150" /></a></p>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/06/Single_hatching_2.png"><img src="http://pentalis.org/kritablog/wp-content/uploads/2010/06/Single_hatching_2.png" alt="" title="Single_hatching_2" width="424" height="338" class="aligncenter size-full wp-image-151" /></a></p>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/06/Triple_crosshatching_thickness.png"><img src="http://pentalis.org/kritablog/wp-content/uploads/2010/06/Triple_crosshatching_thickness.png" alt="" title="Triple_crosshatching_thickness" width="409" height="351" class="aligncenter size-full wp-image-154" /></a></p>
<p>Till next time!, Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://pentalis.org/kritablog/?feed=rss2&amp;p=146</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Week 13-18 June, GUI, Linking GUI, and some thoughts</title>
		<link>http://pentalis.org/kritablog/?p=138</link>
		<comments>http://pentalis.org/kritablog/?p=138#comments</comments>
		<pubDate>Sat, 19 Jun 2010 01:46:38 +0000</pubDate>
		<dc:creator>Pentalis</dc:creator>
				<category><![CDATA[GSoC]]></category>
		<category><![CDATA[Hatching brush]]></category>

		<guid isPermaLink="false">http://pentalis.org/kritablog/?p=138</guid>
		<description><![CDATA[Continuing the story of the hatching brush, this week I started working on the GUI.
The final results:


In the first image you can see how to customize the thickness, angle and separation of the lines. Origin X and Origin Y represent the coordinate of the base line to render the lines. The term &#8220;base line&#8221; is [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing the story of the <a href="http://mail.kde.org/pipermail/kimageshop/2010-April/008507.html">hatching brush</a>, this week I started working on the GUI.</p>
<p>The final results:<br />
<a href="http://pentalis.org/kritablog/wp-content/uploads/2010/06/GUI-and-Crosshatching.png"><img src="http://pentalis.org/kritablog/wp-content/uploads/2010/06/GUI-and-Crosshatching-300x154.png" alt="" title="GUI and Crosshatching" width="300" height="154" class="aligncenter size-medium wp-image-139" /></a><br />
<a href="http://pentalis.org/kritablog/wp-content/uploads/2010/06/GUI-other-options.png"><img src="http://pentalis.org/kritablog/wp-content/uploads/2010/06/GUI-other-options-300x152.png" alt="" title="GUI other options" width="300" height="152" class="aligncenter size-medium wp-image-140" /></a></p>
<p>In the first image you can see how to customize the thickness, angle and separation of the lines. Origin X and Origin Y represent the coordinate of the base line to render the lines. The term &#8220;base line&#8221; is tricky to explain, in my next blog I&#8217;ll send you all a link to the brush&#8217;s documentation where it will be explained.</p>
<p>The second screenshot shows some interesting options. The Scratch Off algorithm should solve the problem of lines thickening due to incremental passes: you can see I used 1px thick lines, but they look instead 2-3px thick, that&#8217;s the problem I&#8217;m talking about  <img src='http://pentalis.org/kritablog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   the algorithm is what I&#8217;m going to do this week.<br />
About the screenshot &#8212;><br />
The first pass shows antialiasing and subpixel precision activated.<br />
The second pass shows only subpixel precision on.<br />
The third has everything deactivated.</p>
<p>If you decide to download from SVN and test this toy, a little warning for you: Origin X and Origin Y are working as &#8220;width&#8221; and &#8220;height&#8221; of the brush at the moment. I&#8217;ll change that during this week when I link the &#8220;BrushTip&#8221; config dialogue (it&#8217;s title is visible in the screenshots).</p>
<p>That&#8217;s all for now, see you next time!.</p>
]]></content:encoded>
			<wfw:commentRss>http://pentalis.org/kritablog/?feed=rss2&amp;p=138</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Week 7-12 June, Hatching Brush, Alpha</title>
		<link>http://pentalis.org/kritablog/?p=91</link>
		<comments>http://pentalis.org/kritablog/?p=91#comments</comments>
		<pubDate>Sun, 13 Jun 2010 10:38:10 +0000</pubDate>
		<dc:creator>Pentalis</dc:creator>
				<category><![CDATA[GSoC]]></category>
		<category><![CDATA[Hatching brush]]></category>

		<guid isPermaLink="false">http://pentalis.org/kritablog/?p=91</guid>
		<description><![CDATA[The old algorithm looked good and simple, but fearing for the speed of the brush I decided to implement the dreaded algorithm based in algebra and trigonometry.
Here are a couple crummy and heavily edited webcam shots of the paper work behind the code I wrote:





(a)
 (b)



Like homework, many sheets of paper were required for a [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://pentalis.org/kritablog/?p=20">old algorithm</a> looked good and simple, but fearing for the speed of the brush I decided to implement the dreaded algorithm based in algebra and trigonometry.</p>
<p>Here are a couple crummy and heavily edited webcam shots of the paper work behind the code I wrote:</p>
<table border="0" cellspacing="0" cellpadding="4" width="100%" bordercolor="#000000">
<col width="128*"></col>
<col width="128*"></col>
<tbody>
<tr valign="center">
<td style="text-align: right;" width="50%"><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/06/paper1.jpg"><img class="aligncenter size-full wp-image-93" title="paper1" src="http://pentalis.org/kritablog/wp-content/uploads/2010/06/paper1.jpg" alt="" width="200" height="162" /></a>(a)</td>
<td width="50%"><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/06/paper2.jpg"><img class="aligncenter size-full wp-image-94" title="paper2" src="http://pentalis.org/kritablog/wp-content/uploads/2010/06/paper2.jpg" alt="" width="238" height="168" /></a> (b)</td>
</tr>
</tbody>
</table>
<p>Like homework, many sheets of paper were required for a relatively terse answer (in this case, I think around 80 lines of code if I don&#8217;t take comments or spaces into account).</p>
<p>All the output for my original code was text sent to the console with <code>std::clog()</code> and <code>printf()</code> to confirm there were no holes in its algebra and geometry.</p>
<p>The algorithm in its current state can be summarized as follows:</p>
<p>1.- Take settings from the user, including the origin point.<br />
2.- The origin point + angle requested by the user constitute the base line of the hatching, the position of all other lines is calculated relative to that line.<br />
3.- Convert point+angle of the base line into intercept b and slope p. Make an exception for angles = 90 or -90 (I used that notation which is less ambiguous to the user). [Reminder: Any line can be described with a point and an angle, or with the algebraic expression: px + b (as long as angle is different from 90 or 270 degrees). ]<br />
4.- With lots of geometry-fu (see the code for details), calculate what are the dy and dx distances separating each line. <a href="http://pentalis.org/kritablog/?p=20">We know</a> that moving through the axis of separation s is equivalent to moving in the x or y axis, and moving through the y axis is the most convenient way (which implies only varying the intercept of the base line to discover new lines).<br />
5.- With more geometry-fu and algebra-fu (including the floating point modulus operation), determine the intercept of the lines contained in the hatching area and their intersection points, then trace them. This is done in a cycle that goes line by line.</p>
<p>Much more complex (for me) than the other algorithm, but easier on the processor (I haven&#8217;t tested, but common sense tells me that it is; math is cheap, rasterizing unused space isn&#8217;t), and looks cleaner.</p>
<p>I first had a paint operation that painted nothing, and instead dumped data to the console, describing all the points in it. Then I compared its results with my paper results. When I solved all annoying bugs including one uninitialized variable that wasn&#8217;t spotted by the compiler (very uncareful of me), and I was sure the algorithm did what I intended it to do, I ventured into trying to draw. When doing that, I discovered an omission in my algebra (I wasn&#8217;t considering the relative position of the brush, only the origin point determined by the user). Then I fixed that and obtained this brush:</p>
<p>Screenshot 1</p>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/06/glitch2redux.png"><img class="aligncenter size-medium wp-image-134" title="glitch2redux" src="http://pentalis.org/kritablog/wp-content/uploads/2010/06/glitch2redux-300x250.png" alt="" width="300" height="250"  /></a></p>
<p>Some lines are thicker than others. The thickness of the lines <strong>should</strong> be 1 px, but I&#8217;m using subpixel rasterization. Which causes some areas to be painted gray, and then when the mouse passes over again, they become black and make the line look thicker.</p>
<p>Appart from that, I noticed that some lines seem to get out-of-sync by 1 pixel with respect to the others. I believe that glitch too is caused by problems with sub-pixel rasterization. For example, if I trace a straight line using alt+mouse (I thank an IRL friend with no programming background for suggesting this), I get an homogeneous hatching (but still with thick lines); unlike the sometimes heterogeneous hatching I get when I use freeform angles. See below.</p>
<p>Screenshot 2</p>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/06/glitch3_.png"><img class="aligncenter size-medium wp-image-106" title="glitch3_" src="http://pentalis.org/kritablog/wp-content/uploads/2010/06/glitch3_-300x222.png" alt="" width="300" height="222" /></a></p>
<p>Screenshot 3</p>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/06/glitch4_.png"><img class="aligncenter size-medium wp-image-107" title="glitch4_" src="http://pentalis.org/kritablog/wp-content/uploads/2010/06/glitch4_-300x193.png" alt="" width="300" height="193" /></a></p>
<p>I believe the solution to the thickening lines (which look pretty cool anyway, kind of like &#8220;hand-made hatching&#8221;) is either not using sub-pixel precision, or using the &#8220;wash&#8221; painting mode instead of &#8220;build up&#8221;. Either way I plan to leave the user the option to use the mode he prefers, including this one. Sometimes a glitch becomes a feature, *wink wink nudge nudge*.</p>
<p>Screenshot 4</p>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/06/glitch1_.png"><img class="aligncenter size-medium wp-image-104" title="glitch1_" src="http://pentalis.org/kritablog/wp-content/uploads/2010/06/glitch1_-300x230.png" alt="" width="300" height="230" /></a></p>
<p>Now, this glitch is a disaster that tells me something is very wrong, but NOT in the algebra, but in the few painting code lines involved in my brush.</p>
<p>With certain paintop settings (like these above), as I pass the brush over the canvas, randomly a whole new hatched square appears close to the normal one, out-of-sync with respect to the others, causing this flawed pattern. I&#8217;ll have to investigate where the error is (I have a hunch of where). Maybe I could even explain the most extreme cases of the first glitch after I discover the cause of this one</p>
<p>When I link the GUI controls to the brush I&#8217;ll be able to show you some cross-hatching as well as many different patterns in the same image.</p>
<p>Till the next time.</p>
]]></content:encoded>
			<wfw:commentRss>http://pentalis.org/kritablog/?feed=rss2&amp;p=91</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Reminding what the project is about, OS Reinstallation, Funny Spam and other things</title>
		<link>http://pentalis.org/kritablog/?p=69</link>
		<comments>http://pentalis.org/kritablog/?p=69#comments</comments>
		<pubDate>Fri, 28 May 2010 06:41:40 +0000</pubDate>
		<dc:creator>Pentalis</dc:creator>
				<category><![CDATA[GSoC]]></category>
		<category><![CDATA[Hatching brush]]></category>

		<guid isPermaLink="false">http://pentalis.org/kritablog/?p=69</guid>
		<description><![CDATA[Where was I?, ah yes, designing algorithms in my head preparing to turn them into code.
Someone requested me to restate what this project was about; he missed my first post in PlanetKDE because I was actually not aggregated on it when I made the first post. The best way to know what I should be [...]]]></description>
			<content:encoded><![CDATA[<p>Where was I?, ah yes, designing algorithms in my head preparing to turn them into code.</p>
<p>Someone requested me to restate what this project was about; he missed my first post in PlanetKDE because I was actually not aggregated on it when I made the first post. The best way to know what I should be programming is looking at my GSoC proposal:</p>
<p><a href="http://mail.kde.org/pipermail/kimageshop/2010-April/008507.html">GSoC proposal, comic artist Krita brushes for Krita and impasto implementation</a></p>
<p><a href="http://pentalis.org/kritablog/?p=5">And this is a link to my first post in my blog</a></p>
<p>&lt;start digression&gt;<br />
Before I go on, let me do a little apology about comments not appearing: I&#8217;m completely new to blogging and I didn&#8217;t know there was a special section in Wordpress to approve or reject comments. Now that I found it, I was surprised to see so many SNEAKY Spam messages, things like &#8220;very interesting project&#8221; and the title says &#8220;Chanel handbags&#8221;, and the URL points to an online shop, hah!.<br />
&lt;/end digression&gt;</p>
<p>If you didn&#8217;t skim over the timeline, you may have noticed I&#8217;m way out of my own schedule. That&#8217;s nothing new considering the person we&#8217;re talking about (me), I&#8217;m terrible at respecting timelines, specially my own. Now, I haven&#8217;t just let time pass hoping code writes itself. I&#8217;m in a constant struggle against my inability to focus&#8230; and&#8230;</p>
<p>&#8230;chaos.</p>
<p>While it&#8217;s true that I&#8217;ve been fairly active designing classes and algorithms in my head, I am yet to write a single line of code. And well, at this point in time, I think I&#8217;ll have to agree with my mentor when he said (before even being my mentor):</p>
<p>&#8220;Your distro shouldn&#8217;t get in the way of your coding&#8221;.</p>
<p>And, considering I&#8217;m running Debian Stable, I think that sentence applies.</p>
<p>For those unfamiliar, it means I have KDE3 as my desktop. But Krita is founded upon KOffice, KOffice is built upon KDE, and the current version (2.X) uses KDE4.</p>
<p>So how did I manage to submit my first samples of code and actually develop for Krita?.</p>
<p>Please, take a look at this aberration:</p>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/05/Aberrant-Debian.png"><img src="http://pentalis.org/kritablog/wp-content/uploads/2010/05/Aberrant-Debian-1024x640.png" alt="" title="Aberrant Debian" width="450" height="281" class="aligncenter size-large wp-image-71" /></a></p>
<p>I had to decide between using virtualization, another linux installation, updating Debian to Unstable, getting a new computer, etc.</p>
<p>I appreciate the stability of Debian Stable, so I didn&#8217;t move to Unstable. I had no disk space available for another installation &#8211;to repartition would&#8217;ve required moving a ton of documents and files that I didn&#8217;t want to touch&#8211; and finally, for the same reason, virtualization was out of the question.</p>
<p>In the end I used <code>debootstrap</code>, <code>schroot</code> and another pile of tricks I learned in the net and forgot the source (the links must be saved somewhere in the chaos of my document folders).</p>
<p>What I did was create a new Debian installation inside my Debian installation, a frankenstein Debian Stable/Unstable growing like a tumor inside Debian Stable and containing the KOffice source, upon which I could work, compile, _EXECUTE_ (ever seen a KDE4 application running inside KDE3?, well, now you have!), and work. This system was fairly fine for a few modifications to the source of Krita, but it&#8217;s horribly messy. And now I need to use a SVN account to make my commits, and I really can&#8217;t draw the strength to tinker enough to make the SVN account work seamlessly inside this cancerous Debian Unstable. A system reinstall is needed, urgently.</p>
<p>Did I mention I have a dead Windows Beta 7 installed in one of my partitions, a variety of old bootless installations and some other vestigial organs in my hard drive?. Definitely this needs a clean start. A clean start for a clean state of mind. Now&#8230; I&#8217;m trying to decide for a distro to use.</p>
<p>So Google, KDE, please excuse me while I disappear for a day*, this is for the good of Krita!  (and my mental health)  >_> .</p>
<p>*or more if things go wrong.</p>
<p>PS: somewhere in my project proposal you must&#8217;ve read I was going to take this with the same responsibility as a full time job. I&#8217;m serious about that, but well, one thing is theory, the other is practice&#8230; but from experience we learn. I have never really tamed the inner monster of procrastination, it was about time I learned to focus on something for real. This should be a lesson for life.</p>
<p>PS2: a little help for those looking to replicate this trick, the obscured parts of the screenshot say:<br />
<code>~$ export KDEDIRS=$KDEDIRS:/KOFFICE/inst<br />
~$ export PATH=$PATH:/KOFFICE/inst/bin<br />
~$ export LD_LIBRARY_PATH=/KOFFICE/inst:$LD_LIBRARY_PATH</code><br />
You also have to do a <code>~$kbuildsycoca</code> if you&#8217;re issuing those commands for the first time, for it to work.</p>
]]></content:encoded>
			<wfw:commentRss>http://pentalis.org/kritablog/?feed=rss2&amp;p=69</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>The Algorithm and some Backstory, May 14 &#8211; May 24</title>
		<link>http://pentalis.org/kritablog/?p=20</link>
		<comments>http://pentalis.org/kritablog/?p=20#comments</comments>
		<pubDate>Tue, 25 May 2010 03:53:53 +0000</pubDate>
		<dc:creator>Pentalis</dc:creator>
				<category><![CDATA[GSoC]]></category>
		<category><![CDATA[Hatching brush]]></category>

		<guid isPermaLink="false">http://pentalis.org/kritablog/?p=20</guid>
		<description><![CDATA[Remember last diagram?
The purple blob called algorithm?, It has taken shape. It&#8217;s a relief to have deviced it completely in my head, as that was the part that had me the most concerned about the program. I felt that if I couldn&#8217;t device one quickly, I would not finish the program in time.
That way of [...]]]></description>
			<content:encoded><![CDATA[<p>Remember last diagram?</p>
<p>The purple blob called algorithm?, It has taken shape. It&#8217;s a relief to have deviced it completely in my head, as that was the part that had me the most concerned about the program. I felt that if I couldn&#8217;t device one quickly, I would not finish the program in time.</p>
<p>That way of thinking has accompained me since I learned to survive in higher education: my disastrous ability to get distracted from study (or anything that resembles work or isn&#8217;t pleasing) meant that I had to device ways to get myself to do things in time or at least before the final deadlines.</p>
<p>That role as been fulfilled by my conscience, that evil overlord with a whip that keeps reminding me of aaaaaaall the things I still have to do, with the highest priority targets earning me more mental whipping per unit of time.</p>
<p>Look at the images below, can you distinguish which direction the lines are moving?. Can you find a difference between both?.</p>
<table border="0" cellspacing="0" cellpadding="4" width="100%" bordercolor="#000000">
<col width="128*"></col>
<col width="128*"></col>
<tbody>
<tr valign="center">
<td style="text-align: right;" width="50%"><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/05/horizontal.gif"><img class="size-full wp-image-26 alignright" title="horizontal" src="http://pentalis.org/kritablog/wp-content/uploads/2010/05/horizontal.gif" alt="" width="100" height="100" /></a>(a)</td>
<td width="50%"><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/05/vertical.gif"><img class="size-full wp-image-27 alignleft" title="vertical" src="http://pentalis.org/kritablog/wp-content/uploads/2010/05/vertical.gif" alt="" width="100" height="100" /></a> (b)</td>
</tr>
</tbody>
</table>
<p>Truth be told, they&#8217;re indistinguishable. One animation was made by moving the image 1 pixel down every frame, and the other by moving 1 pixel left every frame. But other than the filename, both files are identical, their size and every frame is identical to each other.</p>
<p>Here is a jerky animation with a red dot serving as a guide. Note that if you carefully cover the red dot and only focus on the remaining space of the animation, you may start seeing it go to a different direction than the dot used to be moving.</p>
<table border="0" cellspacing="0" cellpadding="4" width="100%" bordercolor="#000000">
<col width="128*"></col>
<col width="128*"></col>
<tbody>
<tr valign="center">
<td style="text-align: right;" width="50%"><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/05/pattern_animated1.gif"><img class="size-full wp-image-30 alignright" title="pattern_animated" src="http://pentalis.org/kritablog/wp-content/uploads/2010/05/pattern_animated1.gif" alt="" width="200" height="100" /></a>(c)</td>
<td width="50%"><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/05/pattern_animated2.gif"><img class="size-full wp-image-31 alignleft" title="pattern_animated2" src="http://pentalis.org/kritablog/wp-content/uploads/2010/05/pattern_animated2.gif" alt="" width="100" height="200" /></a>(d)</td>
</tr>
</tbody>
</table>
<p>This is the first step of my reasoning that led me to conclude that for any regular line pattern, vertical and horizontal movements are equivalent, and related by a factor of <code>x</code>.<code> x</code> depends on the angle; for example, for a pattern composed of lines with a tilt of 30°, a movement of 2 pixels to the left are equivalent to 1 pixel toward bottom. Look at the images below, they were created by stretching animations (a) and (b) (both are equivalent so it&#8217;s the same than if I chose to stretch (a) or (b) twice instead):</p>
<table border="0" cellspacing="0" cellpadding="4" width="100%" bordercolor="#000000">
<col width="128*"></col>
<col width="128*"></col>
<tbody>
<tr valign="center">
<td style="text-align: right;" width="50%"><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/05/vertical2.gif"><img class="size-full wp-image-35 alignright" title="vertical2" src="http://pentalis.org/kritablog/wp-content/uploads/2010/05/vertical2.gif" alt="" width="300" height="100" /></a>(e)</td>
<td width="50%"><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/05/horizontal2.gif"><img class="size-full wp-image-34 alignleft" title="horizontal2" src="http://pentalis.org/kritablog/wp-content/uploads/2010/05/horizontal2.gif" alt="" width="100" height="300" /></a>(f)</td>
</tr>
</tbody>
</table>
<p>From looking at them you can visually perceive that even if the angle of the lines is changed, you can still obtain any possible configuration of the pattern by simply moving in a single direction. If moving in a single coordinate lets us obtain any possible configuration of the pattern, moving in 2 coordinates will as well.</p>
<p>If you play with those principles in your mind, you will conclude that what I say is true (but hell if I&#8217;m going to show an entire demonstration of it here, that&#8217;d make the explanation take longer than the deduction).</p>
<p>That&#8217;s the basis of my algorithm. Which I&#8217;ll describe below. And I know it&#8217;s not the best solution, but it&#8217;s real and it works for any dab* shape, and I <em>hope</em> it doesn&#8217;t take too much processing power. I have understood every step involved in my head and now all I need is to implement it. Allow me to explain.</p>
<p>*look at my previous blog entry to visually understand what a dab is in digital brush parlance.</p>
<p>Filling an arbitrarily sized rectangle or ellipse with lines of any thickness, separation, angle and base point (the just discussed X, Y position within the pattern) is not a simple task. Many things can go wrong if you&#8217;re too restrictive, much processing power and memory will be wasted if you take an easy path. So I tried to reach a compromise, look below:</p>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/05/diagonale-of-the-dab1.png"><img class="aligncenter size-full wp-image-43" title="diagonale of the dab" src="http://pentalis.org/kritablog/wp-content/uploads/2010/05/diagonale-of-the-dab1.png" alt="" width="331" height="320" /></a></p>
<p>Image (g): Well, this image is an example of what would happen if you apply the algorithm I describe below. I can&#8217;t really explain the image, as it explains itself as you read the algorithm. The dotted black border is imaginary, it doesn&#8217;t exist anywhere, it&#8217;s just my way to see &#8220;see?, it&#8217;s like a square&#8221; (see algorithm). The dotted inner square (red color) represents the limits of the rectangle containing the dab. The tilted rose one is there only to show people visually that I used the diagonale as the length of the lines.</p>
<p><a href="http://pentalis.org/kritablog/wp-content/uploads/2010/05/all-patterns-represented1.png"><img class="aligncenter size-full wp-image-44" title="all patterns represented" src="http://pentalis.org/kritablog/wp-content/uploads/2010/05/all-patterns-represented1.png" alt="" width="372" height="320" /></a></p>
<p>Image (h): Even here the image is self-explaining, you&#8217;ll see what I mean with &#8220;oops&#8221;.</p>
<p>Well, that should serve as a visual guide for the algorithm, now the steps:</p>
<p>1-Determine the diagonal size of the dab &#8211;&gt; <code>length</code><br />
2-Obtain the line angle from the properties class &#8211;&gt; <code>angle</code><br />
3-Create a new empty bitmap to draw the stuff inside&#8230; grrrr, I just realized I missed this step to understand this process as a whole. <em>Forget all I said about understanding everything in its entirety.</em> I don&#8217;t know if it is or isn&#8217;t possible to draw a line that stretches out of the bitmap with the available functions. If not possible: causes an error. If possible: only draws the part of the line within the bitmap. Imagine it throws an error for the sake of this example. Imagine this bitmap is just the right size for this &#8220;border overload&#8221; to not occur.<br />
4-Trace a line with the brush tool over a path describing a line of length <code>length</code> and angle <code>angle</code>.<br />
5-Trace parallel lines to that, separated by a distance <code>s</code> off the original line, measured by a segment perpendicular to it.<br />
6-The last line drawn will be line number <code>int(length/s)</code>, such that the area covered by the lines will be a square at <code>lim(s-&gt;0)</code>.<br />
&#8212;&#8212;&#8212;&#8212;6b-Now, the problem is that if I trace that many lines, and the origin point is too far (almost about to start a new cycle, meaning I&#8217;m back to a configuration identical to that with the origin point at coordinate [0;0]), it could result in an &#8220;oops&#8221;, as seen in the image. This shouldn&#8217;t be a problem, except for certain limit cases that may arise. Just in case, the solution is just adding 1 line more. Meaning the last line is line number <code>int(length/s)+1</code><br />
7-Locate the dab inside this square as seen in <code>Image (h)</code>, the point of origin (left-top corner of the rectangle containing the dab) depends on the base point (X and Y position) in user preferences. (I haven&#8217;t thought the exact formula to locate a consistent origin but it&#8217;s not difficult to determine).<br />
8-Cut.<br />
9-Paste as filler (step 5 in <a href="http://pentalis.org/kritablog/wp-content/uploads/2010/05/schematic-11.png">The Schematics</a>).</p>
<p>There is a lot of room for improvement in this algorithm, but it&#8217;s a base I can work upon. Wasted processing time increases as the dab&#8217;s dimensions deviate from a square and as the angle approaches 45°, as a lot of things will be drawn that will be ultimately not be used (as in cut, see step 8).</p>
<p>I think, depending on the functions at hand, that I can optimize this to draw directly on the dab, such that the bitmap (or &#8220;canvas&#8221;) of step 3 will be only in my imagination, and such that every line that attempts to be drawn outside the limits of the dab will simply not be drawn outside without throwing an exception or error. I may even go and create the functions I need to do that. It all depends on the tools I find in my way.</p>
<p>So, there you have, my hatching algorithm. The algorithm is the most difficult step; after it is finished, the rest is a cakewalk. The GUI, the preferences class, communication, none of that is difficult. I can confidently say the algorithm<strong>s</strong> (plural) will ultimately represent more than 60% of the time spent programming and designing this new brush, probably close to 80%.</p>
<p>I&#8217;m too tired to give more personal comments. But I&#8217;ll say one thing!, I started using heating. I can&#8217;t work with cold hands, cold feet and cold knees!, I told you, it&#8217;s winter here!. If it were summer, it&#8217;d be so MUCH easier to focus, with light and warmth!. Who wants to work when not feeling in a ZEN state?, certainly not me. As long as my body is whining about cold or hunger or sleepyness, I can&#8217;t sustain focus on work (sometimes not even on games)   <img src='http://pentalis.org/kritablog/wp-includes/images/smilies/icon_neutral.gif' alt=':|' class='wp-smiley' />   .</p>
<p>Salgan al sol!.</p>
<p><strong>Endnotes:</strong></p>
<p>&#8230;Err, I gave an entire demonstration of why vertical and horizontal movements are equivalent in a parallel line pattern and then forgot to explain why it is the basis of my algorithm: it is because, within that square made of <code>n</code> lines of length <code>length</code>, the only way I can be sure that I won&#8217;t get out of the boundaries of this &#8220;square&#8221;, is by moving along the axis of space <code>s</code>, that is to say, perpendicular to the lines. The idea is that I&#8217;ll be able to achieve any pattern configuration that the user requests (depending on the origin point he desires) by simply moving along that axis, which is a combination of vertical and horizontal movements, but which, in the end, can be equivalent to any other movement along those axes.</p>
<p>And if you don&#8217;t know what I mean with <em>origin point</em>, imagine that the different animations I made, like (a) and (b), where created by moving the <em>origin point</em> 1 pixel at a time toward the left or up.</p>
]]></content:encoded>
			<wfw:commentRss>http://pentalis.org/kritablog/?feed=rss2&amp;p=20</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

