|
Author |
Topic: bitmaps with alpha channel (Read 4017 times) |
|
toxi
|
bitmaps with alpha channel
« on: Apr 29th, 2003, 5:55pm » |
|
here's a little demo to show bitmaps with alpha channels. the trick is to store the mask externally in a 2nd image (e.g. a greyscale gif or jpg). i'm going to implement more blend modes like in photoshop or director's "inks", but that's a start. http://www.toxi.co.uk/p5/alphablit/ *click to switch to next blend mode, currently these are: multiply, add, substract, dissolve, darkest, lightest
|
« Last Edit: Aug 26th, 2003, 2:56pm by toxi » |
|
http://toxi.co.uk/
|
|
|
benelek
|
Re: bitmaps with alpha channel
« Reply #1 on: May 2nd, 2003, 3:24pm » |
|
in theory a nice idea... but it's a little wasteful to have two picture files just to display one image. in the world of desktop customization, DesktopX (desktopx.net) uses a similar idea, whereby a designer has to include a greyscale alpha map in the bottom half of each image in order to produce alpha effects. but it gets supremely annoying and inneficient, having to create two different versions of an image for one effect.
|
|
|
|
REAS
|
Re: bitmaps with alpha channel
« Reply #2 on: May 2nd, 2003, 5:23pm » |
|
To my knowledge, this is the way it has always been done. We just use tools and image formats that store the alpha masks in more hidden ways. Does anybody have more experience with this?
|
|
|
|
REAS
|
Re: bitmaps with alpha channel
« Reply #3 on: May 2nd, 2003, 6:25pm » |
|
Toxi, Is it OK to use this in the "Examples" section of the website. It's an example I was going to write but haven't and you've executed it better than I would have. + Casey
|
|
|
|
arielm
|
Re: bitmaps with alpha channel
« Reply #4 on: May 5th, 2003, 3:18pm » |
|
from a postmodern point of view, it is interesting to have a separation between the image and the alpha channel... then, you could have more than one alpha channel (call it "point of view") for the same image
|
Ariel Malka | www.chronotext.org
|
|
|
toxi
|
Re: bitmaps with alpha channel
« Reply #5 on: May 6th, 2003, 3:46pm » |
|
casey, of course you can... thanks! benelek, i agree it's not very elegant to store the alpha channel in a separate file, however considering, JPEG and GIF are the only supported fileformats in P5, i'm afraid that was the only way to realise this feature as neither of them allow for included alpha information. i'm going to extend the class asap, also to update the alpha channel independently from the main RGB data. this will allow for nice blending effects.
|
http://toxi.co.uk/
|
|
|
toxi
|
Re: bitmaps with alpha channel
« Reply #6 on: May 6th, 2003, 8:09pm » |
|
okay, i've now updated the class and implemented the following blend modes: - linear blend - additive blend (colour dodge) - substractive blend (colour burn) - dissolve - lightest - darkest to exclusively modify/overwrite the alpha channel only, use the setAlpha() method... here's the link again: http://www.toxi.co.uk/p5/alphablit/ click to toggle between blend modes! have fun!
|
http://toxi.co.uk/
|
|
|
benelek
|
Re: bitmaps with alpha channel
« Reply #7 on: May 11th, 2003, 5:12am » |
|
on May 5th, 2003, 3:18pm, arielm wrote:from a postmodern point of view, it is interesting to have a separation between the image and the alpha channel... then, you could have more than one alpha channel (call it "point of view") for the same image |
| perhaps a further retreat into postmodernity would loosen the rgb chanels too. perhaps even an applet which applies different transformations to different chanels...
|
|
|
|
arielm
|
Re: bitmaps with alpha channel
« Reply #8 on: May 11th, 2003, 11:43am » |
|
hi benelek, i think this time we will agree that a postmodern applet would be such that you could open its .class file in notepad and see at least one parenthesis with Deleuze and Guattari inside...
|
Ariel Malka | www.chronotext.org
|
|
|
benelek
|
Re: bitmaps with alpha channel
« Reply #9 on: May 12th, 2003, 1:49pm » |
|
who knows, maybe a critical .class file would even have an obfuscated angry feminist class.
|
|
|
|
arielm
|
Re: bitmaps with alpha channel
« Reply #10 on: May 12th, 2003, 7:27pm » |
|
i like this word: obfuscated!
|
Ariel Malka | www.chronotext.org
|
|
|
benelek
|
Re: bitmaps with alpha channel
« Reply #11 on: May 15th, 2003, 6:09am » |
|
lol, its a funky sounding word. but neway, i was thinking that all this alpha stuff really needs to be integrated into the p5 graphics stuff, because right now this manual alpha work can only really work (sort-of efficiently) in 2d. what about the use of images in a 3d setting?
|
|
|
|
benelek
|
Re: bitmaps with alpha channel
« Reply #12 on: May 15th, 2003, 6:19am » |
|
scratch that, an image's pixels[] array is an array of color objects, and should be able to hold alpha info as is, shouldnt it?
|
|
|
|
toxi
|
Re: bitmaps with alpha channel
« Reply #13 on: May 15th, 2003, 12:54pm » |
|
you can easily rewrite the code to store the alpha info in the topmost (and still unused) byte of each value in the pixel[] array. only reason why i didn't do it, is for performance reasons, as you'd have to do another bitshift operation for each pixel when drawing an image, but maybe in the end it's the more elegant (and RAM saving) solution... but i agree, it'd be great if ben+casey would integrate that alpha stuff into the core engine. it's not just important for eye candy
|
http://toxi.co.uk/
|
|
|
REAS
|
Re: bitmaps with alpha channel
« Reply #14 on: May 20th, 2003, 3:29pm » |
|
what kind of alpha do you want integrated into the engine? it's currently possible to make alpha polygons and images. it will be possible to have alpha lines in the near future. are you wanting the different blending modes such as disolve, lightest, darkest, etc. to be added to the core?
|
|
|
|
|