Hi,
Sorry, I should have elaborated, this is in reference to web development, all of this is to be done in a web page.
I ran across an interesting problem, as I am attempting to make a funky effect in javascript.
I can load an image, such as a PNG, which has transparency. For example :
Now, this image has both transparency (alpha) information, and of course, colour information (it is a simple #0f0 or full green solid colour, with an inverse transparent radial gradient cut out of it).
Now, the interesting thing is, I can pop this image into a div, either using a <img> tag or as the background of a div, either way will display the image wherever I place the div. However, if I decide to assign a background colour to it (for example, red #f00) it will make a single div, fill it with the colour red, and then apply the the image on TOP of the div.
So basically we have
SOLID BACKGROUND COLOR + SEMI-TRANSPARENT IMAGE = FINAL DIV CONTENTS.
Now, I though of a nice little project for myself, but it requires an arbritrary coloured "particle". As far as I can tell, there are 3 ways of doing this :
1) I could make a single PNG for each and every permutation. With 16 million colours, however, this doesn't seem really feasible to have 0f0.png etc etc
2) I could write a piece of PHP using the gd library to autogenerate a png using a simple couple of functions, so that if I wanted particle f14.png it would autogenerate it and pass it to the browser.
The biggest problem with this is, for each and every single particle I produce, I have to talk to the server and get it to generate it, which is horrendously heavy on the server, not to mention wastes tons of bandwidth.
3) I could somehow use a png such as
as a MULTIPLICATIVE mask rather than an ADDITIVE mask, so that I could set the background using
bgcolor : #f00 url(whiteinner.png);
and instead of making the background #9fc and then pasting the white particle over the top of it, producing a red square with a white dot, it would actually use the PNG to become a simple red dot, like
The model for this would be
SOLID BACKGROUND COLOR * SEMI-TRANSPARENT IMAGE = FINAL DIV CONTENTS
Does anyone know if anything like this is possible, or am I approaching this in the wrong way?
Sorry, I should have elaborated, this is in reference to web development, all of this is to be done in a web page.
I ran across an interesting problem, as I am attempting to make a funky effect in javascript.
I can load an image, such as a PNG, which has transparency. For example :

Now, this image has both transparency (alpha) information, and of course, colour information (it is a simple #0f0 or full green solid colour, with an inverse transparent radial gradient cut out of it).
Now, the interesting thing is, I can pop this image into a div, either using a <img> tag or as the background of a div, either way will display the image wherever I place the div. However, if I decide to assign a background colour to it (for example, red #f00) it will make a single div, fill it with the colour red, and then apply the the image on TOP of the div.
So basically we have
SOLID BACKGROUND COLOR + SEMI-TRANSPARENT IMAGE = FINAL DIV CONTENTS.
Now, I though of a nice little project for myself, but it requires an arbritrary coloured "particle". As far as I can tell, there are 3 ways of doing this :
1) I could make a single PNG for each and every permutation. With 16 million colours, however, this doesn't seem really feasible to have 0f0.png etc etc
2) I could write a piece of PHP using the gd library to autogenerate a png using a simple couple of functions, so that if I wanted particle f14.png it would autogenerate it and pass it to the browser.
The biggest problem with this is, for each and every single particle I produce, I have to talk to the server and get it to generate it, which is horrendously heavy on the server, not to mention wastes tons of bandwidth.
3) I could somehow use a png such as

as a MULTIPLICATIVE mask rather than an ADDITIVE mask, so that I could set the background using
bgcolor : #f00 url(whiteinner.png);
and instead of making the background #9fc and then pasting the white particle over the top of it, producing a red square with a white dot, it would actually use the PNG to become a simple red dot, like

The model for this would be
SOLID BACKGROUND COLOR * SEMI-TRANSPARENT IMAGE = FINAL DIV CONTENTS
Does anyone know if anything like this is possible, or am I approaching this in the wrong way?
Last edited: