From d99960207b1a7ad62654da3afe1abd446fdf0e3a Mon Sep 17 00:00:00 2001 From: jesus Date: Fri, 11 Nov 2011 08:37:23 +0000 Subject: [PATCH] LazReport, support in pdf export for roundrect shadows git-svn-id: trunk@33473 - --- .gitattributes | 1 + .../samples/editor/frroundrecttester.lrf | 634 ++++++++++++++++++ .../source/addons/pdfexport/lr_e_pdf.pas | 39 +- 3 files changed, 660 insertions(+), 14 deletions(-) create mode 100644 components/lazreport/samples/editor/frroundrecttester.lrf diff --git a/.gitattributes b/.gitattributes index da6d39fc39..3f152275f2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1531,6 +1531,7 @@ components/lazreport/samples/editor/db/companies.dbf -text components/lazreport/samples/editor/db/countries.dbf -text components/lazreport/samples/editor/db/disco.dbf -text components/lazreport/samples/editor/db/disco.mdx -text +components/lazreport/samples/editor/frroundrecttester.lrf svneol=native#text/xml components/lazreport/samples/editor/languages/calleditorwithpkg.de.po svneol=native#text/plain components/lazreport/samples/editor/languages/calleditorwithpkg.es.po svneol=native#text/plain components/lazreport/samples/editor/languages/calleditorwithpkg.fr.po svneol=native#text/plain diff --git a/components/lazreport/samples/editor/frroundrecttester.lrf b/components/lazreport/samples/editor/frroundrecttester.lrf new file mode 100644 index 0000000000..53b30a187c --- /dev/null +++ b/components/lazreport/samples/editor/frroundrecttester.lrf @@ -0,0 +1,634 @@ + + + + + + <Subject Value=""/> + <KeyWords Value=""/> + <Comments Value=""/> + <ReportVersionBuild Value=""/> + <ReportVersionMajor Value=""/> + <ReportVersionMinor Value=""/> + <ReportVersionRelease Value=""/> + <ReportAutor Value=""/> + <Pages> + <PrintToDefault Value="False"/> + <DoublePass Value="True"/> + <SelectedPrinter Value="Microsoft Office Document Image Writer"/> + <PageCount Value="1"/> + <Page1> + <Name Value="Page1"/> + <ClassName Value="TfrPageReport"/> + <Visible Value="1"/> + <Width Value="1"/> + <Height Value="1" PageType="0"/> + <PgSize Value="9"/> + <Margins> + <left Value="0"/> + <Top Value="0"/> + <Right Value="0"/> + <Bottom Value="0"/> + </Margins> + <Orientation Value="poPortrait"/> + <UseMargins Value="True"/> + <PrintToPrevPage Value="False"/> + <ColCount Value="1"/> + <ColGap Value="0"/> + <LayoutOrder Value="loColumns"/> + <ObjectCount Value="12"/> + <Object1> + <Name Value="RoundRect1"/> + <ClassName Value="TfrRoundRectView"/> + <Visible Value="1"/> + <Typ Value="gtAddIn"/> + <StreamMode Value="0"/> + <Size> + <Left Value="56"/> + <Top Value="44"/> + <Width Value="140"/> + <Height Value="90"/> + </Size> + <Flags Value="3"/> + <FillColor Value="clNone"/> + <Frames> + <FrameColor Value="clBlack"/> + <FrameStyle Value="frsSolid"/> + <FrameWidth Value="1"/> + <FrameBorders Value=""/> + </Frames> + <Data> + <Format Value="558"/> + <FormatStr Value=""/> + <Memo Value="Curva 10 Ancho de sombra 6 Sin enmarcar "/> + <Script Value=""/> + <ShowGradian Value="0"/> + <GradianStyle Value="gsHorizontal"/> + <ShadowColor Value="clGray"/> + <ShadowWidth Value="6"/> + <RoundRect Value="1"/> + <RoundRectCurve Value="10"/> + </Data> + <Font> + <Name Value="Arial"/> + <Size Value="10"/> + <Color Value="clBlack"/> + <Charset Value="0"/> + <Style Value=""/> + </Font> + <Highlight> + <FontStyle Value="2"/> + <FontColor Value="clBlack"/> + <FillColor Value="clWhite"/> + <HighlightStr Value=""/> + </Highlight> + <Alignment Value="taLeftJustify"/> + <Layout Value="tlTop"/> + <Angle Value="0"/> + </Object1> + <Object2> + <Name Value="RoundRect2"/> + <ClassName Value="TfrRoundRectView"/> + <Visible Value="1"/> + <Typ Value="gtAddIn"/> + <StreamMode Value="0"/> + <Size> + <Left Value="212"/> + <Top Value="44"/> + <Width Value="140"/> + <Height Value="90"/> + </Size> + <Flags Value="3"/> + <FillColor Value="clNone"/> + <Frames> + <FrameColor Value="clRed"/> + <FrameStyle Value="frsSolid"/> + <FrameWidth Value="1"/> + <FrameBorders Value="frbLeft,frbTop,frbRight,frbBottom"/> + </Frames> + <Data> + <Format Value="558"/> + <FormatStr Value=""/> + <Memo Value="Curva 10 Ancho de sombra 6 Enmarcado "/> + <Script Value=""/> + <ShowGradian Value="0"/> + <GradianStyle Value="gsHorizontal"/> + <ShadowColor Value="clGray"/> + <ShadowWidth Value="6"/> + <RoundRect Value="1"/> + <RoundRectCurve Value="10"/> + </Data> + <Font> + <Name Value="Arial"/> + <Size Value="10"/> + <Color Value="clBlack"/> + <Charset Value="0"/> + <Style Value=""/> + </Font> + <Highlight> + <FontStyle Value="2"/> + <FontColor Value="clBlack"/> + <FillColor Value="clWhite"/> + <HighlightStr Value=""/> + </Highlight> + <Alignment Value="taLeftJustify"/> + <Layout Value="tlTop"/> + <Angle Value="0"/> + </Object2> + <Object3> + <Name Value="RoundRect3"/> + <ClassName Value="TfrRoundRectView"/> + <Visible Value="1"/> + <Typ Value="gtAddIn"/> + <StreamMode Value="0"/> + <Size> + <Left Value="368"/> + <Top Value="44"/> + <Width Value="140"/> + <Height Value="90"/> + </Size> + <Flags Value="3"/> + <FillColor Value="clYellow"/> + <Frames> + <FrameColor Value="clBlack"/> + <FrameStyle Value="frsSolid"/> + <FrameWidth Value="1"/> + <FrameBorders Value="frbLeft,frbTop,frbRight,frbBottom"/> + </Frames> + <Data> + <Format Value="558"/> + <FormatStr Value=""/> + <Memo Value="Curva 20 Ancho de sombra 10 Enmarcado "/> + <Script Value=""/> + <ShowGradian Value="0"/> + <GradianStyle Value="gsHorizontal"/> + <ShadowColor Value="clGray"/> + <ShadowWidth Value="10"/> + <RoundRect Value="1"/> + <RoundRectCurve Value="20"/> + </Data> + <Font> + <Name Value="Arial"/> + <Size Value="10"/> + <Color Value="clBlack"/> + <Charset Value="0"/> + <Style Value=""/> + </Font> + <Highlight> + <FontStyle Value="2"/> + <FontColor Value="clBlack"/> + <FillColor Value="clWhite"/> + <HighlightStr Value=""/> + </Highlight> + <Alignment Value="taLeftJustify"/> + <Layout Value="tlTop"/> + <Angle Value="0"/> + </Object3> + <Object4> + <Name Value="RoundRect4"/> + <ClassName Value="TfrRoundRectView"/> + <Visible Value="1"/> + <Typ Value="gtAddIn"/> + <StreamMode Value="0"/> + <Size> + <Left Value="60"/> + <Top Value="160"/> + <Width Value="140"/> + <Height Value="90"/> + </Size> + <Flags Value="3"/> + <FillColor Value="clNone"/> + <Frames> + <FrameColor Value="clBlack"/> + <FrameStyle Value="frsSolid"/> + <FrameWidth Value="1"/> + <FrameBorders Value=""/> + </Frames> + <Data> + <Format Value="558"/> + <FormatStr Value=""/> + <Memo Value="Curva disabled Ancho de sombra 6 Sin enmarcar "/> + <Script Value=""/> + <ShowGradian Value="0"/> + <GradianStyle Value="gsHorizontal"/> + <ShadowColor Value="clGray"/> + <ShadowWidth Value="6"/> + <RoundRect Value="0"/> + <RoundRectCurve Value="10"/> + </Data> + <Font> + <Name Value="Arial"/> + <Size Value="10"/> + <Color Value="clBlack"/> + <Charset Value="0"/> + <Style Value=""/> + </Font> + <Highlight> + <FontStyle Value="2"/> + <FontColor Value="clBlack"/> + <FillColor Value="clWhite"/> + <HighlightStr Value=""/> + </Highlight> + <Alignment Value="taLeftJustify"/> + <Layout Value="tlTop"/> + <Angle Value="0"/> + </Object4> + <Object5> + <Name Value="RoundRect5"/> + <ClassName Value="TfrRoundRectView"/> + <Visible Value="1"/> + <Typ Value="gtAddIn"/> + <StreamMode Value="0"/> + <Size> + <Left Value="216"/> + <Top Value="160"/> + <Width Value="140"/> + <Height Value="90"/> + </Size> + <Flags Value="3"/> + <FillColor Value="clNone"/> + <Frames> + <FrameColor Value="clBlack"/> + <FrameStyle Value="frsSolid"/> + <FrameWidth Value="1"/> + <FrameBorders Value="frbLeft,frbTop,frbRight,frbBottom"/> + </Frames> + <Data> + <Format Value="558"/> + <FormatStr Value=""/> + <Memo Value="Curva disabled Ancho de sombra 6 Enmarcado "/> + <Script Value=""/> + <ShowGradian Value="0"/> + <GradianStyle Value="gsHorizontal"/> + <ShadowColor Value="clGray"/> + <ShadowWidth Value="6"/> + <RoundRect Value="0"/> + <RoundRectCurve Value="10"/> + </Data> + <Font> + <Name Value="Arial"/> + <Size Value="10"/> + <Color Value="clBlack"/> + <Charset Value="0"/> + <Style Value=""/> + </Font> + <Highlight> + <FontStyle Value="2"/> + <FontColor Value="clBlack"/> + <FillColor Value="clWhite"/> + <HighlightStr Value=""/> + </Highlight> + <Alignment Value="taLeftJustify"/> + <Layout Value="tlTop"/> + <Angle Value="0"/> + </Object5> + <Object6> + <Name Value="RoundRect6"/> + <ClassName Value="TfrRoundRectView"/> + <Visible Value="1"/> + <Typ Value="gtAddIn"/> + <StreamMode Value="0"/> + <Size> + <Left Value="372"/> + <Top Value="160"/> + <Width Value="140"/> + <Height Value="90"/> + </Size> + <Flags Value="3"/> + <FillColor Value="clAqua"/> + <Frames> + <FrameColor Value="clBlack"/> + <FrameStyle Value="frsSolid"/> + <FrameWidth Value="2"/> + <FrameBorders Value="frbLeft,frbTop,frbRight,frbBottom"/> + </Frames> + <Data> + <Format Value="558"/> + <FormatStr Value=""/> + <Memo Value="Curva disabled Ancho de sombra 10 Enmarcado "/> + <Script Value=""/> + <ShowGradian Value="0"/> + <GradianStyle Value="gsHorizontal"/> + <ShadowColor Value="clGray"/> + <ShadowWidth Value="10"/> + <RoundRect Value="0"/> + <RoundRectCurve Value="20"/> + </Data> + <Font> + <Name Value="Arial"/> + <Size Value="10"/> + <Color Value="clBlack"/> + <Charset Value="0"/> + <Style Value=""/> + </Font> + <Highlight> + <FontStyle Value="2"/> + <FontColor Value="clBlack"/> + <FillColor Value="clWhite"/> + <HighlightStr Value=""/> + </Highlight> + <Alignment Value="taLeftJustify"/> + <Layout Value="tlTop"/> + <Angle Value="0"/> + </Object6> + <Object7> + <Name Value="RoundRect7"/> + <ClassName Value="TfrRoundRectView"/> + <Visible Value="1"/> + <Typ Value="gtAddIn"/> + <StreamMode Value="0"/> + <Size> + <Left Value="60"/> + <Top Value="272"/> + <Width Value="140"/> + <Height Value="90"/> + </Size> + <Flags Value="3"/> + <FillColor Value="clNone"/> + <Frames> + <FrameColor Value="clBlack"/> + <FrameStyle Value="frsSolid"/> + <FrameWidth Value="1"/> + <FrameBorders Value=""/> + </Frames> + <Data> + <Format Value="558"/> + <FormatStr Value=""/> + <Memo Value="Degradado Vertical Sin enmarcar "/> + <Script Value=""/> + <ShowGradian Value="1"/> + <GradianStyle Value="gsHorizontal"/> + <ShadowColor Value="clGray"/> + <ShadowWidth Value="6"/> + <RoundRect Value="0"/> + <RoundRectCurve Value="0"/> + </Data> + <Font> + <Name Value="Arial"/> + <Size Value="10"/> + <Color Value="clBlack"/> + <Charset Value="0"/> + <Style Value=""/> + </Font> + <Highlight> + <FontStyle Value="2"/> + <FontColor Value="clBlack"/> + <FillColor Value="clWhite"/> + <HighlightStr Value=""/> + </Highlight> + <Alignment Value="taLeftJustify"/> + <Layout Value="tlTop"/> + <Angle Value="0"/> + </Object7> + <Object8> + <Name Value="RoundRect8"/> + <ClassName Value="TfrRoundRectView"/> + <Visible Value="1"/> + <Typ Value="gtAddIn"/> + <StreamMode Value="0"/> + <Size> + <Left Value="216"/> + <Top Value="272"/> + <Width Value="140"/> + <Height Value="90"/> + </Size> + <Flags Value="3"/> + <FillColor Value="clNone"/> + <Frames> + <FrameColor Value="clBlack"/> + <FrameStyle Value="frsSolid"/> + <FrameWidth Value="1"/> + <FrameBorders Value="frbLeft,frbTop,frbRight,frbBottom"/> + </Frames> + <Data> + <Format Value="558"/> + <FormatStr Value=""/> + <Memo Value="Degradado Horizontal Enmarcado "/> + <Script Value=""/> + <ShowGradian Value="1"/> + <GradianStyle Value="gsVertical"/> + <ShadowColor Value="clGray"/> + <ShadowWidth Value="6"/> + <RoundRect Value="0"/> + <RoundRectCurve Value="0"/> + </Data> + <Font> + <Name Value="Arial"/> + <Size Value="10"/> + <Color Value="clBlack"/> + <Charset Value="0"/> + <Style Value=""/> + </Font> + <Highlight> + <FontStyle Value="2"/> + <FontColor Value="clBlack"/> + <FillColor Value="clWhite"/> + <HighlightStr Value=""/> + </Highlight> + <Alignment Value="taLeftJustify"/> + <Layout Value="tlTop"/> + <Angle Value="0"/> + </Object8> + <Object9> + <Name Value="RoundRect9"/> + <ClassName Value="TfrRoundRectView"/> + <Visible Value="1"/> + <Typ Value="gtAddIn"/> + <StreamMode Value="0"/> + <Size> + <Left Value="376"/> + <Top Value="272"/> + <Width Value="140"/> + <Height Value="90"/> + </Size> + <Flags Value="3"/> + <FillColor Value="clNone"/> + <Frames> + <FrameColor Value="clBlack"/> + <FrameStyle Value="frsSolid"/> + <FrameWidth Value="1"/> + <FrameBorders Value="frbLeft,frbTop,frbRight,frbBottom"/> + </Frames> + <Data> + <Format Value="558"/> + <FormatStr Value=""/> + <Memo Value="degradado Eliptico Enmarcado "/> + <Script Value=""/> + <ShowGradian Value="1"/> + <GradianStyle Value="gsElliptic"/> + <ShadowColor Value="clGray"/> + <ShadowWidth Value="10"/> + <RoundRect Value="0"/> + <RoundRectCurve Value="0"/> + </Data> + <Font> + <Name Value="Arial"/> + <Size Value="10"/> + <Color Value="clBlack"/> + <Charset Value="0"/> + <Style Value=""/> + </Font> + <Highlight> + <FontStyle Value="2"/> + <FontColor Value="clBlack"/> + <FillColor Value="clWhite"/> + <HighlightStr Value=""/> + </Highlight> + <Alignment Value="taLeftJustify"/> + <Layout Value="tlTop"/> + <Angle Value="0"/> + </Object9> + <Object10> + <Name Value="RoundRect10"/> + <ClassName Value="TfrRoundRectView"/> + <Visible Value="1"/> + <Typ Value="gtAddIn"/> + <StreamMode Value="0"/> + <Size> + <Left Value="60"/> + <Top Value="384"/> + <Width Value="140"/> + <Height Value="90"/> + </Size> + <Flags Value="3"/> + <FillColor Value="clNone"/> + <Frames> + <FrameColor Value="clBlack"/> + <FrameStyle Value="frsSolid"/> + <FrameWidth Value="1"/> + <FrameBorders Value=""/> + </Frames> + <Data> + <Format Value="558"/> + <FormatStr Value=""/> + <Memo Value="Degradado rectangulol Sin enmarcar "/> + <Script Value=""/> + <ShowGradian Value="1"/> + <GradianStyle Value="gsHorizontal"/> + <ShadowColor Value="clGray"/> + <ShadowWidth Value="6"/> + <RoundRect Value="1"/> + <RoundRectCurve Value="0"/> + </Data> + <Font> + <Name Value="Arial"/> + <Size Value="10"/> + <Color Value="clBlack"/> + <Charset Value="0"/> + <Style Value=""/> + </Font> + <Highlight> + <FontStyle Value="2"/> + <FontColor Value="clBlack"/> + <FillColor Value="clWhite"/> + <HighlightStr Value=""/> + </Highlight> + <Alignment Value="taLeftJustify"/> + <Layout Value="tlTop"/> + <Angle Value="0"/> + </Object10> + <Object11> + <Name Value="RoundRect11"/> + <ClassName Value="TfrRoundRectView"/> + <Visible Value="1"/> + <Typ Value="gtAddIn"/> + <StreamMode Value="0"/> + <Size> + <Left Value="216"/> + <Top Value="384"/> + <Width Value="140"/> + <Height Value="90"/> + </Size> + <Flags Value="3"/> + <FillColor Value="clNone"/> + <Frames> + <FrameColor Value="clBlack"/> + <FrameStyle Value="frsSolid"/> + <FrameWidth Value="1"/> + <FrameBorders Value="frbLeft,frbTop,frbRight,frbBottom"/> + </Frames> + <Data> + <Format Value="558"/> + <FormatStr Value=""/> + <Memo Value="Degradado centro horiz. enmarcado "/> + <Script Value=""/> + <ShowGradian Value="1"/> + <GradianStyle Value="gsHorizontal"/> + <ShadowColor Value="clGray"/> + <ShadowWidth Value="6"/> + <RoundRect Value="1"/> + <RoundRectCurve Value="0"/> + </Data> + <Font> + <Name Value="Arial"/> + <Size Value="10"/> + <Color Value="clBlack"/> + <Charset Value="0"/> + <Style Value=""/> + </Font> + <Highlight> + <FontStyle Value="2"/> + <FontColor Value="clBlack"/> + <FillColor Value="clWhite"/> + <HighlightStr Value=""/> + </Highlight> + <Alignment Value="taLeftJustify"/> + <Layout Value="tlTop"/> + <Angle Value="0"/> + </Object11> + <Object12> + <Name Value="RoundRect12"/> + <ClassName Value="TfrRoundRectView"/> + <Visible Value="1"/> + <Typ Value="gtAddIn"/> + <StreamMode Value="0"/> + <Size> + <Left Value="376"/> + <Top Value="384"/> + <Width Value="140"/> + <Height Value="90"/> + </Size> + <Flags Value="3"/> + <FillColor Value="clNone"/> + <Frames> + <FrameColor Value="clBlack"/> + <FrameStyle Value="frsSolid"/> + <FrameWidth Value="1"/> + <FrameBorders Value="frbLeft,frbTop,frbRight,frbBottom"/> + </Frames> + <Data> + <Format Value="558"/> + <FormatStr Value=""/> + <Memo Value="Degradado centro vert. enmarcado "/> + <Script Value=""/> + <ShowGradian Value="1"/> + <GradianStyle Value="gsHorizontal"/> + <ShadowColor Value="clGray"/> + <ShadowWidth Value="6"/> + <RoundRect Value="1"/> + <RoundRectCurve Value="0"/> + </Data> + <Font> + <Name Value="Arial"/> + <Size Value="10"/> + <Color Value="clBlack"/> + <Charset Value="0"/> + <Style Value=""/> + </Font> + <Highlight> + <FontStyle Value="2"/> + <FontColor Value="clBlack"/> + <FillColor Value="clWhite"/> + <HighlightStr Value=""/> + </Highlight> + <Alignment Value="taLeftJustify"/> + <Layout Value="tlTop"/> + <Angle Value="0"/> + </Object12> + </Page1> + <FVal> + <Count Value="0"/> + </FVal> + <ParentVars Value=""/> + </Pages> + </LazReport> +</CONFIG> diff --git a/components/lazreport/source/addons/pdfexport/lr_e_pdf.pas b/components/lazreport/source/addons/pdfexport/lr_e_pdf.pas index 4ee9264cfd..7e44f3815f 100644 --- a/components/lazreport/source/addons/pdfexport/lr_e_pdf.pas +++ b/components/lazreport/source/addons/pdfexport/lr_e_pdf.pas @@ -354,6 +354,7 @@ procedure TfrTNPDFExportFilter.ShowRoundRect(View: TfrRoundRectView; x, y, h, w: integer); var Data: TShapeData; + SWidth: Integer; begin if view.ShowGradian then @@ -363,22 +364,32 @@ begin else begin - if View.RoundRect then begin + SWidth := Round((View.RoundRectCurve/2) * PDFEscx + 1); + if View.RoundRect then + Data.Radius := SWidth + else + Data.Radius := 0.0; - Data.ShapeType := frstRoundRect; - Data.FillColor := View.FillColor; - Data.FrameColor := View.FrameColor; - Data.FrameWidth := View.FrameWidth; - Data.FrameStyle := View.FrameStyle; - Data.Radius := View.RoundRectCurve div 2; + // draw shadow + Data.ShapeType := frstRoundRect; + Data.FillColor := ColorToRGB(View.ShadowColor); + Data.FrameColor := Data.FillColor; //ColorToRGB(View.FrameColor); + Data.FrameWidth := 0; + Data.FrameStyle := frsSolid; + SWidth := Round(View.ShadowWidth * PDFEscx + 1); + if View.ShadowWidth>0 then + AddShape(Data, x + SWidth, y + SWidth, h - SWidth, w - SWidth); - AddShape(Data, x, y, h, w); - - end else begin - // not supported yet - DefaultShowView(View, x, y, h, w); - - end; + // draw roundrect + Data.ShapeType := frstRoundRect; + Data.FillColor := ColorToRGB(View.FillColor); + if View.Frames=[] then + Data.FrameColor := Data.FillColor + else + Data.FrameColor := ColorToRGB(View.FrameColor); + Data.FrameWidth := View.FrameWidth; + Data.FrameStyle := View.FrameStyle; + AddShape(Data, x, y, h - SWidth, w - SWidth); end; end;