We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Image tiling app
Page Index Toggle Pages: 1
Image tiling app (Read 588 times)
Image tiling app
Oct 18th, 2009, 3:27pm
 
Hello,

I am trying to make a basic image arrangement app so that I can dump in a set of images and then arrange them for a tiled image to be exported.

I am planning on using the SDrop library to have a group of tiles spaces where you can drag the images to be loaded for the individual tiles. My goal is to be able to pan the images in the tiles and scale them.

here are my issues:
- How can I mask out the area I don't want. Essentially I want to create a  set of windows (the number of which is defined by how many columns and rows are stated). But i don't want overlap

- How do I control the multiple image objects once they are brought in?

I am obviously fairly new to this and am still learning how to use OOP so the image excersize seemed like a good practice project.

thanks for any help anyone can offer.

here is where i am at. I have been trying to work on using an ArrayList to control the images which are loaded and named by the drop zone they enter into


import sojamo.drop.*;

SDrop drop;

int columns = 5;
int rows = 3;


MyDropListener m;
MyDropListener p;

void setup() {


 size(400,400);
 drop = new SDrop(this);
 p = new MyDropListener(10, 10, 160, 90, 0);
 drop.addDropListener(p);
 m = new MyDropListener(200, 10, 160, 90, 1);
 drop.addDropListener(m);
}

void draw() {
 background(0);
 m.draw();
 p.draw();



}


void dropEvent(DropEvent theDropEvent) {
}


// a custom DropListener class.
class MyDropListener extends DropListener {

 int myColor;
 int x;
 int y;
 int w;
 int h;
 int id;

 MyDropListener(int tempX, int tempY, int tempW, int tempH, int tempId) {
   x = tempX;
   y = tempY;
   w = tempW;
   h = tempH;
   id = tempId;

   myColor = color(255);
   // set a target rect for drop event.
   setTargetRect(x,y,w,h);
 }

 void draw() {
   fill(myColor);
   rect(x,y,w,h);
 }

 // if a dragged object enters the target area.
 // dropEnter is called.
 void dropEnter() {
   myColor = color(255,0,0);
 }

 // if a dragged object leaves the target area.
 // dropLeave is called.
 void dropLeave() {
   myColor = color(255);
 }

 void dropEvent(DropEvent theEvent) {
   if(theEvent.isImage()) {
     println("### loading image on dropZone "+ id);

   }

 }
}



Page Index Toggle Pages: 1