4166am金沙.信心之选(中国)有限公司

文章分享

开放、平等、协作、快速、分享

当前位置:4166am金沙.信心之选>文章分享

SVG

摘录:HCTech 无锡和控电子   时间:2024-04-11   访问量:1847

SVG 意为可缩放矢量图形(Scalable Vector Graphics)。

SVG 使用 XML 格式定义图像。

SVG可直接嵌入到HTML5中


  




Projects that uses wxSVG

wxSVG (sourceforge.io)

Using of wxSVG

Loading and Displaying of SVG

There are two methods to display SVG:


Dynamic creating of SVG

Here is an example of dynamic creation

wxSVGDocument* svgDoc = new wxSVGDocument;
double w=450,h=450;
wxSVGSVGElement* svgElement = new wxSVGSVGElement;
svgElement->SetWidth(w);
svgElement->SetHeight(h);
svgDoc->AppendChild(svgElement);

wxSVGRectElement* rect = new wxSVGRectElement;
rect->SetX(0);
rect->SetY(0);
rect->SetWidth(w);
rect->SetHeight(h);
rect->SetFill(wxSVGPaint(0,0,0));
svgElement->AppendChild(rect);

rect = new wxSVGRectElement;
rect->SetX(50);
rect->SetY(50);
rect->SetWidth(w-100);
rect->SetHeight(h-100);
rect->SetFill(wxSVGPaint(0,0,255));
rect->SetStroke(wxSVGPaint(255,255,255));
rect->SetStrokeWidth(2);
rect->SetFillOpacity(.5);
svgElement->AppendChild(rect);

rect = (wxSVGRectElement*) rect->CloneNode();
double x = w/4+50;
double y = h/4+50;
rect->SetX(x);
rect->SetY(y);
rect->SetWidth(w/2);
rect->SetHeight(h/2);
rect->SetFill(wxSVGPaint(0,0,0));
rect->Rotate(45, x + w/4, y + h/4);
svgElement->AppendChild(rect);

m_svgCtrl->SetSVG(svgDoc);


上一篇:Emscripten 是一个 开源的编译器

下一篇:插片规格?110、187、250的区别?

Baidu
sogou