Giter Site home page Giter Site logo

pxl's Introduction

raster

This software should be considered pre-alpha. I am still working out the API and everything is subject to change.

A ClojureScript library designed to simplify interaction with raster graphics in HTML documents. This library provides functions for creating, manipulating, and displaying ImageData objects.

Project Goals

The library provides implementations of many ClojureScript protocols for ImageData so that you can use many existing functions such as map, filter, reduce, nth, get, etc.

Allowing versatile and idiomatic access to ImageData is the primary goal of this library.

Of secondary concern is performance. Whenever possible, efficient methods for operating on ImageData are choosen, but not to the detriment of a flexible API.

Usage

Creating an ImageData object

Create an ImageData object with the image-data function provided in vickaita.raster.core. You can pass it an img element, a canvas element, or a 2d canvas context.

(ns raster.example
  (:require [vickaita.raster.core :as r]
            [goog.dom :as dom]))

;; From an HTMLImageElement
(r/image-data (dom/getElement "an-img"))

;; From an HTMLCanvasElement
(r/image-data (dom/getElement "a-canvas"))

;; From a map literal
(r/image-data {:width 10
               :height 10
               :data (take 400 (repeatedly (partial rand-int 256)))})

dopixel macro

The dopixel macro operates on an image one pixel at a time.

(dopixel [[r g b a] img]
         [(+ 1 r) (+ 1 g) (+ 1 b) a])

License

Copyright © 2013 Vick Aita

Distributed under the Eclipse Public License, the same as Clojure.

pxl's People

Contributors

vickaita avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.