void Banner::Redraw(IntCoord x1, IntCoord y1, IntCoord x2, IntCoord y2) { Painter* p = highlight ? inverse : output; p->ClearRect(canvas, x1, y1, x2, y2); if (right != nil && rx <= x2) { p->MoveTo(rx, pad); p->Text(canvas, right); } if (middle != nil && mx + mw >= x1 && mx <= x2) { p->MoveTo(mx, pad); p->Text(canvas, middle); } if (left != nil && lx + lw >= x1) { p->MoveTo(lx, pad); p->Text(canvas, left); } }
void TextStrokeGradient(Painter& sw) { const char *txt = "GRADIENT TEXT"; Font fnt = Arial(100).Bold(); Size tsz = GetTextSize(txt, fnt); sw.Text(100, 100, txt, fnt) .Stroke(4, 100, 100, Blue(), 100 + tsz.cx, 100, LtRed()); }
void OnTextPath(Painter& sw) { sw.Text(50, 50, "Hello!", Roman(350)).Stroke(1, Black()); for(int i = 0; i <= 100; i++) { sw.BeginOnPath(i / 100.0); sw.Move(0, -6).Line(6, 0).Line(0, 6).Fill(Red()); sw.End(); } }
void Stroke(Painter& sw) { const char *txt = "GRM"; Font fnt = Arial(100).Bold(); Size tsz = GetTextSize(txt, fnt); sw.Scale(3, 3); sw.Text(100, 100, txt, fnt) .Stroke(10, 100, 100, Blue(), 100 + tsz.cx, 100, LtRed()) .Stroke(0.25, White()); sw.Path("M 100 100 L 200 100 L 210 90 L 220 40 L 230 90 L 240 100 L 400 100") .Stroke(24, Blue()); }
void BigStroke(Painter& sw) { int n = 0; double r = 400; int i = 0; while(r > 5) { Pointf p = Polar(i * M_2PI / 400) * r + Pointf(400, 400); if(i) sw.Line(p); else sw.Move(p); sw.Line(Polar((i * M_2PI / 400 + M_2PI / 800)) * (r - 3) + Pointf(400, 400)); n += 2; r = r - 0.01; i++; } sw.Stroke(1, Black()); sw.Text(0, 0, "Elements: " + AsString(n), Arial(20)).Fill(Blue()); }
void Big(Painter& sw) { int n = 0; double sgn = 1; for(int r = 400; r > 5; r -= 3) { for(int i = 0; i < 400; i++) { Pointf p = Polar(sgn * i * M_2PI / 400) * r + Pointf(400, 400); if(i) sw.Line(p); else sw.Move(p); sw.Line(Polar(sgn * (i * M_2PI / 400 + M_2PI / 800)) * (r - 6) + Pointf(400, 400)); n += 2; } sw.Close(); sgn = -sgn; } sw.Fill(Black()); sw.Text(0, 0, "Elements: " + AsString(n), Arial(20)).Fill(Blue()); }