I'm want to make an application for Galaxy Tab, that allows me to draw pictures... Something similar to MS Paint (don't ask my why :)) so the first steps are:
win = Ti.UI.createWindow({
backgroundColor: 'black',
exitOnClose: true
});
image = Ti.UI.createImageView({
width: 200,
height: 200
});
image.addEventListener('touchmove', function(e){
//And here I need somehow to draw a pixel on image at e.x, e.y coordinates
// How can i do it?
});
So, how should i draw a pixel?
sorry I have not read you full Question.
try This, this is a Titanium Appcelerator Module and this is absoultely free
It have also a easy example. You can use easy.
Again Really Sorry..
Related
I'd like to take a full resolution picture with nativescript camera module ... but i can't !
I know how to do that with cordova but not in nativescript :-( and all examples are with small res like 300x300.
const options = {
width: 300,
height: 300,
keepAspectRatio: false,
saveToGallery: true
};
I'm looking for something like "0x0" or no width and height options but if i try to put 4096x3072 (my camera resolution) the result is "out of memory".
Thanks
Try to use nativescript media file picker https://www.npmjs.com/package/nativescript-mediafilepicker Or nativescript camera plus https://market.nativescript.org/plugins/#nstudio%2Fnativescript-camera-plus for full screen camera.
I'm trying to upload a local image to a konvajs stage and then erase parts of the image that are not needed. My upload works well and the draw/erase work but I'm unable to erase the uploaded image. I can only erase the draw line over the image.
var stage = new Konva.Stage({
container: 'container',
width: width,
height: height
});
I have created a jsfiddle: https://jsfiddle.net/tommy6s/L3f27mch/
I read two stackoverflow posts similar to mine that featured a round eraser tip but I still could not figure out how to get mine to work.
Any help is appreciated. Thank you.
For this demo I was using separate <canvas> element for drawing canvas.
You can draw your image directly into canvas via context:
img.onload = function() {
context.drawImage(img, 0,0, width/2, height / 2)
layer.draw();
};
Demo
I'm trying to make the images on this page rotate, scale and change opacity all at the same time, like some images on this site do;
http://soyouwanttogotorisd.com/
And this is my site;
http://www.ducklingfarm.com
I'm using TweenMax, and this is my code;
$(document).ready(function() {
TweenMax.from( $('#homeImg'), .5,
{css:{scale:.05, opacity:0, rotation: 180}, ease:Quad.easeInOut}), 400,-400);
});
But nothing's happening...
Please help me!
Thanks!
Found an answer!
http://forums.greensock.com/topic/8480-scale-rotate-and-opacity/#entry33133
I used this code;
$(window).load (function(){
TweenMax.from( $('.homeImg > img'), 0.5,
{css:{scale:0.05, opacity:0, rotation: 180},
ease:Quad.easeInOut
});
});
Here is the problem :
I have a canvas, and four (would be more in future, but 4 for testing...anyway, doesn't matter) images that can be "poped" into the canvas by clicking on it.
Each image can be present multiple times in the canvas.
So far, poping is working fine, images are draggable... But I can't add some resize or zIndex function as I can only select the last image add to the canvas.
In a ideal world, I would like, by clicking/dragging an image, put it on top of the canvas, and kinda "select" it, so that I can connect the resize functions to the image.
But with the array of images, I can't manage to identify properly the item dragged, and can't use (or don't manage to use) the selectors.
Thank you.
EDIT : some code
var imgCpt = 0;
var image = [];
function addDetails(img) {
imgCpt++;
var imageObj = new Image();
imageObj.onload = function() {
image[imgCpt] = new Kinetic.Image({
x: 0,
y: 0,
image: imageObj,
draggable: true,
id:image[imgCpt]
});
image[imgCpt].setX((stage.getWidth()/2) - (image[imgCpt].getWidth()/2));
image[imgCpt].setY((stage.getHeight()/2) - (image[imgCpt].getHeight()/2));
eval(image[imgCpt]).on('click', function() {
alert(eval(imgCpt));
});
layer.add(image[imgCpt]);
stage.add(layer);
};
imageObj.src = 'uploads/'+img;
}
I've already tried different solutions : multiple layer, and acting on it instead of acting on image, working with shapes filled with image instead of image, but it's always the same problem : I can't get the id of the concerned element (instead of the id of the last insert element)
This version works with array, but I tried yersterday to build the image id with eval(); without more success.
Thank you for your help
EDIT² : sorry to insist, but I would really be glad to have some assistance on this point, even if I think it's more JS related than pure KineticJS related.
Thank you.
Ok Guys, just solved the problem :
eval("image["+imgCpt+"].on('click', function() {alert("+imgCpt+");});");
Instead of :
eval(image[imgCpt]).on('click', function() {
alert(eval(imgCpt));
});
Now time to set a true action behind the click.
Thank you for helping ;)
I have a main view, then on that view I have, as children, two labels and an image. I want the labels to flow one after another from the top of the screen and I want the image at the bottom. I get the labels to flow properly by setting layout:'vertical' in the main window. But once that is done, I can't seem to force the image to the bottom. Here is a snippet of my code:
var self = Ti.UI.createView({
backgroundColor:'#fff',
layout:'vertical'
});
var l1 = Titanium.UI.createLabel({
text:quote,
color:'#000',
shadowColor:'#ddd',
shadowOffset:{x:2,y:2},
font:{fontFamily:'Marker Felt',fontSize:24},
top:20,
left:15,
right:15,
height:'auto'
});
self.add(l1);
var l2 = Titanium.UI.createLabel({
text:author,
color:'#000',
shadowColor:'#ddd',
shadowOffset:{x:2,y:2},
font:{fontSize:16},
top:10,
left:15,
right:15,
height:'auto',
textAlign:'right'
});
self.add(l2);
var imgView = Titanium.UI.createImageView({
image:myimage,
setBottom:10,
height:100
});
self.add(imgView);
I have tried setting the image layout and that doesn't work. If I change the 'self' window layout to 'absolute' then I can't seem to get the labels to flow cleanly after one another. The first label is of variable height so I need them to follow each other.
I am using Titanium 1.82.
Thanks. In advance.
You might need to add another view. The 'base' view would have what you are calling 'self' added at top:0 and height: 'auto'
Then add imgView to 'base' with bottom: 10 (not setBottom like you have).
Just set the bottom:0; position: fixed; i think this will help u to set the image bottom of the screen.. If it still not working means try with Html,Css and Javascript for design it will be very easy.