|
Author |
Topic: image + fill = black? (Read 986 times) |
|
Martin
|
image + fill = black?
« on: Apr 14th, 2003, 1:13pm » |
|
i'm not too sure if this is a bug but image doesn't work inside loop if combined with fill? Code:BImage img; color cc; void setup() { size(200,200); background(255); img = loadImage("joya.jpg"); } void draw() // this works { // noFill(); image(img,0,0); cc = getPixel(5,5); fill(cc); rect(80,80,20,20); } /* void loop() // this doesn't { image(img,0,0); cc = getPixel(5,5); fill(cc); rect(80,80,20,20); } */ |
|
|
|
|
|
Martin
|
Re: image + fill = black?
« Reply #1 on: Apr 14th, 2003, 1:48pm » |
|
c/o edwardgeorge... adding fill(255) at the end of the loop makes it work. hmmm, why is this so?
|
|
|
|
edwardgeorge
|
Re: image + fill = black?
« Reply #2 on: Apr 14th, 2003, 1:48pm » |
|
This works!!! Code:void loop() { image(img,0,0); cc = getPixel(5,5); fill(cc); rect(80,80,20,20); fill(255); } |
| ( beat to pressing post by Martin )
|
« Last Edit: Apr 14th, 2003, 1:49pm by edwardgeorge » |
|
Ed, Suppose, Nottingham, UK http://www.suppose.co.uk http://ed.suppose.co.uk
|
|
|
fry
|
Re: image + fill = black?
« Reply #3 on: Apr 14th, 2003, 2:36pm » |
|
in 52 (or maybe 53) we changed things so that fill() applies to images. that way you can colorize an image, or (perhaps more important) set the alpha level of the image so that it's partially transparent. unfortunately this has the side effect of folks needing to set the fill to white before drawing an image if they don't want any additional color or alpha applied.
|
|
|
|
benelek
|
Re: image + fill = black?
« Reply #4 on: Apr 14th, 2003, 3:42pm » |
|
it'd be cool if image(img,x,y,alpha) worked instead, and/or maybe even image(img,x,y,color)...
|
|
|
|
fry
|
Re: image + fill = black?
« Reply #5 on: Apr 14th, 2003, 5:04pm » |
|
interesting idea.. we'll give that some thought. or maybe soemthing in addition to stroke() and fill() to determine the color that gets applied to images. if we add color to the image() command, then there's half a dozen versions that we have to include, times the number of variations for the image() command, so that gets messy.
|
|
|
|
fry
|
Re: image + fill = black?
« Reply #6 on: Sep 19th, 2003, 5:42am » |
|
rev 0060 will use tint() to set the image color, or noTint() if you don't want to tint the image. it was way too confusing for everyone to have fill() suddenly coloring things. (i've just completed the code for this today, so it's all set to go)
|
|
|
|
|