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

    change drawtext size in GeUserArea [SOLVED]

    SDK Help
    0
    18
    1.2k
    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 04/05/2015 at 17:15, xxxxxxxx wrote:

        
      	DrawSetPen(Vector(0.8, 0.2, 0.2));
      	//AutoAlloc<BaseBitmap> bm;
      	AutoFree<MultipassBitmap> bm = MultipassBitmap::Alloc(128, 128, COLORMODE_ARGB);
      	if(!bm) return;
      	bm->AddChannel(TRUE,TRUE);
      	//bm->Init(128, 128, 32);
      	//bm->Clear(0,0,0);
      	BaseBitmap *mAlpha = bm->GetInternalChannel();
      	if(!mAlpha) return;
      	for(Int32 i = 0; i < 128; ++i)
      		for(Int32 j = 0; j < 128; ++j)
      			bm->SetAlphaPixel(mAlpha, i, j, 0);
        
      	AutoAlloc<GeClipMap> cm;
      	if(!cm) return;
      	cm->Init(bm, mAlpha);
        
      	BaseContainer mFont;
      	//cm->Init(128, 128, 32);
      	Float mFontSize = cm->GetFont(&mFont);
        
      	BaseBitmap *mBitmap = cm->GetBitmap();
      	cm->BeginDraw();
      	//cm->SetColor(0, 0, 0, 0);
      	//cm->FillRect(0, 0, 127, 127);
      	cm->SetColor(150, 160, 170, 255);
      	cm->TextAt(4, 4, "Hello World1");
      	cm->EndDraw();
      	
      	Int32 mw = cm->GetBw();
      	Int32 mh = cm->GetBh();
      	DrawBitmap(mBitmap,0,0,mw,mh,0,0,mw,mh,BMP_ALLOWALPHA);
      

      it draws the text with red background, I want the background to be transparent, what should I do?

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

        On 05/05/2015 at 19:09, xxxxxxxx wrote:

        no one knows if this is a bug or not? the Bitmap should be empty, but for unknown reason it fills the Bitmap with the last pen color, any idea how to solve this?

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

          On 05/05/2015 at 22:20, xxxxxxxx wrote:

          Hi Mohamed,

          I'm currently at FMX. I'll be looking into this after my return next Monday.

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

            On 05/05/2015 at 23:49, xxxxxxxx wrote:

            I've also experienced this. DrawBitmap() seems to use the last pen
            color instead of mixing alpha pixels with the pixels that are already on
            the GeUserArea.

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

              On 06/05/2015 at 06:48, xxxxxxxx wrote:

              No need for the explicit additional bitmap and alpha channel allocation.
              You can set the transparency value with SetColor(r,g,b,a).

              i.e. cm->SetColor(r,g,b,128) will give a half transparent output.

              hth

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

                On 06/05/2015 at 13:46, xxxxxxxx wrote:

                yea Samir, but it remains with an unavoidable bug!! , background is not transparent.

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

                  On 07/05/2015 at 03:34, xxxxxxxx wrote:

                  I can't confirm. It works. Here is the code:  
                  
                  OffScreenOn();
                      	Int32 w = 100;
                      	Int32 h = 100;
                       
                      	AutoAlloc<GeClipMap> bmp;
                      	bmp->Init(w,h,32);
                      	bmp->BeginDraw();
                       
                      	bmp->SetDrawMode(GE_CM_DRAWMODE_COPY,255);
                      	bmp->SetColor(255,255,255,0); //Fully transparent
                      	bmp->FillRect(0,0,w,h); //Set the whole bitmap transparent
                      	  
                              bmp->SetDrawMode(GE_CM_DRAWMODE_COPY,255);
                      	bmp->SetColor(255,255,255,128); //50% transparent
                      	bmp->TextAt(10,10,"Katachi rocks.. :-D"); //Draw text
                      	bmp->EndDraw();
                      	DrawBitmap(bmp->GetBitmap(),0,0,w,h,0,0,w,h,BMP_ALLOWALPHA);
                  
                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

                    On 07/05/2015 at 06:43, xxxxxxxx wrote:

                    Hi Samir,

                    try to add DrawSetPen(Vector(0.8, 0.2, 0.2)); "or any other color" after OffScreenOn(); and you will find the bug, I tested your code and the same problem appears.

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

                      On 07/05/2015 at 10:23, xxxxxxxx wrote:

                      Then don't. Why are you using DrawSetPen?

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

                        On 07/05/2015 at 14:23, xxxxxxxx wrote:

                        drawing other stuff prior to texts, should I draw everything in one clipmap? not sure about performance, I will test, it may worth a shot!!

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

                          On 08/05/2015 at 01:19, xxxxxxxx wrote:

                          yes, if you don't have a good reason, you should stay with the clip map drawing functions.

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

                            On 16/05/2015 at 21:26, xxxxxxxx wrote:

                            after using GeClipMap in all drawings it worked perfectly , thanks all for the help, you can mark this as solved

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