THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/11/2006 at 04:43, xxxxxxxx wrote:
Cinema 4D Version: 9.6
Platform: Mac ;
Language(s) : C.O.F.F.E.E ; C++ ;
Is it possible to "scan" an image and store the pixel informations (like the rgb-value of each pixel), in an array, so that every other object can read this information any time?
Does this only work with a plugin or also with coffee?
On 11/11/2006 at 08:23, xxxxxxxx wrote:
Not sure what you are trying to achieve, but you can read bitmap data with the BaseBitmap class, both in COFFEE and C++.
On 12/11/2006 at 06:19, xxxxxxxx wrote:
I want to store the information of each pixel of the picture in an array for example. So that it is possible to read out these information (out of an array, not again out of the picture) at any time, from "everywhere" in cinema 4d.
Read in a picture once and use these information to change any kind of object. Like using the color-value of a pixel to rotate an object.
On 12/11/2006 at 10:27, xxxxxxxx wrote:
Bitmaps are nothing more than arrays (?). Although they represent 2D images, the usual storage is a 3D array (width x height x depth). Depth depends upon the color space and other information (RGBA is a depth of four). Width elements are usually Byte-size (but can be larger) and store a color component at each depth level:
(A)(A)(A)(A) ... (optional)
B B B B ...
G G G G ...
R R R R ...
The upper left is the upper-left pixel. Each pixel is desribed with three or four depth values (planes).
That should be all the information you'll ever need - why duplicate it? The C++ and COFFEE SDKs have a BaseBitmap class that will let you get and set the pixel information. Just store your own BaseBitmap pointer for the image and make it available to all of your plugin. Not certain about what you mean by "'everywhere' in Cinema 4D", but you can use your plugin to direct the bitmap information to the Cinema 4D facilities if they are accessible to the SDK (COFFEE is very limited in this respect).
Consider that images can take up oodles of memory space (1024x1024 RGBA = 4MB). In low memory situations, all of that duplication may become critical.
On 12/11/2006 at 14:16, xxxxxxxx wrote:
Big thanks for the information.