Update MultipassBitmap



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 18/10/2011 at 00:44, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   12 
    Platform:      
    Language(s) :     C++  ;

    ---------
    Hy there,

    I want to set floating-point values to an allocated MultipassBitmap. I find it strange, that there is no method to set floating-point values, I can just see `

    Bool SetPixel(LONG x, LONG y, LONG r, LONG g, LONG b);

    `from the BaseBitmap class.

    After a while of searching I then figured out, that I could maybe use the GetLine and SetLine if casted to a VPBuffer. Now I use the example code from the invert-image example to read a line into a buffer and set the buffer back.

    When I set it back, it always returns FALSE, so the SetLine is not working. For testing purpose I didn't change the buffer that I read out, but that doesn't change the outcome. I do all this within a TagData plugin's message-callback method.

    What can I do?

    Is there another method I can use to update a MultipassBitmap with Real values?

    Is it possible, to write data to a Bitmap residing in a Bitmap shader?

    Thank you,
    maxx



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/10/2011 at 02:58, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Is there another method I can use to update a MultipassBitmap with Real values?

    Here is a simple example how to create and access a 32bit floating point MultipassBitmap:

      
    Bool MenuTest::Execute(BaseDocument *doc)  
    {  
      MultipassBitmap *mbmp = NULL;  
      SReal *buffer = NULL;  
      
      mbmp = MultipassBitmap::Alloc(512, 512, COLORMODE_RGBf);  
      if (!mbmp) goto Error;  
      
      buffer = GeAllocType(SReal, 512*3);  
      if (!buffer) goto Error;  
      
      //fill a line; I used a brightness over 100% (4.0)  
      for (LONG i=0; i<512*3; i++)  
          buffer[i] = 4.0;  
      
      //cast the SReal buffer into UCHAR; inc parameter is 3*4bytes (3*32bit) because of floating point image format  
      for (LONG y=0; y<512; y++)  
          if (!mbmp->SetPixelCnt(0, y, 512, (UCHAR* )buffer, 12, COLORMODE_RGBf, PIXELCNT_0)) goto Error;  
      
      ShowBitmap(mbmp);  
      
      MultipassBitmap::Free(mbmp);  
      GeFree(buffer);  
      
      return TRUE;  
      
    Error:  
      MultipassBitmap::Free(mbmp);  
      GeFree(buffer);  
      
      return FALSE;  
    }  
    

    Is it possible, to write data to a Bitmap residing in a Bitmap shader?

    Unfortunatly not.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/10/2011 at 09:18, xxxxxxxx wrote:

    Thanks a lot for the example!

    Cheers,
    maxx


Log in to reply