Git Product home page Git Product logo

canvas-drawer's Introduction

canvas-drawer

Implements a simple drawing api

Featured Image

How to build

Windows

Open git bash to the directory containing this repository.

canvas-drawer $ mkdir build
canvas-drawer $ cd build
canvas-drawer/build $ cmake -G "Visual Studio 16 2019" ..
canvas-drawer/build $ start Draw-2D.sln

Your solution file should contain two projects: pixmap_art and pixmap_test. To run from the git bash command shell,

canvas-drawer/build $ ../bin/Debug/draw_test
canvas-drawer/build $ ../bin/Debug/draw_art

macOS

Open terminal to the directory containing this repository.

canvas-drawer $ mkdir build
canvas-drawer $ cd build
canvas-drawer/build $ cmake ..
canvas-drawer/build $ make

To run each program from build, you would type

canvas-drawer/build $ ../bin/draw_test
canvas-drawer/build $ ../bin/draw_art

Supported primitives

  • LINES
    • Interpolation between two vertices with individual stroke color/alpha/width attributes
  • TRIANGLES
    • Joins three vertices into three lines with per-vertex fill color and alpha
  • QUADS
    • Joins four vertices into two triangles
  • FANS
    • Joins $n$ vertices into a polygon made of $n-1$ triangles. First vertex specifies the central vertex where all triangles meet.

Added Functionality

  • Quads
  • Triangle Fans
  • Add and subtract blend modes
  • Alpha blending

Results

Featured Image

Background color gradient uses a triangle fan to specify colors at specific points and is blended over the triangles using alpha blending. Rectangles are implemented with a QUAD primitive and use the subtract blend mode. The central sphere is a triangle fan with per-vertex shading.

canvas-drawer's People

Contributors

isaacwasserman avatar alinen 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.