|
Author |
Topic: rotating/translating a blended image (Read 306 times) |
|
sspboyd
|
rotating/translating a blended image
« on: Jun 18th, 2004, 2:41am » |
|
Why won't a blend conform to translations and/or rotations? Am I missing something in the way blend is supposed to work? This code results in an appropriately 'substracted' image being placed in the upper left corner of the window. I would have expected it to be rotated around the middle of the window somewhere instead. Code:// blend translate/rotate test void setup(){ BImage src; src=loadImage("apt2.jpg"); size(src.width, src.height); translate(width/2, height/2); rotateZ(TWO_PI/3); blend(src,1,1,width/2, height/2, 0,0,width/2,height/2, SUBSTRACT); } |
| thanks, s
|
« Last Edit: Jun 18th, 2004, 2:43am by sspboyd » |
|
gmail.com w/ sspboyd username
|
|
|
kevinP
|
Re: rotating/translating a blended image
« Reply #1 on: Jun 18th, 2004, 7:38am » |
|
Hi, translate() does not work in the setup() function. And no parsing error. Frustrating, huh. -K
|
« Last Edit: Jun 18th, 2004, 7:40am by kevinP » |
|
Kevin Pfeiffer
|
|
|
sspboyd
|
Re: rotating/translating a blended image
« Reply #2 on: Jun 18th, 2004, 9:13am » |
|
ok. i am still finding however it doesn't work with loop, mousePressed, etc... Code:// blend translate/rotate test BImage src; void setup(){ src=loadImage("http://art.piw.ca/media/images/apt2.jpg"); size(src.width, src.height); } void loop(){ background(255); translate(width/2, height/2); rotateZ(TWO_PI/3); blend(src,1,1,width/2, height/2, 0,0,width/2,height/2, SUBSTRACT); } void mousePressed(){ background(255); translate(width/2, height/2); rotateZ(TWO_PI/3); blend(src,1,1,width/2, height/2, 0,0,width/2,height/2, SUBSTRACT); } void keyPressed(){ background(255); translate(width/2, height/2); rotateZ(TWO_PI/3); blend(src,1,1,width/2, height/2, 0,0,width/2,height/2, SUBSTRACT); } void mouseReleased(){ background(255); translate(width/2, height/2); rotateZ(TWO_PI/3); blend(src,1,1,width/2, height/2, 0,0,width/2,height/2, SUBSTRACT); } |
|
|
gmail.com w/ sspboyd username
|
|
|
TomC
|
Re: rotating/translating a blended image
« Reply #3 on: Jun 18th, 2004, 12:39pm » |
|
I think blend() doesn't currently work like image(), it's more like replicate(). Perhaps this should go into suggestions?
|
|
|
|
sspboyd
|
Re: rotating/translating a blended image
« Reply #4 on: Jun 18th, 2004, 7:00pm » |
|
Is there a reason why blend and replicate work this way? I'd like to know so I can make better use of them. Can anyone suggest other ways of transforming/rotating blends and replicates? steve
|
gmail.com w/ sspboyd username
|
|
|
JohnG
|
Re: rotating/translating a blended image
« Reply #5 on: Jun 18th, 2004, 8:08pm » |
|
You can use outside of functions: Code: and in one of your functions.. mousePressed or whatever: Code: newimg=blend(src,1,1,width/2, height/2, 0, 0, width/2, height/2, SUBSTRACT); |
| then you can just do image(newimg,0,0); to display the blended image.
|
|
|
|
sspboyd
|
Re: rotating/translating a blended image
« Reply #6 on: Jun 18th, 2004, 8:38pm » |
|
excellent. thanks!
|
gmail.com w/ sspboyd username
|
|
|
sspboyd
|
Re: rotating/translating a blended image
« Reply #7 on: Jun 18th, 2004, 9:35pm » |
|
I was having some trouble with your example code until I changed it from Code: to Code:
|
« Last Edit: Jun 18th, 2004, 9:35pm by sspboyd » |
|
gmail.com w/ sspboyd username
|
|
|
|