GeClipMap in UserArea?

On 19/09/2013 at 11:51, xxxxxxxx wrote:

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

Is it possible to use GeClipMap stuff in the UserArea?
I'm not getting anything from it in C++ or Python.


void MyUserArea::DrawMsg(LONG x1,LONG y1,LONG x2,LONG y2, const BaseContainer &msg)  
   AutoAlloc<GeClipMap> cm;  
   if(!cm) return;  
   cm->Init(512, 512, 32);  
   cm->SetColor(255,0,0,100);     //Red  


class MyUA(gui.GeUserArea) :  
  cm = c4d.bitmaps.GeClipMap()  
  def DrawMsg(self, x1, y1, x2, y2, msg) :   
     , 512, 32)          
      width =   
      height =   
        , 0, 0, 100)    #Red,0,100,100)           


On 19/09/2013 at 20:07, xxxxxxxx wrote:

I am not sure how this is meant. Of course you can 'use' a GeClipMap in an UserArea, but you 
have to render it into a BaseBitmap first and then render that BaseBitmap into the GeUserArea. 
After all a GeClipMap is just a parametric representation of a bitmap, MyUA is just holding such
parametric repr and is doing nothing with it.

On 19/09/2013 at 21:25, xxxxxxxx wrote:

OK. Thanks.
I wasn't sure if we had to use bitmaps with the UserArea the same way as Tags, Tools, etc.
I'll try to figure it out using the code I have for those plugins.


On 20/09/2013 at 03:26, xxxxxxxx wrote:

I suggest to allocate the ClipMap once and only re-initialize it if it is too small in size. Like

// Number of additional pixels to allocate to not require immediate
// re-allocation of the clip map when the user area is resitzed.
class MyUserArea : public GeUserArea {
    AutoAlloc<GeClipMap> m_map;
    virtual void DrawMsg(LONG x1, LONG y1, LONG x2, LOG y2, const BaseContainer& msg) {
        Bool reinit = (m_map->GetBw() < (x2 - x1) || m_map->GetBh() < (y2 - y1));  
        if (reinit) {
             m_map->Init(x2 - x1 + CLIPMAP_TOLERANCE, y2 - y1 + CLIPMAP_TOLERANCE, 32);
        // ...

On 20/09/2013 at 08:14, xxxxxxxx wrote:

Ok Thanks.
I've got it working using the same code I use in other plugins to draw things.

  BaseBitmap *map = cm->GetBitmap();  
  LONG mw = map->GetBw();  
  LONG mh = map->GetBh();  

What I'm finding to be the biggest P.I.T.A. with these things is the alphas.
For example:
Suppose you add a background bitmap to the UA using an image.
Then you add a GeClipMap using the FillEllipse() on top of that.
When we do that the square black background area of the Ellipse is visible (not transparent).

DrawBitmap() has an alpha flag. But it doesn't seem to work as I expected. It's not making the black ares transparent.
Do we have to remove the alpha's by hand? Or am I not using DrawBitmap() correctly?


On 20/09/2013 at 09:09, xxxxxxxx wrote:

1. At least GeDialog does not support alpha values. If you set a dialogs background to 
COLOR_TRANS it will be rendered as black. Although GeUserArea does not inherit from 
GeDialog, I guess the same principles do apply here. I found myself multipass bitmaps 
quite useful, as the GeClipmaps own transparency feature seems to be broken in python 
(had a thread here - it does provoke weird hue shifting).

2. What is P.I.T.A. ? Google comes up with tasty greek / turkish bread and Pacific Islands 
Telecommunications Association :D

On 20/09/2013 at 10:39, xxxxxxxx wrote:

P.I.T.A. = Pain In The *ss
Not to be confused with Pita. Which is a type of bread. :slightly_smiling_face:

I've never used multipass bitmaps. So now I guess I have to go and figure them out now too.