Android 2D Canvas Lightning Talk @ GDG Philly

The book Android 2D Graphics with Canvas API, by Karpenko is a wonderful little book about drawing on Android.   Over the past couple of days I've focused on working through it and gaining some insight into high-level graphics on Android.

The book is almost entirely focused on drawing, which is both a positive and a negative.   I'm still looking for something that covers gestural interaction with the graphics, but this is a good foundation in just putting shapes on screen.

Anyway, I highly recommend you check out the book, and have a look at this project to see some of the exercises in a working app.

 

Combining what I learned from the book with some things I already knew about motion events on Views, I was able to make the following little demo that implements picking and motion.  See the InteractivityDemo at the top level of the repo for code.  This is working towards being able to go back through some academic graphing research and starting to try and replicate some of that work.

Untitled2.gif
Untitled2.gif

I also spent some time working through some of the examples in Kevin Brothaler's recent book about OGL.  Having just finished studying up on Canvas, my overriding feeling working with GLES20 is that to accomplish what I am trying to accomplish in data visualization, I'd probably end up attempting (badly) to implement something like Canvas2D on top of GLES20 anyway.  "Don't roll your own" is a common refrain among developers (especially with respect to crypto, maybe it also applies to graphics)  so I think for now, at least until I run up against a limitation of the higher level library, I'll be working in Canvas3D.   There is some good precedent for this, as the MPAndroidChart library seems to be entirely built on Canvas, not GLES20.

Anyway, Brothaler's book was a cool intro to Android OpenGL, and I highly recommend it.