I am trying to understand pixel arrays. I understand how to load them, manipulate them, and update them, but what exactly is inside this array. If I println() on every pixel I get a really big negative number. Can you point me to some reading material on this? What does this number mean and how does it store the pixel data?
I have a .csv file that has strings (locatoin names and urls) as well as floats and I want to import these into an array. I've seen
this post, which creates a float array.
From the post above, I made two separate arrays, but I am wondering if there's a more efficient way of doing this.
Is it possible to use a Google Street View Image in a Processing sketch? The API url isn't actually for an image, so I'm guessing that Processing doesn't understand how to interpret the response it gets.
I am building a map drawing app and I want to draw train tracks on the map (a line with intersecting perpendicular lines), but I'm having trouble with the math. I know that I need to do some Pmouse calculations to rotate and space the lines properly, but I haven't done this kind of math in ages. My two problems are:
1. I don't know how to rotate the perpendicular lines with the mouse direction.
2. I don't know how to space the perpendicular lines evenly (every 5px, for example).
I have an array list that gets populated when you add objects to the screen. I want to be able to select one object and move it up or down through the array list so that the object is moved to the foreground or background (changing the z-index, more or less). I found an old forum post and modified the code to make something work.
The code below sort of does what I want, but not really. In the if(key=='q') section it moves the selected item to the back and moves the 0 item to the front. I don't want the 0 item moved to the front, I want every following item in the index to move up one.
In the if(key=='w') section it moves the selected item to the front and removes the highest indexed item. Don't want that either.
I have written an object class that has all the characteristics I want, now I want to reuse if a bunch of times with different PImages. Here's what it looks like:
class ShapeMove
{
int x;
int y;
int h;
int w;
int origx;
int origy;
int deltax;
int deltay;
int posXdiff;
int posYdiff;
int xdragdelta;
int ydragdelta;
boolean locked = false;
boolean imCaptured = false;
boolean selected;
// boolean overMe = false;
//
ShapeMove(PImage lamppost, int _x, int _y, int _w, int _h)
{
x = _x;
y = _y;
h = _h;
w = _w;
}
... a bunch of stuff about moving and resizing ...
void display()
{
image(lamppost, x, y, w, h);
}
}
As it stands, if I want to add a new object with a different PImage, I have to duplicate the whole class and rename it. I don't want to do that. I think there is a way to to this where the constructor calls for "String filename", but I'm not sure. Alternatively, I could make a child class, but I don't know how to do that yet.
How do I use different PImages for different instances of my ShapeMove object?
I have written a small program that allows you to manipulate objects with the mouse and some key strokes. I want to start with a blank canvas with a button. When you click on the button a new ShapeMove is added to the canvas. I feel like this should be pretty simple, but I'm stumped.
Here's my code so far. Sorry it's so long. The button class is at the very bottom. I'm using PImages but in this example it's all rectangles.
I'm really new to programming and I need a bit of help. I want to write an app that has a bank of elements (PImage or Shape elements) on the left and a background image on the right. I want to be able to click on the elements on the left to add them to the image one at a time (or drag it on to the canvas), and I want to be able to resize the elements individually.
Is Processing capable of this? I know that might sound confusing, so I'll start with just one question. In this example have commented out the images and replaced them with rectangles. I want to be able to manipulate each rectangle individually, without affecting the other one. In my app, I want these to be images (.png) rather than shapes.
Now that I've typed this out. I feel like I should be able to answer my own question, but I'm stumped. Maybe I've been looking at this too long.