diff options
Diffstat (limited to 'docs/posts')
-rw-r--r-- | docs/posts/SDL2_devlog/index.html | 35 | ||||
-rw-r--r-- | docs/posts/index.html | 4 |
2 files changed, 29 insertions, 10 deletions
diff --git a/docs/posts/SDL2_devlog/index.html b/docs/posts/SDL2_devlog/index.html index cda228b..9a324a8 100644 --- a/docs/posts/SDL2_devlog/index.html +++ b/docs/posts/SDL2_devlog/index.html | |||
@@ -25,15 +25,15 @@ | |||
25 | ">View Raw</a> | 25 | ">View Raw</a> |
26 | <div class="separator"></div> | 26 | <div class="separator"></div> |
27 | <div class="date"> | 27 | <div class="date"> |
28 | 28/03 — 2021 | 28 | 31/03 — 2021 |
29 | <div class="stats"> | 29 | <div class="stats"> |
30 | <span class="stats-number"> | 30 | <span class="stats-number"> |
31 | 76.71 | 31 | 91.51 |
32 | </span> | 32 | </span> |
33 | <span class="stats-unit">cm</span> | 33 | <span class="stats-unit">cm</span> |
34 |   | 34 |   |
35 | <span class="stats-number"> | 35 | <span class="stats-number"> |
36 | 6.7 | 36 | 7.5 |
37 | </span> | 37 | </span> |
38 | <span class="stats-unit">min</span> | 38 | <span class="stats-unit">min</span> |
39 | </div> | 39 | </div> |
@@ -43,6 +43,25 @@ | |||
43 | </h1> | 43 | </h1> |
44 | <div class="post-text"> | 44 | <div class="post-text"> |
45 | <p>I have been working on an editor for the <a href="https://git.peppe.rs/graphics/obi/about">One Bit Image</a> file format in Rust and SDL2. This entry in my blog follows my progress on the editor. The days are listed in reverse chronological order, begin from the bottom, if this is your first time on this page.</p> | 45 | <p>I have been working on an editor for the <a href="https://git.peppe.rs/graphics/obi/about">One Bit Image</a> file format in Rust and SDL2. This entry in my blog follows my progress on the editor. The days are listed in reverse chronological order, begin from the bottom, if this is your first time on this page.</p> |
46 | <h3 id="day-16">Day 16</h3> | ||
47 | <p>The embedded lisp is coming along nicely, users can load a custom <code>rc.lisp</code>, which is evaluated on startup. To disable to grid on start, for example:</p> | ||
48 | <div class="sourceCode" id="cb1"><pre class="sourceCode scheme"><code class="sourceCode scheme"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true"></a><span class="co">;;; rc.lisp</span></span> | ||
49 | <span id="cb1-2"><a href="#cb1-2" aria-hidden="true"></a>(toggle-grid)</span></code></pre></div> | ||
50 | <p>Some aliases to switch between brushes:</p> | ||
51 | <div class="sourceCode" id="cb2"><pre class="sourceCode scheme"><code class="sourceCode scheme"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true"></a><span class="co">;;; rc.lisp</span></span> | ||
52 | <span id="cb2-2"><a href="#cb2-2" aria-hidden="true"></a>(<span class="ex">define</span><span class="fu"> </span>(brush kind)</span> | ||
53 | <span id="cb2-3"><a href="#cb2-3" aria-hidden="true"></a> (<span class="kw">cond</span></span> | ||
54 | <span id="cb2-4"><a href="#cb2-4" aria-hidden="true"></a> ((<span class="kw">eq?</span> kind 'f) (brush-fill))</span> | ||
55 | <span id="cb2-5"><a href="#cb2-5" aria-hidden="true"></a> ((<span class="kw">eq?</span> kind 'c) (brush-circle))</span> | ||
56 | <span id="cb2-6"><a href="#cb2-6" aria-hidden="true"></a> ((<span class="kw">eq?</span> kind 'l) (brush-line))</span> | ||
57 | <span id="cb2-7"><a href="#cb2-7" aria-hidden="true"></a> ((<span class="kw">eq?</span> kind 'l+) (brush-line-extend))</span> | ||
58 | <span id="cb2-8"><a href="#cb2-8" aria-hidden="true"></a> (<span class="kw">else</span> (brush-circle))))</span></code></pre></div> | ||
59 | <h3 id="day-15">Day 15</h3> | ||
60 | <p>I began writing a standard library for the lisp, in lisp. It includes basic list operations: <code>car</code>, <code>cdr</code>, <code>null?</code>, <code>list</code>, higher order functions: <code>map</code>, <code>filter</code>, <code>fold</code>:</p> | ||
61 | <div class="sourceCode" id="cb3"><pre class="sourceCode lisp"><code class="sourceCode commonlisp"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true"></a>(define (member? item ls)</span> | ||
62 | <span id="cb3-2"><a href="#cb3-2" aria-hidden="true"></a> (fold <span class="dv">#f</span></span> | ||
63 | <span id="cb3-3"><a href="#cb3-3" aria-hidden="true"></a> (<span class="kw">lambda</span> (acc x) (<span class="kw">or</span> acc (eq? item x)))</span> | ||
64 | <span id="cb3-4"><a href="#cb3-4" aria-hidden="true"></a> ls))</span></code></pre></div> | ||
46 | <h3 id="day-14">Day 14</h3> | 65 | <h3 id="day-14">Day 14</h3> |
47 | <p>I attempted a <a href="https://peppe.rs/art/ramen_noodles.png">small art piece</a> using the editor, while it was largely usable, I felt a certain lack of feedback. The brushes just didn’t relay as much info as I’d have liked, for example, the approximate points of the line or the angle made by the line against the x-axis. Unfortunately, the existing infrastructure around brushes and line drawing didn’t easily allow for this either. I went ahead and reimplemented brushes, and added a new flood fill brush too:</p> | 66 | <p>I attempted a <a href="https://peppe.rs/art/ramen_noodles.png">small art piece</a> using the editor, while it was largely usable, I felt a certain lack of feedback. The brushes just didn’t relay as much info as I’d have liked, for example, the approximate points of the line or the angle made by the line against the x-axis. Unfortunately, the existing infrastructure around brushes and line drawing didn’t easily allow for this either. I went ahead and reimplemented brushes, and added a new flood fill brush too:</p> |
48 | <figure> | 67 | <figure> |
@@ -75,11 +94,11 @@ | |||
75 | </figure> | 94 | </figure> |
76 | <h3 id="day-8">Day 8</h3> | 95 | <h3 id="day-8">Day 8</h3> |
77 | <p>One of my favourite features of GIMP was symmetric editing. I added some coordinate geometry primitives to my pixmap abstraction, allowing for mirroring and reflecting figures about lines or points. The result was an ergonomic function that applies symmetry to any painting operation, (undo/redo works as expected):</p> | 96 | <p>One of my favourite features of GIMP was symmetric editing. I added some coordinate geometry primitives to my pixmap abstraction, allowing for mirroring and reflecting figures about lines or points. The result was an ergonomic function that applies symmetry to any painting operation, (undo/redo works as expected):</p> |
78 | <div class="sourceCode" id="cb1"><pre class="sourceCode rust"><code class="sourceCode rust"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true"></a><span class="kw">let</span> line <span class="op">=</span> <span class="kw">self</span><span class="op">.</span>pixmap<span class="op">.</span>get_line(start<span class="op">,</span> end)<span class="op">;</span></span> | 97 | <div class="sourceCode" id="cb4"><pre class="sourceCode rust"><code class="sourceCode rust"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true"></a><span class="kw">let</span> line <span class="op">=</span> <span class="kw">self</span><span class="op">.</span>pixmap<span class="op">.</span>get_line(start<span class="op">,</span> end)<span class="op">;</span></span> |
79 | <span id="cb1-2"><a href="#cb1-2" aria-hidden="true"></a><span class="kw">let</span> sym_line <span class="op">=</span> <span class="kw">self</span><span class="op">.</span>symmetry<span class="op">.</span>apply(<span class="op">&</span>line)<span class="op">;</span></span> | 98 | <span id="cb4-2"><a href="#cb4-2" aria-hidden="true"></a><span class="kw">let</span> sym_line <span class="op">=</span> <span class="kw">self</span><span class="op">.</span>symmetry<span class="op">.</span>apply(<span class="op">&</span>line)<span class="op">;</span></span> |
80 | <span id="cb1-3"><a href="#cb1-3" aria-hidden="true"></a><span class="kw">for</span> point on line<span class="op">.</span>extend(sym_line) <span class="op">{</span></span> | 99 | <span id="cb4-3"><a href="#cb4-3" aria-hidden="true"></a><span class="kw">for</span> point on line<span class="op">.</span>extend(sym_line) <span class="op">{</span></span> |
81 | <span id="cb1-4"><a href="#cb1-4" aria-hidden="true"></a> <span class="co">// draw to window</span></span> | 100 | <span id="cb4-4"><a href="#cb4-4" aria-hidden="true"></a> <span class="co">// draw to window</span></span> |
82 | <span id="cb1-5"><a href="#cb1-5" aria-hidden="true"></a><span class="op">}</span></span></code></pre></div> | 101 | <span id="cb4-5"><a href="#cb4-5" aria-hidden="true"></a><span class="op">}</span></span></code></pre></div> |
83 | <figure> | 102 | <figure> |
84 | <video src="https://u.peppe.rs/B1.mp4" controls=""><a href="https://u.peppe.rs/B1.mp4">Day 8</a></video><figcaption aria-hidden="true">Day 8</figcaption> | 103 | <video src="https://u.peppe.rs/B1.mp4" controls=""><a href="https://u.peppe.rs/B1.mp4">Day 8</a></video><figcaption aria-hidden="true">Day 8</figcaption> |
85 | </figure> | 104 | </figure> |
diff --git a/docs/posts/index.html b/docs/posts/index.html index 0558643..206cab7 100644 --- a/docs/posts/index.html +++ b/docs/posts/index.html | |||
@@ -27,7 +27,7 @@ | |||
27 | <tr> | 27 | <tr> |
28 | <td class=table-post> | 28 | <td class=table-post> |
29 | <div class="date"> | 29 | <div class="date"> |
30 | 28/03 — 2021 | 30 | 31/03 — 2021 |
31 | </div> | 31 | </div> |
32 | <a href="/posts/SDL2_devlog" class="post-link"> | 32 | <a href="/posts/SDL2_devlog" class="post-link"> |
33 | <span class="post-link">SDL2 Devlog</span> | 33 | <span class="post-link">SDL2 Devlog</span> |
@@ -35,7 +35,7 @@ | |||
35 | </td> | 35 | </td> |
36 | <td class=table-stats> | 36 | <td class=table-stats> |
37 | <span class="stats-number"> | 37 | <span class="stats-number"> |
38 | 6.7 | 38 | 7.5 |
39 | </span> | 39 | </span> |
40 | <span class=stats-unit>min</span> | 40 | <span class=stats-unit>min</span> |
41 | </td> | 41 | </td> |