Skip to content

Instantly share code, notes, and snippets.

@magthe
Created Apr 11, 2016
Embed
What would you like to do?
Quil load-image failing
(ns bg.core
(:require [quil.core :as q :include-macros true]
[quil.middleware :as m]
[bg.image :as i]))
(enable-console-print!)
(println "bg.core loaded")
(defn setup []
(let [img (q/load-image i/img)]
{:img img}))
(defn draw [s]
(q/background (:img s)))
(q/defsketch bg
:host "thecanvas"
:size [100 100]
:setup setup
:draw draw
:middleware [m/fun-mode])
(ns bg.image)
(def img "data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCABkAGQDAREAAhEBAxEB/8QAHgAAAgICAwEBAAAAAAAAAAAABwgABgUJAwQKAQL/xABDEAACAQIEBAIHBAYHCQAAAAABAgMEBQAGBxEIEhMhQVEJIjFxgZGhFDJCYRUjUmJysRYkM1NzkqIYNDVDVGOTstH/xAAcAQACAgMBAQAAAAAAAAAAAAAABgUHAgMEAQj/xAA7EQABAwICBggEBAYDAQAAAAABAAIDBAURMQYSIUFhoRMiUXGBkbHRFCPB4TJCUmIHFTM0kvAkJfFy/9oADAMBAAIRAxEAPwDVVgQpgQmK4ReBzVzi+utXPlR6Sw5Ts9RFBdcx3JHMCOzIXgpkUb1FSsTGTp7ogHIJJI+pGWELbJoJ6L/hZ0XttPPf8oQ6jZi6W1Vc80QrU07M0cayLDQnenjj50Z051llTqMOqwAwITI5q1O0+yOpXM+a7dQuo7QNKGl+Ea7t9MSFJaqyu/t4yR27vPJc81XBT/1HAIZ3PjG0koXMdEl5uBH4oaQIp+LsD9MT0WhdyeMX6re8+wUc++UrcsT4LoQ8amm0jhZ7Bf4l/a6UTfQPja7QiuA2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6Wljo4+jj/8AVpQ9I7xx03FbnKgyfp8tXT6dZQqJnoZpXlie91bAIa2WAkKiKoZYFZeqqSysxUzGKOQXSk2wIUwIVgyBn/OWlmcrTqDp9mGrseYbHUCpoa6mI54n2IIIIKujKWR0YFHRmVgysQRC3ZcFvpMtOeJLbJWpC2vIWfozTQ09NUXBRQ32STpxn7E8nKVmM78q0jF5OVoyjzESGMQmb1B0ZyLqQjS3q29CvA2SuptkmHlufYw/JgcQ1zsVFdRjM3B36hsP38Vw1dugrNrxt7Rml8zXwjZ3tjvLla50d4pxuVR26E23lsfVPzwjVmhVZCSaZwePI+3NL09gnZtiIcPIocXLR7VG0uUrMi3f1fxRU5lX5puMQMtjuMJwfC7wGPoo19vqo/xRldGHTjUCofpw5JvjMe232GT/AOY0ttVc44CF3+JWAo6g5MPkVarDw5at3113y0bfE3tkrpViAH8PdvpiRptFrpUH+nqj9xw+66orPVy/lw70Zci8I2X7XJHXZ4uzXaVdj9kpwY4N/Jj95vphst2hUEJD6x2uewbB7nkpqlsEbOtOdbhuRPz1qFpPoHkhsyZ7zNY8nZboVaOOSqlWFHdY3k6MMY9aaYpFIVijVpH5Tyqxw6xRRwMEcQAA3BTzGNjbqsGAWlXjj9I7nLitp10+yfaKvJ+nVPUNLNQvVCSrvbpKTBLWFAFRFURuKZS6LLuzSSlYjHsWSTbAhTAhTAhTAhTAhM7oD6Rvik4erXFluw5vps0ZdpoRBSWbNMUldBRqqRxxiCRXSeJESJVSFZRCoZiI9zvgQvQT7MCF9HfAhQ9hgQp47YEJHvSc8Y2rnCjasj2/SaGwx1GdoL1DUV9wo3qJ6FqcUgilp16gi5walz+tjkUlV9XbcEQtMepequo+smap866pZ0uuZr1Ucy/abhUGToxtI8nRhT7kMIeSQrFGFjTmIVQO2BCquBCmBCmBC//Z")
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="app">
<h2>Example</h2>
<center>
<canvas id="thecanvas"
width="100px" height="100px"
style="border: 1px solid;"
/>
</center>
</div>
<script src="js/compiled/bg.js" type="text/javascript"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment