Explorar o código

* Renamed pixel size DrawImage to DrawImageRawSize

git-svn-id: trunk@33629 -
michael %!s(int64=9) %!d(string=hai) anos
pai
achega
51cdce510c

+ 2 - 2
packages/fcl-pdf/examples/testfppdf.lpr

@@ -274,11 +274,11 @@ begin
   W := D.Images[IDX].Width;
   H := D.Images[IDX].Height;
   { full size image }
-  P.DrawImage(25, 130, W, H, IDX);  // left-bottom coordinate of image
+  P.DrawImageRawSize(25, 130, W, H, IDX);  // left-bottom coordinate of image
   P.WriteText(145, 90, '[Full size (defined in pixels)]');
 
   { half size image }
-  P.DrawImage(25, 190, W shr 1, H shr 1, IDX); // could also have used: Integer(W div 2), Integer(H div 2)
+  P.DrawImageRawSize(25, 190, W shr 1, H shr 1, IDX); // could also have used: Integer(W div 2), Integer(H div 2)
   P.WriteText(90, 165, '[Quarter size (defined in pixels)]');
 
   { scalled image to 2x2 centimeters }

+ 9 - 6
packages/fcl-pdf/src/fppdf.pp

@@ -53,6 +53,9 @@ type
   TARGBColor = Cardinal;
   TPDFFloat = Single;
 
+  {$IF FPC_FULLVERSION < 30000}
+  RawByteString = type AnsiString;
+  {$ENDIF}
 
   TPDFDimensions = record
     T,L,R,B: TPDFFloat;
@@ -99,7 +102,7 @@ type
   Protected
     Class Function FloatStr(F: TPDFFloat) : String;
     procedure Write(const AStream: TStream); virtual;
-    Class procedure WriteString(const AValue: string; AStream: TStream);
+    Class procedure WriteString(const AValue: RawByteString; AStream: TStream);
   public
     Constructor Create(Const ADocument : TPDFDocument); virtual; overload;
   end;
@@ -530,8 +533,8 @@ type
     Procedure DrawRect(const X, Y, W, H, ALineWidth: TPDFFloat; const AFill, AStroke : Boolean); overload;
     Procedure DrawRect(const APos: TPDFCoord; const W, H, ALineWidth: TPDFFloat; const AFill, AStroke : Boolean); overload;
     { X, Y coordinates are the bottom-left coordinate of the image. AWidth and AHeight are in image pixels. }
-    Procedure DrawImage(const X, Y: TPDFFloat; const APixelWidth, APixelHeight, ANumber: integer); overload;
-    Procedure DrawImage(const APos: TPDFCoord; const APixelWidth, APixelHeight, ANumber: integer); overload;
+    Procedure DrawImageRawSize(const X, Y: TPDFFloat; const APixelWidth, APixelHeight, ANumber: integer); overload;
+    Procedure DrawImageRawSize(const APos: TPDFCoord; const APixelWidth, APixelHeight, ANumber: integer); overload;
     { X, Y coordinates are the bottom-left coordinate of the image. AWidth and AHeight are in UnitOfMeasure units. }
     Procedure DrawImage(const X, Y: TPDFFloat; const AWidth, AHeight: TPDFFloat; const ANumber: integer); overload;
     Procedure DrawImage(const APos: TPDFCoord; const AWidth, AHeight: TPDFFloat; const ANumber: integer); overload;
@@ -1785,7 +1788,7 @@ begin
   DrawRect(APos.X, APos.Y, W, H, ALineWidth, AFill, AStroke);
 end;
 
-procedure TPDFPage.DrawImage(const X, Y: TPDFFloat; const APixelWidth, APixelHeight, ANumber: integer);
+procedure TPDFPage.DrawImageRawSize(const X, Y: TPDFFloat; const APixelWidth, APixelHeight, ANumber: integer);
 var
   p1: TPDFCoord;
 begin
@@ -1794,7 +1797,7 @@ begin
   AddObject(Document.CreateImage(p1.X, p1.Y, APixelWidth, APixelHeight, ANumber));
 end;
 
-procedure TPDFPage.DrawImage(const APos: TPDFCoord; const APixelWidth, APixelHeight, ANumber: integer);
+procedure TPDFPage.DrawImageRawSize(const APos: TPDFCoord; const APixelWidth, APixelHeight, ANumber: integer);
 begin
   DrawImage(APos.X, APos.Y, APixelWidth, APixelHeight, ANumber);
 end;
@@ -1949,7 +1952,7 @@ begin
     end;
 end;
 
-class procedure TPDFObject.WriteString(const AValue: string; AStream: TStream);
+class procedure TPDFObject.WriteString(const AValue: RawByteString; AStream: TStream);
 
 Var
   L : Integer;

+ 2 - 2
packages/fcl-pdf/tests/fppdf_test.pas

@@ -1382,7 +1382,7 @@ begin
   p := PDF.Pages.AddPage;
   p.UnitOfMeasure := uomMillimeters;
   AssertEquals('Failed on 1', 0, p.ObjectCount);
-  p.DrawImage(10, 20, 200, 100, 1);
+  p.DrawImageRawSize(10, 20, 200, 100, 1);
   AssertEquals('Failed on 2', 1, p.ObjectCount);
   img := TMockPDFImage(p.Objects[0]);
   AssertTrue('Failed on 3', img <> nil);
@@ -1402,7 +1402,7 @@ begin
   p := PDF.Pages.AddPage;
   p.UnitOfMeasure := uomCentimeters;
   AssertEquals('Failed on 6', 0, p.ObjectCount);
-  p.DrawImage(10, 20, 200, 100, 1);
+  p.DrawImageRawSize(10, 20, 200, 100, 1);
   AssertEquals('Failed on 7', 1, p.ObjectCount);
   img := TMockPDFImage(p.Objects[0]);
   AssertTrue('Failed on 8', img <> nil);