Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am creating the video player in that i need to render the drawings (Ex: line, circle, rectangle etc.,) dynamically. So i am using GDI+ to draw the shapes and to render the drawings IVMRMixerBitmap9::SetAlphaBitmap(&VMR9AlphaBitmap) function is used to render the drawings in the vmr9 renderer. The VMR9AlphaBitmap structure containing all the information of the image.
Here is an example to render the line to the vmr9 renderer.
EX:
C++
    IVMRMixerBitmap9 pBmp;
    VMR9AlphaBitmap bmpInfo;
    Pen pen(Color(128,255,0,0),2.0);
RECT rt;
GetClientRect(hwndPanel,&rt);
Bitmap bmp(rt.right,rt.bottom,PixelFormat32bppARGB);
Graphics g(&bmp);
pen.SetEndCap(LineCapArrowAnchor);
g.SetSmoothingMode(SmoothingModeAntiAlias);
g.DrawLine(&pen,x1,y1,x2,y2);
HDC hdc = g.GetHDC();
HDC memDC = CreateCompatibleDC(hdc);
Color r;
HBITMAP hBitmap;
bmp.GetHBITMAP(r,&hBitmap);
SelectObject(memDC, hBitmap);
bmpInfo.dwFlags = VMR9AlphaBitmap_hDC | VMR9AlphaBitmap_SrcColorKey |
                      VMR9AlphaBitmap_FilterMode;
bmpInfo.hdc = memDC;
RECT rc;
SetRect(&rc, 0, 0, bmp.GetWidth(),bmp.GetHeight());
bmpInfo.rSrc = rc;
bmpInfo.rDest.left = 0.0f;
bmpInfo.rDest.top = 0.0f;
bmpInfo.rDest.right = 1.0f;
bmpInfo.rDest.bottom = 1.0f;
bmpInfo.fAlpha = 0.5f;
bmpInfo.clrSrcKey = RGB(0,0,0);
bmpInfo.dwFilterMode=MixerPref9_PointFiltering;
pBmp->SetAlphaBitmap(&bmpInfo);
DeleteObject(hBitmap);
DeleteDC(memDC);
g.ReleaseHDC(hdc);
g.~Graphics();
pen.~Pen();

This code is working fine, the line was rendered successfully but am getting the line as smooth less. Even though i set the smoothing mode as anti-aliased i am getting the line as aliased not as smooth as i expected. Is there anyway to render the drawings into the renderer without these issues or tell me whether any changes i have to make to this code to avoid the alias problem.

Thanking you,
J.Surjith Kumar
Posted
Updated 26-May-13 20:52pm
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900