You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to draw thousand of pie Elements on my RenderContext. Because the calculation is very time consuming, I need to draw them on a memory bitmap and the the memory bitmap on screen.
But this don't work, simply it's nothing drawn but also no error or exception.
I modified your PieChart Example to demonstrate the issue. All other methods work excelent on memory bitmap, but FillPath and DrawPath will not (I've not tested more).
Can you please fix this?
Regards
namespace unvell.D2DLib.Examples.Demos
{publicpartialclassPieChart:DemoForm{List<PieInfo>pies=newList<PieInfo>();D2DBitmapGraphicsm_MemoryBitmap;publicPieChart(){Size=new Size(800,1000);Text="PieChart Demo - d2dlib Examples";
CreateChart();m_MemoryBitmap= Device.CreateBitmapGraphics(ClientRectangle.Width, ClientRectangle.Height);}voidCreateChart(){
pies.Clear();// define the figure origin and sizevarfigureOrigin=new D2DPoint(300,300);varfigureSize=new D2DSize(300,300);Randomrandom=new Random();varrecords=newfloat[2];
records[0]= random.Next(0,360);
records[1]=360- records[0];floatcurrentAngle=270-(records[0]/2);// create pie geometries from recordsforeach(var record in records){varangleSpan= record;varpath= Device.CreatePieGeometry(figureOrigin, figureSize, currentAngle,currentAngle+angleSpan);
pies.Add(new PieInfo {path=path,color= D2DColor.Randomly()});currentAngle+=angleSpan;}}protectedoverridevoidOnRender(D2DGraphicsg){base.OnRender(g);// draw backgroundD2DBrushbrush= Device.CreateSolidColorBrush(D2DColor.Silver);
m_MemoryBitmap.BeginRender();
m_MemoryBitmap.FillRectangle(100,100,400,400, D2DColor.LightYellow);
m_MemoryBitmap.FillEllipse(100,300,400,400, D2DColor.AliceBlue);// draw pie geometries
m_MemoryBitmap.FillPath(pies[0].path, pies[0].color);
m_MemoryBitmap.DrawPath(pies[0].path, D2DColor.LightYellow,2);//
m_MemoryBitmap.FillPathWithBrush(pies[0].path, brush);//
m_MemoryBitmap.DrawText("Click to change color", D2DColor.Red,250,550);
m_MemoryBitmap.EndRender();
g.DrawBitmap(m_MemoryBitmap, ClientRectangle);
g.FillPathWithBrush(pies[1].path, brush);
g.DrawPath(pies[1].path, D2DColor.Blue,2);
brush.Dispose();}protectedoverridevoidOnMouseUp(MouseEventArgse){base.OnMouseUp(e);
CreateChart();
Invalidate();}}classPieInfo{publicD2DGeometrypath;publicD2DColorcolor;}}
The text was updated successfully, but these errors were encountered:
Hi,
I need to draw thousand of pie Elements on my RenderContext. Because the calculation is very time consuming, I need to draw them on a memory bitmap and the the memory bitmap on screen.
But this don't work, simply it's nothing drawn but also no error or exception.
I modified your PieChart Example to demonstrate the issue. All other methods work excelent on memory bitmap, but FillPath and DrawPath will not (I've not tested more).
Can you please fix this?
Regards
The text was updated successfully, but these errors were encountered: