change drawtext size in GeUserArea [SOLVED]

On 01/05/2015 at 11:44, xxxxxxxx wrote:

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

I want to control the drawing text size inside GeUserArea, is this possible? I don't see this in the header functions so it may be hidden somewhere else?

On 04/05/2015 at 01:33, xxxxxxxx wrote:

Hi Mohamed,

I don't know any option to influence the font size for GeUserArea::DrawText().
Instead I recommend to use a GeClipMap. There you have full control over the font and its size.

On 04/05/2015 at 05:55, xxxxxxxx wrote:

@Andreas , thanks a lot for the hint

any idea where to use it in the GeUserArea as there is no examples at all!! "I need a minimum example of just where to use it, may be 2~4 lines of code will do it"

On 04/05/2015 at 10:00, xxxxxxxx wrote:

I think I forgot to search, found some examples here on the forums, I guess there won't be a problem now, will ask again here if there is any problem.

On 04/05/2015 at 10:09, xxxxxxxx wrote:

Would be nice if you linked the examples here for the others 🙂

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->Init(128, 128, 32);
	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->SetColor(0, 0, 0, 0);
	//cm->FillRect(0, 0, 127, 127);
	cm->SetColor(150, 160, 170, 255);
	cm->TextAt(4, 4, "Hello World1");
	Int32 mw = cm->GetBw();
	Int32 mh = cm->GetBh();

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

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?

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.

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.

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.


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

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

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

I can't confirm. It works. Here is the code:  
    	Int32 w = 100;
    	Int32 h = 100;
    	AutoAlloc<GeClipMap> bmp;
    	bmp->SetColor(255,255,255,0); //Fully transparent
    	bmp->FillRect(0,0,w,h); //Set the whole bitmap transparent
    	bmp->SetColor(255,255,255,128); //50% transparent
    	bmp->TextAt(10,10,"Katachi rocks.. :-D"); //Draw text

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.

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

Then don't. Why are you using DrawSetPen?

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!!

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.

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