emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/pacmacs 52f1ba4237 366/472: Regenerate gradiate for walls


From: ELPA Syncer
Subject: [nongnu] elpa/pacmacs 52f1ba4237 366/472: Regenerate gradiate for walls (#138)
Date: Thu, 6 Jan 2022 21:59:40 -0500 (EST)

branch: elpa/pacmacs
commit 52f1ba4237a369707ffae651c910c55f48b83f81
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>

    Regenerate gradiate for walls (#138)
---
 pacmacs-image.el | 32 +++++++++++++++++++++++---------
 pacmacs.el       |  2 +-
 2 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/pacmacs-image.el b/pacmacs-image.el
index 8e67b91338..81c9635d92 100644
--- a/pacmacs-image.el
+++ b/pacmacs-image.el
@@ -33,10 +33,7 @@
 ;;; Code:
 
 (require 'dash)
-
-(defconst pacmacs--wall-palette ["#1111bb"
-                                 "#3333dd"
-                                 "#5555ff"])
+(require 'color)
 
 (defvar pacmacs--wall-blocks
   (make-hash-table))
@@ -78,14 +75,22 @@
                  (format "\"%c c %s\",\n" (+ index ?a) color)))
          (apply #'concat))))
 
-(defun pacmacs--bits-to-xpm (bits width height)
+(defun pacmacs--color-hex-gradient (start stop step-number)
+  (-map (-lambda (color)
+          (apply #'color-rgb-to-hex color))
+        (color-gradient
+         (color-name-to-rgb start)
+         (color-name-to-rgb stop)
+         step-number)))
+
+(defun pacmacs--bits-to-xpm (bits width height palette)
   (concat
    "/* XPM */\n"
    "static char *tile[] = {\n"
    "/**/\n"
-   (format "\"%d %d %d 1\",\n" width height (1+ (length 
pacmacs--wall-palette)))
+   (format "\"%d %d %d 1\",\n" width height (1+ (length palette)))
    "\"  c None\",\n"
-   (pacmacs--generate-xpm-palette pacmacs--wall-palette)
+   (pacmacs--generate-xpm-palette palette)
    "/* pixels */\n"
    (mapconcat
     (lambda (row)
@@ -121,7 +126,7 @@
         cached-tile
       (puthash cache-index
                (let ((wall-block (make-vector width nil))
-                     (weight 3))
+                     (weight 15))
 
                  (dotimes (i width)
                    (aset wall-block i (make-vector height nil)))
@@ -150,10 +155,19 @@
                  (when bottom
                    (pacmacs--put-horizontal-bar wall-block (- height weight) 
width weight))
 
-                 (create-image (pacmacs--bits-to-xpm wall-block width height)
+                 ;; (dotimes (row height)
+                 ;;   (dotimes (column width)
+                 ;;     (when (zerop (mod (+ row column) 2))
+                 ;;       (aset (aref wall-block row) column nil))))
+
+                 (create-image (pacmacs--bits-to-xpm wall-block width height
+                                                     
(pacmacs--color-hex-gradient "#5555ff" "#000011"
+                                                                               
   weight))
                                'xpm t))
                pacmacs--wall-blocks))))
 
+;; (clrhash pacmacs--wall-blocks)
+
 (provide 'pacmacs-image)
 
 ;;; pacmacs-anim.el ends here
diff --git a/pacmacs.el b/pacmacs.el
index 03356b11d1..a7e3882b94 100644
--- a/pacmacs.el
+++ b/pacmacs.el
@@ -120,7 +120,7 @@
 
 (defun pacmacs--load-current-level ()
   (pacmacs--load-map (aref pacmacs-levels
-                          pacmacs-current-level)))
+                           pacmacs-current-level)))
 
 (defun pacmacs--load-next-level ()
   (setq pacmacs-current-level



reply via email to

[Prev in Thread] Current Thread [Next in Thread]