【Qt】英国のラウンデルを描画
比率は目測です。以下のメッセージが出るのでそのままは使わないでください
QPaintDevice: Cannnot destroy paint device that being painted
QPixmap takeRAFRoundel() { // 画像のサイズ int width = 500; int height = 500; QPoint center(width/2,height/2); QPixmap pix(width,height); QPainter *p = new QPainter(&pix); // 背景を白で塗りつぶす p->setPen(*(new QColor(0xFF,0xFF,0xFF,0xFF))); p->fillRect(0,0,width,height,*(new QBrush(QColor(0xFF,0xFF,0xFF)))); // 青い丸を描く p->setPen(*(new QColor(0x00,0x24,0x7D,0xFF))); p->setBrush(*(new QBrush(QColor(0x00,0x24,0x7D,0xFF)))); // drawArcでは塗りつぶしができない // そのため、drawEllipseを使う p->drawEllipse(center,500/2,500/2); // 白い丸を描く p->setPen(*(new QColor(0xFF,0xFF,0xFF,0xFF))); p->setBrush(*(new QBrush(QColor(0xFF,0xFF,0xFF,0xFF)))); p->drawEllipse(center,325/2,325/2); // 赤い丸を描く p->setPen(*(new QColor(0xCE,0x11,0x26,0xFF))); p->setBrush(*(new QBrush(QColor(0xCE,0x11,0x26,0xFF)))); p->drawEllipse(center,150/2,150/2); return pix; }