Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Copy Bitmap with GetPixelCnt

    Scheduled Pinned Locked Moved SDK Help
    7 Posts 0 Posters 526 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

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

      On 23/02/2011 at 05:14, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R12 
      Platform:   Windows  ; Mac  ;  Mac OSX  ; 
      Language(s) :     C++  ;

      ---------
      Hi,

      i want to copy a MultipassBitmap to my own Picturefile.
      Currently i use the GetPixelCnt function to get the Pixels LinePerLine, but it seems that i use it in the wrong way (on some PCs it crashs).

      My Code:

        
        void *linePtr = GeAlloc(sizeX*3); // the buffer where the Pixels per line are stored  
        LONG BytesPerPixel = src->GetBt() / 8;        // src is a MultipassBitmap *  
        src->GetPixelCnt(0, y, sizeX, (UCHAR* )linePtr, BytesPerPixel, COLORMODE_RGB, PIXELCNT_0); // should copy the line to the buffer  
      

      Is it possible what the BytesPerPixel are wrong calculated (I thought the BytesPerPixel are the Bytes used for 1 Pixel in the src Bitmap => so get the bits per pixel and take it throw 8

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

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

        On 23/02/2011 at 05:30, xxxxxxxx wrote:

        Actually I I am not familiar with C++.
        What about the GetClone() function ? If you want to Copy the Bitmap, it might be useful.

        //Ah, sorry. A MultipassBitmap is not the same as a BaseBitmap. Ignore my comment. 😊

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

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

          On 23/02/2011 at 05:33, xxxxxxxx wrote:

          well i want to copy the data to my own (RGB 8bit) Pictureclass so i couldnt clone it.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

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

            On 23/02/2011 at 06:27, xxxxxxxx wrote:

            The BFF.cpp SDK example uses the GetPixelCnt() method.

            I stripped it down to following code:

              
            LONG            y,bw,bh;  
            UCHAR            *line = NULL;  
              
            //bm is the bitmap  
            bw=bm->GetBw();  
            bh=bm->GetBh();  
              
            line = GeAllocType(UCHAR,3*bw);  
            if (!line)   
            {   
              GeFree(line);   
              return FALSE;   
            }  
              
            for (y=0; y<bh; y++)  
            {  
              bm->GetPixelCnt(0,y,bw,line,COLORBYTES_RGB,COLORMODE_RGB,PIXELCNT_0);  
                
              // do something with line  
            }  
              
            GeFree(line);  
            

            Always free the buffer with GeFree() when you are finished.

            cheers,
            Matthias

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

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

              On 23/02/2011 at 07:04, xxxxxxxx wrote:

              ah thanks,

              could i dynamical determine which COLORBYTES an COLORMODE return by getColorMode() has?

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

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

                On 23/02/2011 at 07:31, xxxxxxxx wrote:

                Originally posted by xxxxxxxx

                could i dynamical determine which COLORBYTES an COLORMODE return by getColorMode() has?

                Not that I know of. You have to convert COLORMODE to COLORBYTES yourself.

                something like this:

                  
                switch (mode)  
                {  
                  case COLORMODE_RGB: return COLORBYTES_RGB;  
                  case COLORMODE_GRAY: return COLORBYTES_GRAY;  
                    
                  // etc.  
                    
                }  
                

                cheers,
                Matthias

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

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

                  On 23/02/2011 at 07:33, xxxxxxxx wrote:

                  ah ok
                  thank you very much.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post