https://github.com/hansemannn/ti.glpaint
Support for OpenGL drawing in Titanium.
https://github.com/hansemannn/ti.glpaint
appcelerator javascript native opengl titanium
Last synced: about 1 year ago
JSON representation
Support for OpenGL drawing in Titanium.
- Host: GitHub
- URL: https://github.com/hansemannn/ti.glpaint
- Owner: hansemannn
- License: other
- Created: 2016-04-09T20:22:40.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-03-21T15:44:50.000Z (over 9 years ago)
- Last Synced: 2025-03-29T01:12:13.725Z (about 1 year ago)
- Topics: appcelerator, javascript, native, opengl, titanium
- Language: Objective-C
- Homepage:
- Size: 965 KB
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ti.GLPaint
> This module is still work in progress. The opacity currently cannot be changed and the image needs to be placed inside the module directly.

## Usage
```js
var module = require("ti.glpaint");
var win = Ti.UI.createWindow({
backgroundColor: "#fff"
});
var paintView = module.createPaintView({
brush: {
opacity: 10,
tintColor: "red",
image: "brush.png"
},
top: 100
});
paintView.addEventListener("touchesBegan", function(e) {
Ti.API.info('Touches began');
Ti.API.info(e);
});
paintView.addEventListener("touchesMoved", function(e) {
Ti.API.info('Touches moved');
Ti.API.info(e);
});
paintView.addEventListener("touchesEnded", function(e) {
Ti.API.info('Touches ended');
Ti.API.info(e);
});
var btn1 = Ti.UI.createButton({
title: "Change to green color",
top: 30
});
var btn2 = Ti.UI.createButton({
title: "Erase",
top: 50
});
btn1.addEventListener("click", function() {
paintView.setBrush({
opacity: 5,
tintColor: "green",
image: "brush2.png"
});
});
btn2.addEventListener("click", function() {
paintView.erase();
});
win.add(paintView);
win.add(btn1);
win.add(btn2);
win.open();
```
## Copyright
© 2016 by Hans Knoechel