[英]How to rasterize a vector image in C++ Win32 API
最近我一直在嘗試在 C++ 中嘗試矢量圖形。 我想制作一個讀取 svg 文件並將其顯示在屏幕上的 Win32 應用程序。 目前的程序很簡單。 使用 Win32 API 將打開一個窗口,並選擇一個 .svg 文件。 這個 svg 文件的數據然后被轉換為我自己的結構數據。 轉換是好的。 struct的代碼如下:
#pragma once
#include <vector>
#include "Rect.h"
class VectorTexture
{
public:
enum ShapeType
{
// Circle: x, y, r
Circle,
// Line: x1, y1, x2, y2, width
Line,
// Rectangle: x, y, width, height
Rectangle,
// Square: x, y, a
Square,
// Polygon: x[n], y[n]
Polygon
};
struct Shape
{
public:
ShapeType type;
float data[];
};
Rect rect;
std::vector<Shape> shapes;
};
現在,下一步是顯示 svg 圖像。 我怎樣才能光柵化我擁有的矢量數據,給我可以在屏幕上顯示的HBITMAP
? 如果您知道任何資源,請提供鏈接。
提前致謝。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.