#1 Re: mORMot 1 » Code integration / ORM » 2013-03-27 16:10:00

Hi,
Let say I have a table

/// table used for the Babies queries
TSQLPeople = class(TSQLRecord)
  private
    fName: RawUTF8;
    fCreatedOn: TCreateTime;
  published
    property Name: RawUTF8 read fName write fName;
    property CreatedOn: TCreateTime read fCreatedOn write fCreatedOn;
end;

and I want to build a tree where root nodes will represents dates where some people were added into the DB. Typicaly I could get this information using "SELECT DISTINCT CreatedOn FROM People". So how to get this in mORMot framework?

Thanks

#2 Re: PDF Engine » World Transformation problem » 2013-02-16 16:34:00

Yesterday evening I played for a while with this and I think it is possible to implement full conversion/transformation. I think I could do that with your help... Of course if you want to...

#3 Re: PDF Engine » PolyDraw problem » 2013-02-16 16:26:20

Is there really no one who could check it out?

#4 PDF Engine » World Transformation problem » 2013-02-15 20:03:51

CoMPi
Replies: 2

I found out that world transformation does not work properly. More precisely scaling and translating works great but rotating ans shearing does not. In my opinion the problem is caused by the I2X and I2Y functions of TPdfCanvas because these functions does not perform full conversion. They use only eM11, eM22, eDx and eDy factors of a XFORM matrix. My question is: why full conversion is not used?

#5 Re: PDF Engine » PolyDraw problem » 2013-02-15 19:26:22

Here is my implementation of PolyDraw. As Arnaud wrote, the code must be put into EnumEMFFunc() function. I would like someone to check it out.

  EMR_POLYDRAW: begin
    if not pen.null then
      E.NeedPen;
    types := Pointer(Integer(@PEMRPolyDraw(R)^.aptl[0]) + PEMRPolyDraw(R)^.cptl * SizeOf(TPoint));
    i := 0;
    while i < PEMRPolyDraw(R)^.cptl do begin
      case types^[i] of
        PT_LINETO: E.Canvas.LineToI(PEMRPolyDraw(R)^.aptl[i].X,PEMRPolyDraw(R)^.aptl[i].Y);
        PT_BEZIERTO: begin
            E.Canvas.CurveToCI(PEMRPolyDraw(R)^.aptl[i+1].X,PEMRPolyDraw(R)^.aptl[i+1].Y,
              PEMRPolyDraw(R)^.aptl[i+2].X,PEMRPolyDraw(R)^.aptl[i+2].Y,
              PEMRPolyDraw(R)^.aptl[i+3].X,PEMRPolyDraw(R)^.aptl[i+3].Y);
            Inc(i, 3);
          end;
        PT_MOVETO: begin
            E.Canvas.MoveToI(PEMRPolyDraw(R)^.aptl[i].X,PEMRPolyDraw(R)^.aptl[i].Y);
            Moved := PEMRPolyDraw(R)^.aptl[i];
          end;
      else  // PT_CLOSEFIGURE
        E.Canvas.LineToI(PEMRPolyDraw(R)^.aptl[i].X,PEMRPolyDraw(R)^.aptl[i].Y);
        E.Canvas.LineToI(Moved.X, Moved.Y);
        Moved := PEMRPolyDraw(R)^.aptl[i];
      end;
      Inc(i);
    end;
    Moved := PEMRPolyDraw(R)^.aptl[PEMRPolyDraw(R)^.cptl - 1];
    if not E.Canvas.FNewPath then
      if not pen.null then
        E.Canvas.Stroke else
        E.Canvas.NewPath;
  end;

  EMR_POLYDRAW16: begin
    if not pen.null then
      E.NeedPen;
    types := Pointer(Integer(@PEMRPolyDraw16(R)^.apts[0]) + PEMRPolyDraw16(R)^.cpts * SizeOf(TSmallPoint));
    i := 0;
    while i < PEMRPolyDraw16(R)^.cpts do begin
      case types^[i] of
        PT_LINETO: E.Canvas.LineToI(PEMRPolyDraw16(R)^.apts[i].X,PEMRPolyDraw16(R)^.apts[i].Y);
        PT_BEZIERTO: begin
            E.Canvas.CurveToCI(PEMRPolyDraw16(R)^.apts[i+1].X,PEMRPolyDraw16(R)^.apts[i+1].Y,
              PEMRPolyDraw16(R)^.apts[i+2].X,PEMRPolyDraw16(R)^.apts[i+2].Y,
              PEMRPolyDraw16(R)^.apts[i+3].X,PEMRPolyDraw16(R)^.apts[i+3].Y);
            Inc(i, 2);
          end;
        PT_MOVETO: begin
            E.Canvas.MoveToI(PEMRPolyDraw16(R)^.apts[i].X,PEMRPolyDraw16(R)^.apts[i].Y);
            Moved := Point(PEMRPolyDraw16(R)^.apts[i].X, PEMRPolyDraw16(R)^.apts[i].Y);
          end;
      else  // PT_CLOSEFIGURE
        E.Canvas.LineToI(PEMRPolyDraw16(R)^.apts[i].X,PEMRPolyDraw16(R)^.apts[i].Y);
        E.Canvas.LineToI(Moved.X, Moved.Y);
        Moved := Point(PEMRPolyDraw16(R)^.apts[i].X, PEMRPolyDraw16(R)^.apts[i].Y);
      end;
      Inc(i);
    end;
    Moved := Point(PEMRPolyDraw16(R)^.apts[PEMRPolyDraw16(R)^.cpts - 1].X, PEMRPolyDraw16(R)^.apts[PEMRPolyDraw16(R)^.cpts - 1].Y);
    if not E.Canvas.FNewPath then
      if not pen.null then
        E.Canvas.Stroke else
        E.Canvas.NewPath;
  end;

#6 PDF Engine » PolyDraw problem » 2013-02-15 14:16:26

CoMPi
Replies: 5

Hi everyone.

Below is a copy of my post which was placed in 'SynPdf library 1.18' thread - wrong place, I think. So I copy it here.

First, I would like to thank you for you great work! Arnaud, I know that you had to spend a lot of time to develop such a great library.
Now, go back to my problem. I tried to create a pdf file using SynPDF and everything went great ... untill I used PolyDraw. It is crucial for me because the PolyDraw method is a base of my framework. So my question is: is it possible to use  the method in PDF files created by SyPDF? If so, how to do that? If not, are you going to implement the method in the near future?
Once again, thank you for your great work!

Piotr

Board footer

Powered by FluxBB