Le 06/02/2012 21:19, tobias a écrit : > hi, > > Benoît Minisini wrote: >> Le 04/02/2012 01:19, tobias a écrit : >>> On 04.02.2012 01:12, tobias wrote: >>>> Hi, >>>> >>>> I really need help. There's a lot of work with colors in Images and >>>> Pictures in a project and between these classes. This is generally >>>> speaking as follows: I have a class which has an 8*8px Image which is >>>> manipulated (due to the easy of accessing pixels directly). Using a >>>> property of my class, I provide access to a scaled version of the Image >>>> as a Picture (which is created when requested). So I do some things and >>>> when manually resizing the Image to get the prototype of the Picture to >>>> return (it is needed as bigger version of the Image without >>>> anti-aliasing, I don't get this result with Image.Stretch(), and doing >>>> it manually is not a problem) there seem to appear problems with >>>> transparency. I read that Pictures do not have an alpha channel and I >>>> noticed that colors from the ColorChooser or Color class are given with >>>> alpha channel set to 0x00 which will be transparent for the Image >>>> class... so I tried adding&Hff000000& to whatever color is assigned to >>>> any pixel in the 8*8px Image or not to do it and some other experiments >>>> but nothing worked on the entire project. there's always something >>>> transparent or black or whatever. I really go nuts with this. Anyone to >>>> my rescue? >>>> >>>> Regards, >>>> Tobi >>> wait a minute. I forgot to say that I don't even need the transparency >>> feature of the Image class. I only use Image - as I said - because of >>> Image[x, y] pixel access. For the meantime - or as a final solution? >>> there may be a lot of those accesses and I thought using Image[x, y] >>> will be the most efficient way to go - I switch to using an 8*8px >>> Picture and Draw.Pixel() instead but I would really appreciate anyone >>> clarify this topic to me. >>> >> >> I understand nothing. Maybe because I'm a little sick, but if you can be >> clearer... >> > > it's a messy explanation, i just recalled too... > > the situation is as follows: i have a class that takes care of designing > a picture for me according to user input. because of the ease of > accessing pixels with the image class i took an image behind the scenes > but it has to be converted to a picture for display in a PictureBox at > the front end. moreover it has to be resized which i do manually and is > no big deal for my format. i used to import pictures and images into the > class, etc. which overall introduces as big back and forth of image<-> > picture conversion, resizing, etc. > the problem first came up when i incorporated palettes created by > another program and stored in binary files. i noticed that these were in > ARGB format with the A component set to 0x00 all the time (colors came > from a ColorChooser, later i noticed that the constants in the Color > class do likewise). while this works (color is displayed) when drawing > it to a picture, it doesn't when writing it to an image pixel. i tried > conversion functions and everything that came in my mind. > at the end i rewrote the class to use pictures. those pictures are > created with the Transparent = False instanciation parameter. from those > i can derive Picture.Image on which i operate to speed things up. > this is sort of solved and the program works fine now. > > i seem to repress the memory of what i tried (pathetic programmer's > brain :) ) but i can tell that nothing worked on the entire project > (which was certainly a fault due to my quick fixes or project > infrastructure) but to clarify things: > it resulted in transparency in all kinds of places in the whole program > originally introduced by reading colors from standard components that > had their alpha channel zeroed which according to the docs signaled the > image class that this color is fully transparent. > > i hope it didn't get as complicated but recalling the situation pointed > me to the fact that actually i do not know why it is working now (seems > to rely on the Transparent = False picture instanciation?)... > > regards, > tobi >
Mff... If you need to create a Picture, start from an Image, and convert it to a Picture at the last step. Do not use the Transparent property of Pictures. As for transparency: it is inverted between pixels in memory and Gambas color values. If you use the Image class and the [] operator, then this is taken into account transparently. This is all I can say: I hope it will help you! -- Benoît Minisini ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user