-
Re: Surface Object
Hehe, no. GetRGB(r,g,b) actually just returns r + g*256 + b*256*256.
It may sound a bit confusing, but that way you can store all RGB colors in a single numbers. So GetRGB is just a number.
By the way, you should use the Image > Pixel is equal to color? condition for the same job!
-
Re: Surface Object
Thanks Looki. Sounds easier, hehe. Math is my weak side :)
Another question, is there a way to extract the alphachannel?
-
Re: Surface Object
Save the image as a PNG and use the alpha channel object to do what you wish with the alpa channel? ;)
-
Re: Surface Object
As of now there's no way to remove it - I really should add that.
Extracting an alpha channel is easy :)
You'll have to use multiple images.
Add a new image with the size of the old image.
Then, set the editing image to LastImage( "Surface" )
(that's the index of the newest image)
Now, you can use "Blit > Onto the surface > Alpha channel". Enter the index of the image whose alpha channel you want to extract and you're done.
-
Re: Surface Object
Ah, i was too slow with editing it seems :D
Just to clear confusion, i had asked if there is a way to remove the alpha channel, but changed my mind then. I found that to remove the alpha channel i could simply use clear alpha with 255. Makes at least the image opaque, even when the alpha channel is still there :)
A feature to remove the alpha channel would be even neater though. 24 Bit vs 32 Bit ;)
Thanks for the help with the other question. Brings me one step further to what i want to achieve :)
-
Re: Surface Object
Instance problem. When i create a surface object then i have two surface objects in the frame with the same name. I`m in trouble to reach the second instance then. It works in the condition line where i create the surface object. But how do i separate them then in further code? Is there a solution?
Another instance problem. How do i save Image 2 when i work with multiple images? I/O Save to File lacks of a way to define which image to save. First image gets saved :)
-
Re: Surface Object
Hm, not sure if this is not an MMF issue. Thanks to your advice i made a little application now to extract the Alpha channel. Works like charm. Where i was stopped is that after extracting the Alpha channel part with black 0/0/0 stayed transparent. I tried to change the transparent colour, but no success.
I have solved it by replacing the black 0/0/0 with 1/0/0 then.
Commented example is attached. Feel free to use and modify it for your docs. Maybe some of the other guys can also add a few examples to fill your example folder. Surface Object is pretty complex. The more examples the better it is :)
http://hotfile.com/dl/52255928/524bb...annel.rar.html
-
Re: Surface Object
Bug. Copy a image that contains white 255/255/255 by using the clipboard. And you will get transparent areas where the white 255/255/255 was. Regardless of the transparent colour.
Examplefile attached: http://hotfile.com/dl/52263392/1be5c...rdbug.rar.html
Correction, just being stupid. First change the transparent colour, then load from clipboard. This counts also for normal file loading.
Remains the transparent colour. Why is it white 255/255/255 when MMF uses 0/0/0 anyways? May i suggest to change the transparent colour to black 0/0/0 by default? :)
-
Re: Surface Object
Hopefully it's ok but i suggest using the MFA Repository instead of quick hosting sites that have a 50 second wait and need scripts to download etc. It is designed for MMF project hosting so much better for the forums, the link is on the right in Community Links.
Anyway the 0,0,0 thing is a default problem (in my opinion) that MMF does at default, i am not sure about 255,255,255 but maybe it works in a similar way. It is as far as i know used for game sprites with a replace color and is automatically set so it causes problems for everything else sadly. Maybe looki could make some custom function to replace it with true black instead. I say this because even though you can fake the look of black with a very similar color it means you can never do a true graphics app without workarounds.
This way you also need to know the colors your using if some image being used then used a transparent color or the one you use to replace with so it can be a problem. If not possible in the runtime display it would be a nice option for when saving out images so it asks you of you want to use that as a solid color or set as transparent.
-
Re: Surface Object
Well, you`re right. I could of course also post it in the file archive, in case the file is not too big. The reason why i post it via file hoster is that the file is directly available in the thread now, and it is out of the way for people that searches for useful example files. Betastuff doesn`t really belong into the file archive. Plus it wouldn`t be the first time that my file is too big :)
I never understood why it isn`t allowed to attach examples in other sections too. I mean, it makes filesizewise absolutely no difference if the file is in the file archive or in the thread where it belongs to. Only that in the second case the file is where it needs to be. Well, yeah, file archive is a good place for examples that are useful for everybody. And then everything is in one section for further search. But this is a betatestfile. And the forum search is a mess anyways.
Maybe we could make a petition to allow attachments in the extension development section too? :)
Back to topic. 255 white is no real good choice for transparent colour. In nearly every app 255 gets handled as completely opaque. And in my case i simply stumbled across it because i thought it is a bug. Maybe a settings thingie would be helpful here too. That way you can setup the transparent colour without the need of code :)