From 5a43ac3be6d788e6c662213710b36b36bce93478 Mon Sep 17 00:00:00 2001 From: Akshay Date: Thu, 8 Apr 2021 17:45:30 +0530 Subject: add day 19 of devlog --- docs/posts/SDL2_devlog/index.html | 11 ++++++++--- docs/posts/index.html | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'docs/posts') diff --git a/docs/posts/SDL2_devlog/index.html b/docs/posts/SDL2_devlog/index.html index 5bfbaf6..85ab1af 100644 --- a/docs/posts/SDL2_devlog/index.html +++ b/docs/posts/SDL2_devlog/index.html @@ -25,15 +25,15 @@ ">View Raw
- 04/04 — 2021 + 08/04 — 2021
- 114.29 + 120.28 cm   - 9.1 + 9.6 min
@@ -43,6 +43,11 @@

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 19

+

Attempted some isometric art within the editor. The angles displayed alongside the line brush are handly, however, having only a rectangular grid did not help. I implemented an isometric grid today. Isometric grids in pixel art differ in that the tangent of the isometric angle is exactly 0.5! For every pixel down, you go exactly two pixels sideways. The math works out really well in the drawing procedures too, dealing with floating points is a pain.

+
+Day 19 +

Day 18

I added basic support for guides, they can be added and activated from the lisp REPL. Another long standing improvement I wanted to make was reworking the pixmap drawing procedure. The old procedure draws a square for each pixel in the pixmap, coloured according to its value in the pixmap. Naturally, this means, for an NxN pixmap, there are calls to SDL! I reworked this procedure to compress each line of the pixmap using RLE (run length encoding), and call out to SDL for each run in the line. This drastically improved drawing speeds on larger grids. The following is a comparison between the two procedures, the leftmost picture is the rendered image, the middle picture is the optimized drawing procedure (draws each run instead of pixel), and the right most picture is the primitive drawing procedure (draws each pixel):

diff --git a/docs/posts/index.html b/docs/posts/index.html index 92e5869..028db12 100644 --- a/docs/posts/index.html +++ b/docs/posts/index.html @@ -27,7 +27,7 @@
- 04/04 — 2021 + 08/04 — 2021
SDL2 Devlog @@ -35,7 +35,7 @@ - 9.1 + 9.6 min -- cgit v1.2.3