|
-
December 1st, 2009, 12:43 AM
#1
How to create a pattern plus color brush using GDI Plus brush object
I have some bitmaps in my resource and i am using those bitmaps to create a pattern for my GDI + brush, i can create the brush using
HBITMAP bitmap = gPatternCache[(*q-11)].hBitmap; // gPatternCache --> array of pattern bitmaps handles...
Bitmap *pattern = new Bitmap(bitmap,NULL);
Brush *br = new TextureBrush(pattern);
but in addition to that i also want to change the color of that brush, this color selection is done by end user. (i can create a brush of any color using SolidBrush br(obColor); but i cant create it with the patterns )
Gdiplus::Color obColor(255,0,0);
What i want is i want a pattern brush with any RGB color. Is there any way to do that??? please suggest some solution....
My Entire code is as follows :
HBITMAP bitmap = gPatternCache[(*q-11)].hBitmap;
Bitmap *pattern = new Bitmap(bitmap,NULL);
Brush *br = new TextureBrush(pattern);
Graphics graphics(GetGlobalDC());
GraphicsPath polyPath;
polyPath.StartFigure();
polyPath.AddArc(rect, stAngle, sweepAngle); // rect, stAngle & sweepAngle --> has some values....
polyPath.CloseFigure();
graphics.SetSmoothingMode(SmoothingModeHighQuality);
//SolidBrush br(obColor);
graphics.FillPath(br, &polyPath);
Thanks in advance...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|