mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-12 06:12:46 -06:00
git-svn-id: svn://ultimatepp.org/upp/trunk@949 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
9f7981ff90
commit
653bab5531
9 changed files with 428 additions and 0 deletions
75
bazaar/PainterSvg demo/Demo.svg
Normal file
75
bazaar/PainterSvg demo/Demo.svg
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20050904/DTD/svg10.dtd">
|
||||
<!-- Created by amaya 11.1, see http://www.w3.org/Amaya/ -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="600"
|
||||
height="600">
|
||||
<defs>
|
||||
<marker style="overflow:visible;" id="Arrow1Mend" refX="0.0" refY="0.0"
|
||||
orient="auto">
|
||||
<path transform="scale(0.4) rotate(180) translate(10,0)"
|
||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
|
||||
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "/>
|
||||
</marker>
|
||||
</defs>
|
||||
<title>Draw</title>
|
||||
<rect x="27px" y="20px" width="161px" height="161px"
|
||||
style="stroke: black; stroke-opacity: 1; stroke-width: 1;fill: #9dc2de"
|
||||
transform="translate(10,16) "/>
|
||||
<rect x="142px" y="152px" width="132px" height="132px"
|
||||
style="stroke: black; stroke- stroke-width: 1;fill:#808000;opacity: 0.5"/>
|
||||
<ellipse cx="196px" cy="330px" rx="153px" ry="69px"
|
||||
style="stroke: black; stroke-opacity: 1; fill:#ffff80;stroke-width: 7"/>
|
||||
<text x="232px" y="65px"
|
||||
style="stroke: none;font-family: Times New Roman,Times,serif;font-size: 14pt">Text
|
||||
demo!</text>
|
||||
<rect x="233px" y="49px" width="84px" height="19px"
|
||||
style="stroke: black; stroke- stroke-width: 1;fill: #9dc2de;opacity: 0.5"
|
||||
transform="translate(-1) "/>
|
||||
<line x1="417" y1="75" x2="346" y2="133"
|
||||
style=" stroke-opacity: 1; ;stroke-width: 4;stroke:#ff8000"/>
|
||||
<polygon points="351 225 382 162 476 162 444 225"
|
||||
style="stroke: black; stroke-opacity: 1; stroke-width: 1;fill: #9dc2de"/>
|
||||
<rect x="0px" y="0px" width="111px" height="111px" rx="21" ry="37"
|
||||
style="stroke: black; stroke-opacity: 1; fill:#8000ff;stroke-width: 3"
|
||||
transform="translate(379,262) "/>
|
||||
<path
|
||||
d="M 476,80 C 497,48 531,2 533,69 C 535,136 481,102 501,124 C 521,146 543,164 487,152 C 431,140 419,118 442,118 C 465,118 506,113 473,101 C 440,89 414,43 445,59 C 476,75 479,77 479,77 C 479,77 444,127 476,80 "
|
||||
style="stroke: black; stroke-opacity: 1; stroke-width: 1;fill:#ff8000"
|
||||
transform="translate(-386,-29) "/>
|
||||
<g transform="translate(312,411) scale(0.933673,0.717822)"
|
||||
style="stroke: black; stroke-opacity: 1; stroke-width: 1;fill: #9dc2de">
|
||||
<title>Nube</title>
|
||||
<path
|
||||
d="M 23,34 A 45,21 0 0 1 88,12 A 41,22 0 0 1 160,33 A 51,25 0 0 1 180,73 A 42,23 0 0 1 135,104 A 38,17 0 0 1 60,120 L 10,200 25,120 A 10,20 0 0 1 16,75 A 18,20 0 0 1 23,34"/>
|
||||
</g>
|
||||
<path
|
||||
d="M 39,392 Q 106,375 70,323 C 34,271 87,282 75,253 C 63,224 63,224 63,224 "
|
||||
style="stroke: black; stroke-opacity: 1; stroke-width: 1;fill:none;"/>
|
||||
<path
|
||||
d="M 246,90 Q 279,112 282,98 C 285,84 322,72 307,97 C 292,122 288,142 262,127 C 236,112 272,123 252,110 C 232,97 211,79 229,85 C 247,91 247,91 247,91 C 247,91 213,68 246,90 "
|
||||
style="stroke: black; stroke-opacity: 1; stroke-width: 1;fill:#00ff00"/>
|
||||
<rect x="451px" y="38px" width="110px" height="110px"
|
||||
style="stroke: black; stroke-opacity: 1; stroke-width: 1;fill: none"/>
|
||||
<path
|
||||
d="M 450,38 Q 561,-71 561,38 C 561,147 449,261 450,149 C 452,-75 339,147 450,38 "
|
||||
style="stroke: black; stroke-opacity: 1; stroke-width: 1;fill: #9dc2de"
|
||||
transform="translate(57,179) "/>
|
||||
<path
|
||||
d="M 57,422 Q 124,388 115,430 C 106,472 85,525 59,484 C 33,443 33,443 33,443 C 33,443 -10,456 57,422 "
|
||||
style="stroke: black; stroke-opacity: 1; stroke-width: 1;fill: #9dc2de"/>
|
||||
<path
|
||||
d="M 259,408 Q 289,388 297,406 C 305,424 322,447 294,444 C 266,441 272,423 254,430 C 236,437 229,428 259,408 "
|
||||
style="stroke: black; stroke-opacity: 1; stroke-width: 1;fill: #9dc2de"/>
|
||||
<polyline
|
||||
points="101,235 146,291 96,311 145,345 100,361 216,482 152,480 152,480 "
|
||||
style="stroke: black; stroke-opacity: 1; stroke-width: 1;fill:none;"/>
|
||||
<text x="287px" y="154px"
|
||||
style="font-family: Arial,Helvetica,sans-serif">Other text</text>
|
||||
<image xlink:href="Glacier.jpg" width="300" height="225" x="0" y="0"
|
||||
transform="translate(402,459) ">
|
||||
</image>
|
||||
<text x="88px" y="509px" style="fill-opacity: 1;font-size: 18pt">More
|
||||
text</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
39
bazaar/PainterSvg demo/Examples.h
Normal file
39
bazaar/PainterSvg demo/Examples.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef _PainterExamples_Examples_h_
|
||||
#define _PainterExamples_Examples_h_
|
||||
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
#include <PainterSvg/PainterSvg.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
#define LAYOUTFILE <PainterSvg demo/Examples.lay>
|
||||
#include <CtrlCore/lay.h>
|
||||
|
||||
void RegisterExample(const char *name, void (*ex)(Painter& pw));
|
||||
|
||||
struct App : TopWindow {
|
||||
virtual void Paint(Draw& w);
|
||||
|
||||
SplitterFrame split;
|
||||
ArrayCtrl list;
|
||||
FrameBottom< WithCtrlLayout<StaticRect> > ctrl;
|
||||
|
||||
typedef App CLASSNAME;
|
||||
|
||||
void DoPaint0(Painter& sw);
|
||||
void DoPaint(Painter& sw);
|
||||
void Print();
|
||||
void Benchmark();
|
||||
void Sync();
|
||||
void ToSlider(EditDouble *e, SliderCtrl *slider);
|
||||
void ToEdit(EditDouble *e, SliderCtrl *slider);
|
||||
void Pair(EditDouble& e, SliderCtrl& slider);
|
||||
void ToSlider();
|
||||
void Reset();
|
||||
void Serialize(Stream& s);
|
||||
|
||||
App();
|
||||
~App();
|
||||
};
|
||||
|
||||
#endif
|
||||
29
bazaar/PainterSvg demo/Examples.lay
Normal file
29
bazaar/PainterSvg demo/Examples.lay
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
LAYOUT(CtrlLayout, 212, 384)
|
||||
ITEM(Label, dv___0, SetLabel(t_("Translate X")).LeftPosZ(4, 72).TopPosZ(4, 19))
|
||||
ITEM(EditDoubleSpin, translate_x, Min(0).Max(2000).LeftPosZ(4, 64).TopPosZ(24, 19))
|
||||
ITEM(SliderCtrl, translate_x_slider, HSizePosZ(72, 4).TopPosZ(22, 24))
|
||||
ITEM(Label, dv___3, SetLabel(t_("Translate Y")).LeftPosZ(4, 72).TopPosZ(48, 19))
|
||||
ITEM(EditDoubleSpin, translate_y, Min(0).Max(2000).LeftPosZ(4, 64).TopPosZ(68, 19))
|
||||
ITEM(SliderCtrl, translate_y_slider, HSizePosZ(72, 4).TopPosZ(66, 24))
|
||||
ITEM(Label, dv___6, SetLabel(t_("Rotate")).LeftPosZ(4, 52).TopPosZ(92, 19))
|
||||
ITEM(EditDoubleSpin, rotate, Min(0).Max(6.29).LeftPosZ(4, 64).TopPosZ(112, 19))
|
||||
ITEM(SliderCtrl, rotate_slider, HSizePosZ(72, 4).TopPosZ(110, 24))
|
||||
ITEM(Label, dv___9, SetLabel(t_("Scale")).LeftPosZ(4, 52).TopPosZ(136, 19))
|
||||
ITEM(EditDoubleSpin, scale, Min(0).Max(3).LeftPosZ(4, 64).TopPosZ(156, 19))
|
||||
ITEM(SliderCtrl, scale_slider, HSizePosZ(72, 4).TopPosZ(154, 24))
|
||||
ITEM(Label, dv___12, SetLabel(t_("Scale X")).LeftPosZ(4, 52).TopPosZ(180, 19))
|
||||
ITEM(EditDoubleSpin, scale_x, Min(0).Max(2).LeftPosZ(4, 64).TopPosZ(200, 19))
|
||||
ITEM(SliderCtrl, scale_x_slider, HSizePosZ(72, 4).TopPosZ(198, 24))
|
||||
ITEM(Label, dv___15, SetLabel(t_("Opacity")).LeftPosZ(4, 52).TopPosZ(224, 19))
|
||||
ITEM(EditDoubleSpin, opacity, SetInc(0.05).Min(0).Max(1).LeftPosZ(4, 64).TopPosZ(244, 19))
|
||||
ITEM(SliderCtrl, opacity_slider, HSizePosZ(72, 4).TopPosZ(242, 24))
|
||||
ITEM(Option, painting, SetLabel(t_("Paint through Painting")).LeftPosZ(4, 128).TopPosZ(268, 20))
|
||||
ITEM(DropList, linejoin, LeftPosZ(4, 100).BottomPosZ(33, 19))
|
||||
ITEM(DropList, linecap, RightPosZ(4, 100).BottomPosZ(33, 19))
|
||||
ITEM(Button, reset, SetLabel(t_("Reset")).LeftPosZ(4, 64).BottomPosZ(4, 24))
|
||||
ITEM(Button, print, SetLabel(t_("Print")).HSizePosZ(72, 80).BottomPosZ(4, 24))
|
||||
ITEM(Button, benchmark, SetLabel(t_("Benchmark")).RightPosZ(4, 72).BottomPosZ(4, 24))
|
||||
ITEM(Switch, quality, SetLabel(t_("Antialiased\nNoAA\nSubpixel")).LeftPosZ(4, 204).TopPosZ(312, 16))
|
||||
ITEM(Option, transparent, SetLabel(t_("Transparent background")).LeftPosZ(4, 204).TopPosZ(288, 20))
|
||||
END_LAYOUT
|
||||
|
||||
BIN
bazaar/PainterSvg demo/Glacier.jpg
Normal file
BIN
bazaar/PainterSvg demo/Glacier.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.8 KiB |
16
bazaar/PainterSvg demo/PainterSvg demo.upp
Normal file
16
bazaar/PainterSvg demo/PainterSvg demo.upp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
description "Svg Painter demo";
|
||||
|
||||
uses
|
||||
CtrlLib,
|
||||
PainterSvg;
|
||||
|
||||
file
|
||||
Examples.h,
|
||||
SvgDemo.cpp,
|
||||
main.cpp,
|
||||
Examples.lay;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI",
|
||||
"" = "GUI SSE2";
|
||||
|
||||
32
bazaar/PainterSvg demo/Piechart.svg
Normal file
32
bazaar/PainterSvg demo/Piechart.svg
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN"
|
||||
"http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">
|
||||
<svg width="22cm" height="13cm" viewBox="0 0 2200 1300">
|
||||
<g>
|
||||
<rect x="1" y="1" width="2198" height="1298" style="fill:darkslateblue; stroke:blue; stroke-width:1"/>
|
||||
<text style="font-size: 40; fill: white; stroke-width: 1" x="600" y="1100">Average: 20.0</text>
|
||||
<path d="M700.0,600.0 L340.0,600.0 A360.0,360.0 0 0,1 408.1452123287954,389.2376150414973 z" style="fill:red; stroke:black; stroke-width:5"/>
|
||||
<text style="font-size: 40; fill: white; stroke-width: 1" x="1400" y="140">MagickWand for PHP</text>
|
||||
<text style="font-size: 30; fill: white; stroke-width: 1" x="1800" y="140">(10.0%)</text>
|
||||
<rect x="1330" y="100" width="40" height="40" style="fill:red; stroke:black; stroke-width:4"/>
|
||||
<path d="M700.0,600.0 L408.1452123287954,389.2376150414973 A360.0,360.0 0 0,1 976.5894480359858,369.56936567559273 z" style="fill:yellow; stroke:black; stroke-width:5"/>
|
||||
<text style="font-size: 40; fill: white; stroke-width: 1" x="1400" y="220">MagickCore</text>
|
||||
<text style="font-size: 30; fill: white; stroke-width: 1" x="1800" y="220">(29.0%)</text>
|
||||
<rect x="1330" y="180" width="40" height="40" style="fill:yellow; stroke:black; stroke-width:4"/>
|
||||
<path d="M700.0,600.0 L976.5894480359858,369.56936567559273 A360.0,360.0 0 0,1 964.2680466142854,844.4634932636567 z" style="fill:fuchsia; stroke:black; stroke-width:5"/>
|
||||
<text style="font-size: 40; fill: white; stroke-width: 1"
|
||||
x="1400" y="300">MagickWand</text>
|
||||
<text style="font-size: 30; fill: white; stroke-width: 1" x="1800" y="300">(22.9%)</text>
|
||||
<rect x="1330" y="260" width="40" height="40" style="fill:fuchsia; stroke:black; stroke-width:4"/>
|
||||
<path d="M700.0,600.0 L964.2680466142854,844.4634932636567 A360.0,360.0 0 0,1 757.853099990584,955.3210081341651 z" style="fill:blue; stroke:black; stroke-width:5"/>
|
||||
<text style="font-size: 40; fill: white; stroke-width: 1" x="1400" y="380">JMagick</text>
|
||||
<text style="font-size: 30; fill: white; stroke-width: 1" x="1800" y="380">(10.6%)</text>
|
||||
<rect x="1330" y="340" width="40" height="40" style="fill:blue; stroke:black; stroke-width:4"/>
|
||||
<path d="M700.0,600.0 L757.853099990584,955.3210081341651 A360.0,360.0 0 0,1 340.0,600.0 z" style="fill:lime; stroke:black; stroke-width:5"/>
|
||||
<text style="font-size: 40; fill: white; stroke-width: 1" x="1400" y="460">Magick++</text>
|
||||
<text style="font-size: 30; fill: white; stroke-width: 1" x="1800" y="460">(27.5%)</text>
|
||||
<rect x="1330" y="420" width="40" height="40" style="fill:lime; stroke:black; stroke-width:4"/>
|
||||
<text style="font-size: 100; fill: white; stroke-width: 1" x="100" y="150">ImageMagick</text>
|
||||
<circle cx="700" cy="600" r="360" style="fill: none; stroke: black; stroke-width:5" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
25
bazaar/PainterSvg demo/SvgDemo.cpp
Normal file
25
bazaar/PainterSvg demo/SvgDemo.cpp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "Examples.h"
|
||||
|
||||
String file = "C:\\Demo.svg";
|
||||
|
||||
void SvgDemo(Painter& sw)
|
||||
{
|
||||
try {
|
||||
if (FileExists(file))
|
||||
ParseSVG(sw, LoadFileBOM(file), GetFileDirectory(file));
|
||||
else {
|
||||
sw.Scale(1./20);
|
||||
sw.Text(200, 200, "File '" + file + "' not found", Font(Font::ARIAL, 400));
|
||||
sw.Opacity(1);
|
||||
sw.Stroke(1, Black());
|
||||
sw.Fill(Black());
|
||||
}
|
||||
}
|
||||
catch(XmlError e) {
|
||||
LOG("SVG XML error: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
INITBLOCK {
|
||||
RegisterExample("Svg demo", SvgDemo);
|
||||
}
|
||||
6
bazaar/PainterSvg demo/init
Normal file
6
bazaar/PainterSvg demo/init
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef _PainterSvg_demo_icpp_init_stub
|
||||
#define _PainterSvg_demo_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#include "PainterSvg/init"
|
||||
#include "plugin\jpg/init"
|
||||
#endif
|
||||
206
bazaar/PainterSvg demo/main.cpp
Normal file
206
bazaar/PainterSvg demo/main.cpp
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
#include "Examples.h"
|
||||
|
||||
extern String file;
|
||||
|
||||
struct Example {
|
||||
void (*example)(Painter& pw);
|
||||
String name;
|
||||
};
|
||||
|
||||
Array<Example>& Examples()
|
||||
{
|
||||
static Array<Example> x;
|
||||
return x;
|
||||
};
|
||||
|
||||
void RegisterExample(const char *name, void (*ex)(Painter& pw))
|
||||
{
|
||||
Example& x = Examples().Add();
|
||||
x.name = name;
|
||||
x.example = ex;
|
||||
}
|
||||
|
||||
void App::DoPaint0(Painter& sw)
|
||||
{
|
||||
sw.Translate(~ctrl.translate_x, ~ctrl.translate_y);
|
||||
sw.Rotate(~ctrl.rotate);
|
||||
sw.Scale(~ctrl.scale, (double)~ctrl.scale * (double)~ctrl.scale_x);
|
||||
sw.Opacity(~ctrl.opacity);
|
||||
sw.LineCap(~ctrl.linecap);
|
||||
sw.LineJoin(~ctrl.linejoin);
|
||||
{ PAINTER_TIMING("FILL");
|
||||
if(ctrl.transparent)
|
||||
sw.Clear(RGBAZero());
|
||||
else
|
||||
sw.Clear(White());
|
||||
}
|
||||
if(list.IsCursor())
|
||||
Examples()[list.GetCursor()].example(sw);
|
||||
}
|
||||
|
||||
void App::DoPaint(Painter& sw)
|
||||
{
|
||||
if(ctrl.painting) {
|
||||
PaintingPainter h(2000, 2000);
|
||||
DoPaint0(h);
|
||||
sw.Paint(h);
|
||||
}
|
||||
else
|
||||
DoPaint0(sw);
|
||||
}
|
||||
|
||||
void App::Print()
|
||||
{
|
||||
PaintingPainter sw(1000, 1000);
|
||||
DoPaint(sw);
|
||||
PrinterJob pb;
|
||||
if(pb.Execute())
|
||||
pb.GetDraw().DrawPainting(0, 0, 4000, 4000, sw);
|
||||
}
|
||||
|
||||
void App::Benchmark()
|
||||
{
|
||||
int time;
|
||||
int time0 = GetTickCount();
|
||||
int n = 0;
|
||||
for(;;) {
|
||||
time = GetTickCount();
|
||||
if(time - time0 > 1000) break;
|
||||
ImageBuffer ib(800, 600);
|
||||
BufferPainter sw(ib, ctrl.quality);
|
||||
PAINTER_TIMING("Paint");
|
||||
DoPaint(sw);
|
||||
n++;
|
||||
}
|
||||
PromptOK("Benchmark: " + AsString(double(time - time0) / n) + " ms");
|
||||
}
|
||||
|
||||
void App::Paint(Draw& w)
|
||||
{
|
||||
Size sz = GetSize();
|
||||
if(ctrl.transparent) {
|
||||
for(int y = 0; y + 32 < sz.cy; y += 32)
|
||||
for(int x = 0; x + 32 < sz.cx; x += 32)
|
||||
w.DrawRect(x, y, 32, 32, (x ^ y) & 32 ? Color(254, 172, 120) : Color(124, 135, 253));
|
||||
}
|
||||
ImageBuffer ib(sz);
|
||||
BufferPainter sw(ib, ctrl.quality);
|
||||
DoPaint(sw);
|
||||
w.DrawImage(0, 0, ib);
|
||||
}
|
||||
|
||||
void App::Sync()
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void App::ToSlider(EditDouble *e, SliderCtrl *slider)
|
||||
{
|
||||
double v = ~*e;
|
||||
*slider <<= fround(1000.0 * (v - e->GetMin()) / (e->GetMax() - e->GetMin()));
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void App::ToEdit(EditDouble *e, SliderCtrl *slider)
|
||||
{
|
||||
int x = ~*slider;
|
||||
*e <<= x * (e->GetMax() - e->GetMin()) / 1000.0 + e->GetMin();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void App::Pair(EditDouble& e, SliderCtrl& slider)
|
||||
{
|
||||
e <<= THISBACK2(ToSlider, &e, &slider);
|
||||
slider <<= THISBACK2(ToEdit, &e, &slider);
|
||||
slider.MinMax(0, 1000);
|
||||
}
|
||||
|
||||
void App::ToSlider()
|
||||
{
|
||||
ToSlider(&ctrl.rotate, &ctrl.rotate_slider);
|
||||
ToSlider(&ctrl.scale, &ctrl.scale_slider);
|
||||
ToSlider(&ctrl.scale_x, &ctrl.scale_x_slider);
|
||||
ToSlider(&ctrl.translate_x, &ctrl.translate_x_slider);
|
||||
ToSlider(&ctrl.translate_y, &ctrl.translate_y_slider);
|
||||
ToSlider(&ctrl.opacity, &ctrl.opacity_slider);
|
||||
}
|
||||
|
||||
void App::Reset()
|
||||
{
|
||||
ctrl.rotate <<= ctrl.translate_x <<= ctrl.translate_y <<= 0;
|
||||
ctrl.scale <<= ctrl.scale_x <<= ctrl.opacity <<= 1.0;
|
||||
ctrl.painting = false;
|
||||
ctrl.quality = MODE_ANTIALIASED;
|
||||
ctrl.linejoin <<= LINEJOIN_MITER;
|
||||
ctrl.linecap <<= LINECAP_BUTT;
|
||||
ToSlider();
|
||||
}
|
||||
|
||||
void App::Serialize(Stream& s)
|
||||
{
|
||||
s
|
||||
% ctrl.rotate % ctrl.rotate_slider
|
||||
% ctrl.scale % ctrl.scale_slider
|
||||
% ctrl.scale_x % ctrl.scale_x_slider
|
||||
% ctrl.translate_x % ctrl.translate_x_slider
|
||||
% ctrl.translate_y % ctrl.translate_y_slider
|
||||
% ctrl.opacity % ctrl.opacity_slider
|
||||
% ctrl.painting % ctrl.quality % ctrl.transparent
|
||||
;
|
||||
}
|
||||
|
||||
App::App() {
|
||||
AddFrame(split);
|
||||
split.Left(list, HorzLayoutZoom(200));
|
||||
list.WhenSel = THISBACK(Sync);
|
||||
list.AddColumn();
|
||||
list.NoHeader();
|
||||
for(int i = 0; i < Examples().GetCount(); i++)
|
||||
list.Add(Examples()[i].name);
|
||||
list.FindSetCursor(LoadFile(ConfigFile("last")));
|
||||
Sync();
|
||||
Sizeable().Zoomable();
|
||||
ctrl.Height(ctrl.GetLayoutSize().cy);
|
||||
CtrlLayout(ctrl);
|
||||
list.InsertFrame(0, ctrl);
|
||||
Pair(ctrl.rotate, ctrl.rotate_slider);
|
||||
Pair(ctrl.scale, ctrl.scale_slider);
|
||||
Pair(ctrl.scale_x, ctrl.scale_x_slider);
|
||||
Pair(ctrl.translate_x, ctrl.translate_x_slider);
|
||||
Pair(ctrl.translate_y, ctrl.translate_y_slider);
|
||||
Pair(ctrl.opacity, ctrl.opacity_slider);
|
||||
ctrl.linecap.Add(LINECAP_BUTT, "Butt caps");
|
||||
ctrl.linecap.Add(LINECAP_SQUARE, "Square caps");
|
||||
ctrl.linecap.Add(LINECAP_ROUND, "Round caps");
|
||||
ctrl.linejoin.Add(LINEJOIN_MITER, "Miter joins");
|
||||
ctrl.linejoin.Add(LINEJOIN_ROUND, "Round joins");
|
||||
ctrl.linejoin.Add(LINEJOIN_BEVEL, "Bevel joins");
|
||||
ctrl.linecap <<= ctrl.linejoin <<= ctrl.painting <<= ctrl.quality <<= ctrl.transparent <<= THISBACK(Sync);
|
||||
ctrl.reset <<= THISBACK(Reset);
|
||||
ctrl.benchmark <<= THISBACK(Benchmark);
|
||||
ctrl.print <<= THISBACK(Print);
|
||||
Reset();
|
||||
LoadFromFile(*this);
|
||||
Title("Painter 2.0");
|
||||
|
||||
if (!FileExists(file)) {
|
||||
FileSel fsel;
|
||||
|
||||
fsel.Type("Svg file", "*.svg");
|
||||
fsel <<= Nvl(file, GetHomeDirectory());
|
||||
if(fsel.ExecuteOpen("Choose file"))
|
||||
file <<= ~fsel;
|
||||
}
|
||||
}
|
||||
|
||||
App::~App()
|
||||
{
|
||||
if(list.IsCursor())
|
||||
SaveFile(ConfigFile("last"), list.GetKey());
|
||||
StoreToFile(*this);
|
||||
}
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
App().Run();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue