From 01ef5ffab82e3cfaf64dba23a970e99f67b84fdb Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 31 Mar 2021 18:27:25 +0530 Subject: add day 15, 16 of devlog --- docs/posts/SDL2_devlog/index.html | 35 +++++++++++++++++++++++++++-------- docs/posts/index.html | 4 ++-- 2 files changed, 29 insertions(+), 10 deletions(-) (limited to 'docs/posts') 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 @@ ">View Raw
- 28/03 — 2021 + 31/03 — 2021
- 76.71 + 91.51 cm   - 6.7 + 7.5 min
@@ -43,6 +43,25 @@

I have been working on an editor for the One Bit Image 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.

+

Day 16

+

The embedded lisp is coming along nicely, users can load a custom rc.lisp, which is evaluated on startup. To disable to grid on start, for example:

+
;;; rc.lisp
+(toggle-grid)
+

Some aliases to switch between brushes:

+
;;; rc.lisp
+(define (brush kind)
+  (cond
+    ((eq? kind 'f) (brush-fill))
+    ((eq? kind 'c) (brush-circle))
+    ((eq? kind 'l) (brush-line))
+    ((eq? kind 'l+) (brush-line-extend))
+    (else (brush-circle))))
+

Day 15

+

I began writing a standard library for the lisp, in lisp. It includes basic list operations: car, cdr, null?, list, higher order functions: map, filter, fold:

+
(define (member? item ls)
+  (fold #f
+        (lambda (acc x) (or acc (eq? item x)))
+        ls))

Day 14

I attempted a small art piece 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:

@@ -75,11 +94,11 @@

Day 8

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):

-
let line = self.pixmap.get_line(start, end);
-let sym_line = self.symmetry.apply(&line);
-for point on line.extend(sym_line) {
-    // draw to window
-}
+
let line = self.pixmap.get_line(start, end);
+let sym_line = self.symmetry.apply(&line);
+for point on line.extend(sym_line) {
+    // draw to window
+}
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 @@
- 28/03 — 2021 + 31/03 — 2021
SDL2 Devlog @@ -35,7 +35,7 @@ - 6.7 + 7.5 min -- cgit v1.2.3