한국어
Qt
#include <QApplication>
#include <QImage>
#include <QPainter>

#define WIDTH (1024)
#define HEIGHT (768)

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);


    unsigned char *buffer = nullptr;
    QImage *canvas = nullptr;

    buffer = new unsigned char[WIDTH * HEIGHT * 4];
    canvas = new QImage(buffer, WIDTH, HEIGHT, QImage::Format_ARGB32_Premultiplied);
    canvas->fill(0xffffffff);

    QRectF rectangle(0, 0, 1024, 768);
    int startAngle = 30 * 16;
    int spanAngle = 120 * 16;

    QPainter painter(canvas);
    painter.drawPie(rectangle, startAngle, spanAngle);

    canvas->save("test.png", "PNG");

    return a.exec();
}


임의 메로리 영역(QImage)에 QPainter를 이용하여 그리고 파일로 저장하는 예제



test.png