diff --git a/.gitattributes b/.gitattributes index f9d8e0d1e6..474ac467aa 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/packages/fpvectorial/Makefile.fpc b/packages/fpvectorial/Makefile.fpc index 713c7fbe36..47147b7013 100644 --- a/packages/fpvectorial/Makefile.fpc +++ b/packages/fpvectorial/Makefile.fpc @@ -15,7 +15,7 @@ units=fpvectbuildunit exampledirs= implicitunits= avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial \ fpvtocanvas pdfvectorialreader pdfvrlexico pdfvrsemantico \ - pdfvrsintatico + pdfvrsintatico cdrvectorialreader svgvectorialwriter [compiler] includedir=src diff --git a/packages/fpvectorial/examples/cdr2svg_mainform.lfm b/packages/fpvectorial/examples/cdr2svg_mainform.lfm new file mode 100644 index 0000000000..aa720d40e2 --- /dev/null +++ b/packages/fpvectorial/examples/cdr2svg_mainform.lfm @@ -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 diff --git a/packages/fpvectorial/examples/cdr2svg_mainform.pas b/packages/fpvectorial/examples/cdr2svg_mainform.pas new file mode 100644 index 0000000000..9096afe2e2 --- /dev/null +++ b/packages/fpvectorial/examples/cdr2svg_mainform.pas @@ -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. + diff --git a/packages/fpvectorial/examples/cdr2svg_visual.ico b/packages/fpvectorial/examples/cdr2svg_visual.ico new file mode 100644 index 0000000000..0341321b5d Binary files /dev/null and b/packages/fpvectorial/examples/cdr2svg_visual.ico differ diff --git a/packages/fpvectorial/examples/cdr2svg_visual.lpi b/packages/fpvectorial/examples/cdr2svg_visual.lpi new file mode 100644 index 0000000000..add68249c1 --- /dev/null +++ b/packages/fpvectorial/examples/cdr2svg_visual.lpi @@ -0,0 +1,85 @@ + + + + + + + + + <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> diff --git a/packages/fpvectorial/examples/cdr2svg_visual.lpr b/packages/fpvectorial/examples/cdr2svg_visual.lpr new file mode 100644 index 0000000000..aef4846c5f --- /dev/null +++ b/packages/fpvectorial/examples/cdr2svg_visual.lpr @@ -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. + diff --git a/packages/fpvectorial/src/cdrvectorialreader.pas b/packages/fpvectorial/src/cdrvectorialreader.pas new file mode 100644 index 0000000000..ab8d0fb325 --- /dev/null +++ b/packages/fpvectorial/src/cdrvectorialreader.pas @@ -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. + diff --git a/packages/fpvectorial/src/svgvectorialwriter.pas b/packages/fpvectorial/src/svgvectorialwriter.pas new file mode 100644 index 0000000000..cafd26c782 --- /dev/null +++ b/packages/fpvectorial/src/svgvectorialwriter.pas @@ -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. +