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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    DrawBitmap and AllowAlpha

    SDK Help
    0
    6
    642
    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
      Helper
      last edited by

      On 29/06/2017 at 03:03, xxxxxxxx wrote:

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

      ---------
      Hello.

      I have a GeUserArea and I inherit its DrawMsg to draw 2 bitmaps on top of each other.
      First, I use DrawBitmap to draw the background image and then I draw the topmost bitmap which requires BMP_ALLOWALPHA .

      The problem is that using BMP_ALLOWALPHA shows the background color DrawSetPen(COLOR_BG) instead of the background image.

      How can I fix that ?

      Thank you.

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

        On 29/06/2017 at 11:30, xxxxxxxx wrote:

        As far as I know, the only solution is to use a GeClipMap. However, that class does only support direct
        blitting, without scaling.. Doing the scaling in C++ is pretty darn slow on bigger images and causes my
        dialog to lag horribly when the user area is resized.

        I'd love to know if there was actually a way to use DrawBitmap() with proper alpha support, too.

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

          On 30/06/2017 at 03:11, xxxxxxxx wrote:

          Hello and thank you very much for your answer.

          So basically, I will set the bitmap to a GeClipMap and draw the stored bitmap, correct ?
          Inside DrawMsg:

          BeginDraw();
          BaseBitmap* base_bitmap = clip_map->GetBitmap();
          DrawBitmap(base_bitmap, ........);
          EndDraw();
          

          I couldn't find any reference in the examples.

          Thank you.

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

            On 30/06/2017 at 03:29, xxxxxxxx wrote:

            You would need to create a GeClipMap on which you combine the two BaseBitmaps to get your
            final "image" that you want to draw on the GeUserArea. Something like

            AutoAlloc<GeClipMap> map;  // cache that somewhere maybe
            map->BeginDraw();
            map->Blit(image1, ...);
            map->Blit(image2, ...);
            map->EndDraw();
            BaseBitmap* final = map->GetBitmap();
            userArea->DrawBitmap(final, ...);
            
            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              On 30/06/2017 at 03:56, xxxxxxxx wrote:

              I don't think this is going to work because my background image is scaled since it is drawn in a GeUserArea with DrawBitmap.

              I have tried using Init (BaseBitmap *bm, BaseBitmap *alpha_channel) passing the image and a black/white image indicating the transparent regiong but it didn't work 😞

              So it appears that my only solution is to use a fixed background and use GeClipMap's blit, right ?

              Thank you.

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

                On 06/07/2017 at 09:27, xxxxxxxx wrote:

                I'm sorry, we haven't come up with any other idea here.

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