Briefly
About the introduction of a lot of strokes, there are animals, fruits, vegetables, transportation, etc., usually to draw a step by step to split, combination. Then draw the results as we want.
Here's another category: Insect-cartoon ants.
Drawing effect
The specific effect is as follows, and we can do a better job of improving it.
Source
Mainly divided into the following three parts:
- Draw Butt
- Draw Belly
- Draw Head
Note: When drawing, due to the different colors of the various parts, and the coordinates are not good positioning, so we use the way the graphics overlay.
void MainWindow::p aintevent (qpaintevent *) {qpainter painter (this);Painter. Setrenderhint(Qpainter:: antialiasing, True); /***** Butt *****/Qpainterpath Path;Path. Addroundrect(Qrect ( $, -, Max, Max), +);Painter. Setbrush(Qt::white);Painter. Setpen(Qt::black);Painter. DrawPath(path); /***** Belly *****/Leg path = Qpainterpath ();Path. MoveTo( the, the);Path. LineTo( -,260);Path. MoveTo(185, the);Path. LineTo(145,280);Path. MoveTo( $, the);Path. LineTo( the,290);Path. MoveTo( $, the);Path. LineTo( -,290);Path. MoveTo(215, the);Path. LineTo( -,280);Path. MoveTo( the, the);Path. LineTo(280,260);Painter. Setbrush(Qt::nobrush);Painter. Setpen(Qt::white);Painter. DrawPath(path);Belly path = Qpainterpath ();Path. Addroundrect(Qrect ( Max, the, -, -), +);Painter. Setbrush(Qt::white);Painter. Setpen(Qt::black);Painter. DrawPath(path); /***** Head *****/Horn path = Qpainterpath ();Path. MoveTo( the, -);Path. LineTo( -, -);Path. MoveTo( $, -);Path. LineTo( the, -);Painter. Setbrush(Qt::nobrush);Painter. Setpen(Qt::white);Painter. DrawPath(path);Path = Qpainterpath ();Path. Addroundrect(Qrect ( -, the, -, -), +);Painter. Setbrush(Qt::white);Painter. Setpen(Qt::black);Painter. DrawPath(path);Left Eye path = Qpainterpath ();Path. Addroundrect(Qrect ( -, -, -, -), +);Painter. Setbrush(Qt::black);Painter. Setpen(Qt::nopen);Painter. DrawPath(path);Path = Qpainterpath ();Path. Addroundrect(Qrect ( the,126,Ten,Ten), +);Painter. Setbrush(Qt::white);Painter. Setpen(Qt::nopen);Painter. DrawPath(path);Right eye Path = Qpainterpath ();Path. Addroundrect(Qrect ( -, the, -, -), +);Painter. Setbrush(Qt::black);Painter. Setpen(Qt::nopen);Painter. DrawPath(path);Path = Qpainterpath ();Path. Addroundrect(Qrect ( the,118,Ten,Ten), +);Painter. Setbrush(Qt::white);Painter. Setpen(Qt::nopen);Painter. DrawPath(path);Mouth path = Qpainterpath ();Path. MoveTo( the,108);Path. ArcTo(Qrect ( the, -, -, -), the, -);Painter. Rotate( -);Painter. Setbrush(Qt::nobrush);Painter. Setpen(Qt::black);Painter. DrawPath(path);}
For the general drawing is relatively simple, because it is commonly used, regular, and comparative rules, such as circles, ellipses, rectangles, straight lines. If there are a variety of complex graphics, then the original drawing scheme is difficult to achieve, it takes a lot of time to toss back and forth, so here is no longer introduced.
QT Graphics (simple strokes-draw cartoon ants)