Skip to content

Instantly share code, notes, and snippets.

View shawnlau's full-sized avatar

Shawn shawnlau

View GitHub Profile
@shawnlau
shawnlau / gist:f465a6c17f5fa3fb3fa2
Last active April 15, 2017 09:37
Latest incarnation of a processing program that allows real time screen filtering
/////////////////////////////////////////////
//Update 10 -05-15
// Up and down arrows control the flow rate of the brush for the tool you are using. (new) Now each tool has its own flow rate
// (new)The strength off the tool in current use displays in the title bar. 1 is the strongest, 500 the lightest
// Hold shift and drag the mouse to change brush size, or use the "[" and "]" keys.
// press Control while in paint mode to pick up a paint color. Press control while in clone mode to
// to set clone position. Keypad "+" zooms up. Keypad "-" zooms down. Keys "z" and "x" control the mouse easing.
// The onColor mode allows you to just draw on the color of the image. The "add Frequencies" menu item becomes enable
// only when frequencies have been separated. To separate frequencies, go to settings screen and choose a separation method.
// Blur, SNN, median etc. Set the radius. Then you must click the menu item "Separate frequencies."
import codeanticode.tablet.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.*;
import java.awt.*;
import java.awt.datatransfer.*;
import javax.imageio.*;
@shawnlau
shawnlau / Canvas23
Last active August 29, 2015 14:27
The idea of this Processing program is to be able to paint on an image while displaying it in different ways.
/* The idea of this progam is to be able to paint on an image while it is displayed in different ways.
Eventually, it will have its own filters to manipulate the differnet layers. But right now, you weould have
use another program to filter your image in different ways and load them into other layers using the "b" key.
When you paint on one layer, you paint on all the layers with colors lifted from each specific layer.
There's an enhance mode ( "e" key) that allows you to change the contrast and brightnest of the displayed
image, but it doesn't affect the real pixel values. This will stutter the paint function slightly ( wish I could find
a quicker check for 0 and 255), but it will be needed to work in the high frequency ( small details) mode. I've edited out
the tablet pressure inputs so if you don't have a tablet, just commment out the import of the tabliet library.
This runs really bad on Processing 3 beta. Maybe someone can tell me why it runs better on Processing 2 than Processing 3.
/*************************
All of this hotkeyed at the moment. This version only draws with a pen tablet, it won't draw with a mouse. If you are familiar with
the porcessing language, you can edit the mouse functions to take a constant pen pressure.
L loads and image that will go to all 4 layers
B loads and image ( its should be the same dimensions as the other layers) to the active layer.
S saves the active layer. Its flakey right now, the file must exist alreasy for it to be saved.
"+" ( keypad or shift = zooms the image
"-" zooms down
"x" zooms to original size
Hold space key and drag to move image around the window