mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
reference: ConsoleDraw headless Draw example
git-svn-id: svn://ultimatepp.org/upp/trunk@1435 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
961df22686
commit
d723d337bd
3 changed files with 55 additions and 0 deletions
16
reference/ConsoleDraw/ConsoleDraw.upp
Normal file
16
reference/ConsoleDraw/ConsoleDraw.upp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
description "Demonstrates head-less Draw application - drawing without GUI\377";
|
||||
|
||||
uses
|
||||
Draw,
|
||||
Painter,
|
||||
plugin\png,
|
||||
RichText,
|
||||
PdfDraw,
|
||||
PdfDraw;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
8
reference/ConsoleDraw/init
Normal file
8
reference/ConsoleDraw/init
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef _ConsoleDraw_icpp_init_stub
|
||||
#define _ConsoleDraw_icpp_init_stub
|
||||
#include "Draw/init"
|
||||
#include "Painter/init"
|
||||
#include "plugin\png/init"
|
||||
#include "RichText/init"
|
||||
#include "PdfDraw/init"
|
||||
#endif
|
||||
31
reference/ConsoleDraw/main.cpp
Normal file
31
reference/ConsoleDraw/main.cpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#include <Painter/Painter.h>
|
||||
#include <RichText/RichText.h>
|
||||
#include <PdfDraw/PdfDraw.h>
|
||||
#include <plugin/png/png.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
void DoDraw(Draw& w)
|
||||
{
|
||||
w.DrawRect(0, 0, 600, 200, White());
|
||||
w.DrawText(0, 0, "Hello world!", Arial(100), Black());
|
||||
}
|
||||
|
||||
CONSOLE_APP_MAIN {
|
||||
{
|
||||
ImagePainter w(600, 100);
|
||||
DoDraw(w);
|
||||
PNGEncoder().SaveFile(GetHomeDirFile("hello.png"), w);
|
||||
}
|
||||
{
|
||||
RichText txt = ParseQTF("[A4 Just a [*/ little] test!");
|
||||
ImagePainter w(1000, 200);
|
||||
w.DrawRect(0, 0, 1000, 200, White());
|
||||
txt.Paint(w, 0, 0, 1000);
|
||||
PNGEncoder().SaveFile(GetHomeDirFile("richtext.png"), w);
|
||||
|
||||
PdfDraw pdf;
|
||||
txt.Paint(pdf, 0, 0, 1000);
|
||||
SaveFile(GetHomeDirFile("richtext.pdf"), pdf.Finish());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue