mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-12 20:50:41 +01:00
* Renamed pixel size DrawImage to DrawImageRawSize
git-svn-id: trunk@33629 -
This commit is contained in:
parent
6f18b7cc60
commit
51cdce510c
@ -274,11 +274,11 @@ begin
|
|||||||
W := D.Images[IDX].Width;
|
W := D.Images[IDX].Width;
|
||||||
H := D.Images[IDX].Height;
|
H := D.Images[IDX].Height;
|
||||||
{ full size image }
|
{ 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)]');
|
P.WriteText(145, 90, '[Full size (defined in pixels)]');
|
||||||
|
|
||||||
{ half size image }
|
{ 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)]');
|
P.WriteText(90, 165, '[Quarter size (defined in pixels)]');
|
||||||
|
|
||||||
{ scalled image to 2x2 centimeters }
|
{ scalled image to 2x2 centimeters }
|
||||||
|
|||||||
@ -53,6 +53,9 @@ type
|
|||||||
TARGBColor = Cardinal;
|
TARGBColor = Cardinal;
|
||||||
TPDFFloat = Single;
|
TPDFFloat = Single;
|
||||||
|
|
||||||
|
{$IF FPC_FULLVERSION < 30000}
|
||||||
|
RawByteString = type AnsiString;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
TPDFDimensions = record
|
TPDFDimensions = record
|
||||||
T,L,R,B: TPDFFloat;
|
T,L,R,B: TPDFFloat;
|
||||||
@ -99,7 +102,7 @@ type
|
|||||||
Protected
|
Protected
|
||||||
Class Function FloatStr(F: TPDFFloat) : String;
|
Class Function FloatStr(F: TPDFFloat) : String;
|
||||||
procedure Write(const AStream: TStream); virtual;
|
procedure Write(const AStream: TStream); virtual;
|
||||||
Class procedure WriteString(const AValue: string; AStream: TStream);
|
Class procedure WriteString(const AValue: RawByteString; AStream: TStream);
|
||||||
public
|
public
|
||||||
Constructor Create(Const ADocument : TPDFDocument); virtual; overload;
|
Constructor Create(Const ADocument : TPDFDocument); virtual; overload;
|
||||||
end;
|
end;
|
||||||
@ -530,8 +533,8 @@ type
|
|||||||
Procedure DrawRect(const X, Y, W, H, ALineWidth: TPDFFloat; const AFill, AStroke : Boolean); overload;
|
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;
|
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. }
|
{ 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 DrawImageRawSize(const X, Y: TPDFFloat; const APixelWidth, APixelHeight, ANumber: integer); overload;
|
||||||
Procedure DrawImage(const APos: TPDFCoord; 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. }
|
{ 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 X, Y: TPDFFloat; const AWidth, AHeight: TPDFFloat; const ANumber: integer); overload;
|
||||||
Procedure DrawImage(const APos: TPDFCoord; 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);
|
DrawRect(APos.X, APos.Y, W, H, ALineWidth, AFill, AStroke);
|
||||||
end;
|
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
|
var
|
||||||
p1: TPDFCoord;
|
p1: TPDFCoord;
|
||||||
begin
|
begin
|
||||||
@ -1794,7 +1797,7 @@ begin
|
|||||||
AddObject(Document.CreateImage(p1.X, p1.Y, APixelWidth, APixelHeight, ANumber));
|
AddObject(Document.CreateImage(p1.X, p1.Y, APixelWidth, APixelHeight, ANumber));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPDFPage.DrawImage(const APos: TPDFCoord; const APixelWidth, APixelHeight, ANumber: integer);
|
procedure TPDFPage.DrawImageRawSize(const APos: TPDFCoord; const APixelWidth, APixelHeight, ANumber: integer);
|
||||||
begin
|
begin
|
||||||
DrawImage(APos.X, APos.Y, APixelWidth, APixelHeight, ANumber);
|
DrawImage(APos.X, APos.Y, APixelWidth, APixelHeight, ANumber);
|
||||||
end;
|
end;
|
||||||
@ -1949,7 +1952,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TPDFObject.WriteString(const AValue: string; AStream: TStream);
|
class procedure TPDFObject.WriteString(const AValue: RawByteString; AStream: TStream);
|
||||||
|
|
||||||
Var
|
Var
|
||||||
L : Integer;
|
L : Integer;
|
||||||
|
|||||||
@ -1382,7 +1382,7 @@ begin
|
|||||||
p := PDF.Pages.AddPage;
|
p := PDF.Pages.AddPage;
|
||||||
p.UnitOfMeasure := uomMillimeters;
|
p.UnitOfMeasure := uomMillimeters;
|
||||||
AssertEquals('Failed on 1', 0, p.ObjectCount);
|
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);
|
AssertEquals('Failed on 2', 1, p.ObjectCount);
|
||||||
img := TMockPDFImage(p.Objects[0]);
|
img := TMockPDFImage(p.Objects[0]);
|
||||||
AssertTrue('Failed on 3', img <> nil);
|
AssertTrue('Failed on 3', img <> nil);
|
||||||
@ -1402,7 +1402,7 @@ begin
|
|||||||
p := PDF.Pages.AddPage;
|
p := PDF.Pages.AddPage;
|
||||||
p.UnitOfMeasure := uomCentimeters;
|
p.UnitOfMeasure := uomCentimeters;
|
||||||
AssertEquals('Failed on 6', 0, p.ObjectCount);
|
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);
|
AssertEquals('Failed on 7', 1, p.ObjectCount);
|
||||||
img := TMockPDFImage(p.Objects[0]);
|
img := TMockPDFImage(p.Objects[0]);
|
||||||
AssertTrue('Failed on 8', img <> nil);
|
AssertTrue('Failed on 8', img <> nil);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user