DrawBitmap and AllowAlpha

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

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


    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.

  • 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.

  • 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:

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

    I couldn't find any reference in the examples.

    Thank you.

  • 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->Blit(image1, ...);
    map->Blit(image2, ...);
    BaseBitmap* final = map->GetBitmap();
    userArea->DrawBitmap(final, ...);

  • 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.

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

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

Log in to reply