Starts code to add support to cdr and svg to fpvectorial

git-svn-id: trunk@15793 -
This commit is contained in:
sekelsenmat 2010-08-13 08:24:27 +00:00
parent ca6ecd9a80
commit 89593064f7
9 changed files with 355 additions and 1 deletions

7
.gitattributes vendored
View File

@ -2373,10 +2373,16 @@ packages/fpmkunit/fpmake.pp svneol=native#text/plain
packages/fpmkunit/src/fpmkunit.pp svneol=native#text/plain
packages/fpvectorial/Makefile svneol=native#text/plain
packages/fpvectorial/Makefile.fpc svneol=native#text/plain
packages/fpvectorial/examples/cdr2svg_mainform.lfm svneol=native#text/plain
packages/fpvectorial/examples/cdr2svg_mainform.pas svneol=native#text/plain
packages/fpvectorial/examples/cdr2svg_visual.ico -text
packages/fpvectorial/examples/cdr2svg_visual.lpi svneol=native#text/plain
packages/fpvectorial/examples/cdr2svg_visual.lpr svneol=native#text/plain
packages/fpvectorial/fpmake.pp svneol=native#text/plain
packages/fpvectorial/src/avisocncgcodereader.pas svneol=native#text/plain
packages/fpvectorial/src/avisocncgcodewriter.pas svneol=native#text/plain
packages/fpvectorial/src/avisozlib.pas svneol=native#text/plain
packages/fpvectorial/src/cdrvectorialreader.pas svneol=native#text/plain
packages/fpvectorial/src/fpvectbuildunit.pas svneol=native#text/plain
packages/fpvectorial/src/fpvectorial.pas svneol=native#text/plain
packages/fpvectorial/src/fpvtocanvas.pas svneol=native#text/plain
@ -2384,6 +2390,7 @@ packages/fpvectorial/src/pdfvectorialreader.pas svneol=native#text/plain
packages/fpvectorial/src/pdfvrlexico.pas svneol=native#text/plain
packages/fpvectorial/src/pdfvrsemantico.pas svneol=native#text/plain
packages/fpvectorial/src/pdfvrsintatico.pas svneol=native#text/plain
packages/fpvectorial/src/svgvectorialwriter.pas svneol=native#text/plain
packages/fuse/Makefile svneol=native#text/plain
packages/fuse/Makefile.fpc svneol=native#text/plain
packages/fuse/fpmake_disabled.pp svneol=native#text/plain

View File

@ -15,7 +15,7 @@ units=fpvectbuildunit
exampledirs=
implicitunits= avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial \
fpvtocanvas pdfvectorialreader pdfvrlexico pdfvrsemantico \
pdfvrsintatico
pdfvrsintatico cdrvectorialreader svgvectorialwriter
[compiler]
includedir=src

View File

@ -0,0 +1,80 @@
object Form1: TForm1
Left = 216
Height = 240
Top = 192
Width = 240
Caption = 'cdr2svg'
ClientHeight = 240
ClientWidth = 240
LCLVersion = '0.9.29'
object Label1: TLabel
Left = 8
Height = 14
Top = 80
Width = 215
Caption = 'Location of the Input Corel Draw (*.cdr) file:'
ParentColor = False
end
object Label2: TLabel
Left = 8
Height = 59
Top = 8
Width = 224
AutoSize = False
Caption = 'This example project uses fpvectorial to convert a Corel Draw file (*.cdr) to an SVG (*.svg) vectorial graphics file.'
ParentColor = False
WordWrap = True
end
object editInput: TFileNameEdit
Left = 8
Height = 21
Top = 104
Width = 192
DialogOptions = []
FilterIndex = 0
HideDirectories = False
ButtonWidth = 23
NumGlyphs = 0
MaxLength = 0
TabOrder = 0
end
object Label3: TLabel
Left = 8
Height = 14
Top = 138
Width = 154
Caption = 'Full path of the Output SVG file:'
ParentColor = False
end
object editOutput: TFileNameEdit
Left = 8
Height = 21
Top = 160
Width = 192
DialogOptions = []
FilterIndex = 0
HideDirectories = False
ButtonWidth = 23
NumGlyphs = 0
MaxLength = 0
TabOrder = 1
end
object buttonConvert: TButton
Left = 32
Height = 25
Top = 200
Width = 75
Caption = 'Convert'
OnClick = buttonConvertClick
TabOrder = 2
end
object buttonQuit: TButton
Left = 136
Height = 25
Top = 200
Width = 75
Caption = 'Quit'
OnClick = buttonQuitClick
TabOrder = 3
end
end

View File

@ -0,0 +1,66 @@
unit cdr2svg_mainform;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
EditBtn;
type
{ TForm1 }
TForm1 = class(TForm)
buttonConvert: TButton;
buttonQuit: TButton;
editInput: TFileNameEdit;
editOutput: TFileNameEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure buttonConvertClick(Sender: TObject);
procedure buttonQuitClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
uses
fpvectorial, cdrvectorialreader, svgvectorialwriter;
{$R *.lfm}
{ TForm1 }
procedure TForm1.buttonQuitClick(Sender: TObject);
begin
Close;
end;
procedure TForm1.buttonConvertClick(Sender: TObject);
var
Vec: TvVectorialDocument;
begin
// First check the in input
// todo...
// Now convert
Vec := TvVectorialDocument.Create;
try
Vec.ReadFromFile(editInput.FileName, vfPDF);
Vec.WriteToFile(editOutPut.FileName, vfGCodeAvisoCNCPrototipoV5);
finally
Vec.Free;
end;
end;
end.

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -0,0 +1,85 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<Title Value="cdr2svg_visual"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="cdr2svg_visual.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="cdr2svg_visual"/>
</Unit0>
<Unit1>
<Filename Value="cdr2svg_mainform.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="cdr2svg_mainform"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="9"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="cdr2svg_visual"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)\"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,20 @@
program cdr2svg_visual;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, cdr2svg_mainform
{ you can add units after this };
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -0,0 +1,53 @@
{
cdrvectorialreader.pas
Reads a Corel Draw vectorial file
CDR file format specification obtained from:
ADOBE SYSTEMS INCORPORATED. PDF Reference: Adobe®
Portable Document Format. San Jose, 2006. (Sixth edition).
AUTHORS: Felipe Monteiro de Carvalho
License: The same modified LGPL as the Free Pascal RTL
See the file COPYING.modifiedLGPL for more details
}
unit cdrvectorialreader;
{$ifdef fpc}
{$mode delphi}
{$endif}
interface
uses
Classes, SysUtils,
pdfvrlexico, pdfvrsintatico, pdfvrsemantico, avisozlib,
fpvectorial;
type
{ TvCDRVectorialReader }
TvCDRVectorialReader = class(TvCustomVectorialReader)
public
{ General reading methods }
procedure ReadFromStream(AStream: TStream; AData: TvVectorialDocument); override;
end;
implementation
{ TvPDFVectorialReader }
procedure TvCDRVectorialReader.ReadFromStream(AStream: TStream;
AData: TvVectorialDocument);
begin
end;
initialization
RegisterVectorialReader(TvCDRVectorialReader, vfCorelDrawCDR);
end.

View File

@ -0,0 +1,43 @@
{
Writes an SVG Document
License: The same modified LGPL as the Free Pascal RTL
See the file COPYING.modifiedLGPL for more details
AUTHORS: Felipe Monteiro de Carvalho
}
unit svgvectorialwriter;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils,
fpvectorial;
type
{ TvSVGVectorialWriter }
TvSVGVectorialWriter = class(TvCustomVectorialWriter)
public
{ General reading methods }
procedure WriteToStream(AStream: TStream; AData: TvVectorialDocument); virtual;
end;
implementation
{ TvSVGVectorialWriter }
procedure TvSVGVectorialWriter.WriteToStream(AStream: TStream;
AData: TvVectorialDocument);
begin
end;
initialization
RegisterVectorialWriter(TvSVGVectorialWriter, vfSVG);
end.