Is there a clever and fast way to turn an array of RGB triads (each slot taking on uint8 values from 0-255) into a Form, or better yet treat it directly as a Form? If I understand ColorForm correctly, it uses a map and the image "pixels" are indexes into same. In this case, I would allocate a block of memory, hand it to a library, and it would blast the RGB values all over it. Do we have a ready way to use the result w/o having to loop over the individual values?
I am working on an interface to PLplot (http://plplot.sourceforge.net/). It is working, but so far only if I save files to disk, which I would like to not *have* to do. Sometimes (batches in particular), it makes sense to let the code that creates a graph save it, but I also like to do a lot of interactive plotting that should not have to hit the disk. Bill |
Some searching did not turn up an answer, but I might be able to let the library "think" in 24 bbp, and then use a C function to expand the result into 32 bbp for Pharo. Would the alpha value be 255??
Bill ________________________________________ From: [hidden email] [[hidden email]] On Behalf Of Schwab,Wilhelm K [[hidden email]] Sent: Sunday, September 19, 2010 10:55 AM To: [hidden email]; [hidden email] Subject: [Pharo-project] RGB (0-255) image format? Is there a clever and fast way to turn an array of RGB triads (each slot taking on uint8 values from 0-255) into a Form, or better yet treat it directly as a Form? If I understand ColorForm correctly, it uses a map and the image "pixels" are indexes into same. In this case, I would allocate a block of memory, hand it to a library, and it would blast the RGB values all over it. Do we have a ready way to use the result w/o having to loop over the individual values? I am working on an interface to PLplot (http://plplot.sourceforge.net/). It is working, but so far only if I save files to disk, which I would like to not *have* to do. Sometimes (batches in particular), it makes sense to let the code that creates a graph save it, but I also like to do a lot of interactive plotting that should not have to hit the disk. Bill _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
You need to browse the Graphics-File category, there you can found how the different formats are read/write from files to memory.
A better name for ColorForm should be IndexedColorForm: 8 bit index into a palette of colors, used also for 8 bit gray images. If you have RBG you need to use 32 (or 16) bit Forms. On 19/09/2010, at 12:49, Schwab,Wilhelm K wrote: > Some searching did not turn up an answer, but I might be able to let the library "think" in 24 bbp, and then use a C function to expand the result into 32 bbp for Pharo. Would the alpha value be 255?? > > Bill > > ________________________________________ > From: [hidden email] [[hidden email]] On Behalf Of Schwab,Wilhelm K [[hidden email]] > Sent: Sunday, September 19, 2010 10:55 AM > To: [hidden email]; [hidden email] > Subject: [Pharo-project] RGB (0-255) image format? > > Is there a clever and fast way to turn an array of RGB triads (each slot taking on uint8 values from 0-255) into a Form, or better yet treat it directly as a Form? If I understand ColorForm correctly, it uses a map and the image "pixels" are indexes into same. In this case, I would allocate a block of memory, hand it to a library, and it would blast the RGB values all over it. Do we have a ready way to use the result w/o having to loop over the individual values? > > I am working on an interface to PLplot (http://plplot.sourceforge.net/). It is working, but so far only if I save files to disk, which I would like to not *have* to do. Sometimes (batches in particular), it makes sense to let the code that creates a graph save it, but I also like to do a lot of interactive plotting that should not have to hit the disk. > > Bill > > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > |
In reply to this post by Schwab,Wilhelm K
The library assumes a 24 bit layout; unless I want to edit/recompile it, I have no say in that. The best I have been able to find is to let it do its thing and then expand the result into what Pharo uses for a 32 bit layout; I take that to be adding an alpha bit to each pixel??
------------------------------------------- Javier Díaz Reinoso javier_diaz_r at mac.com Sun Sep 19 18:16:23 UTC 2010 You need to browse the Graphics-File category, there you can found how the different formats are read/write from files to memory. A better name for ColorForm should be IndexedColorForm: 8 bit index into a palette of colors, used also for 8 bit gray images. If you have RBG you need to use 32 (or 16) bit Forms. ________________________________________ From: [hidden email] [[hidden email]] On Behalf Of Schwab,Wilhelm K [[hidden email]] Sent: Sunday, September 19, 2010 1:49 PM To: [hidden email]; [hidden email] Subject: Re: [Pharo-project] RGB (0-255) image format? Some searching did not turn up an answer, but I might be able to let the library "think" in 24 bbp, and then use a C function to expand the result into 32 bbp for Pharo. Would the alpha value be 255?? Bill ________________________________________ From: [hidden email] [[hidden email]] On Behalf Of Schwab,Wilhelm K [[hidden email]] Sent: Sunday, September 19, 2010 10:55 AM To: [hidden email]; [hidden email] Subject: [Pharo-project] RGB (0-255) image format? Is there a clever and fast way to turn an array of RGB triads (each slot taking on uint8 values from 0-255) into a Form, or better yet treat it directly as a Form? If I understand ColorForm correctly, it uses a map and the image "pixels" are indexes into same. In this case, I would allocate a block of memory, hand it to a library, and it would blast the RGB values all over it. Do we have a ready way to use the result w/o having to loop over the individual values? I am working on an interface to PLplot (http://plplot.sourceforge.net/). It is working, but so far only if I save files to disk, which I would like to not *have* to do. Sometimes (batches in particular), it makes sense to let the code that creates a graph save it, but I also like to do a lot of interactive plotting that should not have to hit the disk. Bill _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
If it is 24 bits then is RGB(3 bytes) not RGBA(4 bytes=32 bits), so you read 3 bytes put 16rFF (no transparency) in the other byte, as an example see Graphics-Files>>PNGReadWriter>>copyPixelsRGB:
On 19/09/2010, at 14:17, Schwab,Wilhelm K wrote: > The library assumes a 24 bit layout; unless I want to edit/recompile it, I have no say in that. The best I have been able to find is to let it do its thing and then expand the result into what Pharo uses for a 32 bit layout; I take that to be adding an alpha bit to each pixel?? > > > > ------------------------------------------- > > Javier Díaz Reinoso javier_diaz_r at mac.com > Sun Sep 19 18:16:23 UTC 2010 > > You need to browse the Graphics-File category, there you can found how the different formats are read/write from files to memory. > > A better name for ColorForm should be IndexedColorForm: 8 bit index into a palette of colors, used also for 8 bit gray images. If you have RBG you need to use 32 (or 16) bit Forms. > > > > ________________________________________ > From: [hidden email] [[hidden email]] On Behalf Of Schwab,Wilhelm K [[hidden email]] > Sent: Sunday, September 19, 2010 1:49 PM > To: [hidden email]; [hidden email] > Subject: Re: [Pharo-project] RGB (0-255) image format? > > Some searching did not turn up an answer, but I might be able to let the library "think" in 24 bbp, and then use a C function to expand the result into 32 bbp for Pharo. Would the alpha value be 255?? > > Bill > > ________________________________________ > From: [hidden email] [[hidden email]] On Behalf Of Schwab,Wilhelm K [[hidden email]] > Sent: Sunday, September 19, 2010 10:55 AM > To: [hidden email]; [hidden email] > Subject: [Pharo-project] RGB (0-255) image format? > > Is there a clever and fast way to turn an array of RGB triads (each slot taking on uint8 values from 0-255) into a Form, or better yet treat it directly as a Form? If I understand ColorForm correctly, it uses a map and the image "pixels" are indexes into same. In this case, I would allocate a block of memory, hand it to a library, and it would blast the RGB values all over it. Do we have a ready way to use the result w/o having to loop over the individual values? > > I am working on an interface to PLplot (http://plplot.sourceforge.net/). It is working, but so far only if I save files to disk, which I would like to not *have* to do. Sometimes (batches in particular), it makes sense to let the code that creates a graph save it, but I also like to do a lot of interactive plotting that should not have to hit the disk. > > Bill > > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > |
Free forum by Nabble | Edit this page |