Revision | 8 (tree) |
---|---|
Time | 2017-03-31 12:13:14 |
Author | ![]() |
- Alterado o nome da classe principal de TPNGObject para TPNGImage
@@ -62,7 +62,7 @@ | ||
62 | 62 | BUG 2 - There was a bug were compressed text chunks no keyword |
63 | 63 | name could not be read |
64 | 64 | IMPROVE 1 - Add classes and methods to work with the pHYs chunk |
65 | - (including TPNGObject.DrawUsingPixelInformation) | |
65 | + (including TPNGImage.DrawUsingPixelInformation) | |
66 | 66 | IMPROVE 3 - Included a property Version to return the library |
67 | 67 | version |
68 | 68 | IMPROVE 4 - New polish translation (thanks to Piotr Domanski) |
@@ -99,7 +99,7 @@ | ||
99 | 99 | |
100 | 100 | Version 1.436 |
101 | 101 | 2003-03-04 - * NEW * Property Pixels for direct access to pixels |
102 | - * IMPROVED * Palette property (TPngObject) (read only) | |
102 | + * IMPROVED * Palette property (TPNGImage) (read only) | |
103 | 103 | Slovenian traslation for the component (Miha Petelin) |
104 | 104 | Help file update (scanline article/png->jpg example) |
105 | 105 |
@@ -203,7 +203,7 @@ | ||
203 | 203 | {$DEFINE UseDelphi} //Disable fat vcl units(perfect for small apps) |
204 | 204 | {$DEFINE ErrorOnUnknownCritical} //Error when finds an unknown critical chunk |
205 | 205 | {$DEFINE CheckCRC} //Enables CRC checking |
206 | -{$DEFINE RegisterGraphic} //Registers TPNGObject to use with TPicture | |
206 | +{$DEFINE RegisterGraphic} //Registers TPNGImage to use with TPicture | |
207 | 207 | {$DEFINE PartialTransparentDraw} //Draws partial transparent images |
208 | 208 | {$DEFINE Store16bits} //Stores the extra 8 bits from 16bits/sample |
209 | 209 | {$RANGECHECKS OFF} {$J+} |
@@ -310,7 +310,7 @@ | ||
310 | 310 | pByteArray = ^TByteArray; |
311 | 311 | |
312 | 312 | {Forward} |
313 | - TPNGObject = class; | |
313 | + TPNGImage = class; | |
314 | 314 | pPointerArray = ^TPointerArray; |
315 | 315 | TPointerArray = Array[Word] of Pointer; |
316 | 316 |
@@ -317,7 +317,7 @@ | ||
317 | 317 | {Contains a list of objects} |
318 | 318 | TPNGPointerList = class |
319 | 319 | private |
320 | - fOwner: TPNGObject; | |
320 | + fOwner: TPNGImage; | |
321 | 321 | fCount : Cardinal; |
322 | 322 | fMemory: pPointerArray; |
323 | 323 | function GetItem(Index: Cardinal): Pointer; |
@@ -334,12 +334,12 @@ | ||
334 | 334 | {Set the size of the list} |
335 | 335 | procedure SetSize(const Size: Cardinal); |
336 | 336 | {Returns owner} |
337 | - property Owner: TPNGObject read fOwner; | |
337 | + property Owner: TPNGImage read fOwner; | |
338 | 338 | public |
339 | 339 | {Returns number of items} |
340 | 340 | property Count: Cardinal read fCount write SetSize; |
341 | 341 | {Object being either created or destroyed} |
342 | - constructor Create(AOwner: TPNGObject); | |
342 | + constructor Create(AOwner: TPNGImage); | |
343 | 343 | destructor Destroy; override; |
344 | 344 | end; |
345 | 345 |
@@ -454,7 +454,7 @@ | ||
454 | 454 | TFilters = set of TFilter; |
455 | 455 | |
456 | 456 | {Png implementation object} |
457 | - TPngObject = class{$IFDEF UseDelphi}(TGraphic){$ENDIF} | |
457 | + TPNGImage = class{$IFDEF UseDelphi}(TGraphic){$ENDIF} | |
458 | 458 | protected |
459 | 459 | {Inverse gamma table values} |
460 | 460 | InverseGamma: Array[Byte] of Byte; |
@@ -502,8 +502,8 @@ | ||
502 | 502 | function GetHeight: Integer; {$IFDEF UseDelphi}override; {$ENDIF} |
503 | 503 | procedure SetWidth(Value: Integer); {$IFDEF UseDelphi}override; {$ENDIF} |
504 | 504 | procedure SetHeight(Value: Integer); {$IFDEF UseDelphi}override;{$ENDIF} |
505 | - {Assigns from another TPNGObject} | |
506 | - procedure AssignPNG(Source: TPNGObject); | |
505 | + {Assigns from another TPNGImage} | |
506 | + procedure AssignPNG(Source: TPNGImage); | |
507 | 507 | {Returns if the image is empty} |
508 | 508 | function GetEmpty: Boolean; {$IFDEF UseDelphi}override; {$ENDIF} |
509 | 509 | {Used with property Header} |
@@ -617,7 +617,7 @@ | ||
617 | 617 | fData: Pointer; |
618 | 618 | fDataSize: Cardinal; |
619 | 619 | {Stores owner} |
620 | - fOwner: TPngObject; | |
620 | + fOwner: TPNGImage; | |
621 | 621 | {Stores the chunk name} |
622 | 622 | fName: TChunkName; |
623 | 623 | {Returns pointer to the TChunkIHDR} |
@@ -641,9 +641,9 @@ | ||
641 | 641 | {Assigns from another TChunk} |
642 | 642 | procedure Assign(Source: TChunk); virtual; |
643 | 643 | {Returns owner} |
644 | - property Owner: TPngObject read fOwner; | |
644 | + property Owner: TPNGImage read fOwner; | |
645 | 645 | {Being destroyed/created} |
646 | - constructor Create(Owner: TPngObject); virtual; | |
646 | + constructor Create(Owner: TPNGImage); virtual; | |
647 | 647 | destructor Destroy; override; |
648 | 648 | {Returns chunk class/name} |
649 | 649 | property Name: String read GetChunkName; |
@@ -717,7 +717,7 @@ | ||
717 | 717 | {Saves the chunk to a stream} |
718 | 718 | function SaveToStream(Stream: TStream): Boolean; override; |
719 | 719 | {Destructor/constructor} |
720 | - constructor Create(Owner: TPngObject); override; | |
720 | + constructor Create(Owner: TPNGImage); override; | |
721 | 721 | destructor Destroy; override; |
722 | 722 | {Assigns from another TChunk} |
723 | 723 | procedure Assign(Source: TChunk); override; |
@@ -757,7 +757,7 @@ | ||
757 | 757 | function LoadFromStream(Stream: TStream; const ChunkName: TChunkName; |
758 | 758 | Size: Integer): Boolean; override; |
759 | 759 | {Being created} |
760 | - constructor Create(Owner: TPngObject); override; | |
760 | + constructor Create(Owner: TPNGImage); override; | |
761 | 761 | {Assigns from another TChunk} |
762 | 762 | procedure Assign(Source: TChunk); override; |
763 | 763 | end; |
@@ -1278,7 +1278,7 @@ | ||
1278 | 1278 | end; |
1279 | 1279 | |
1280 | 1280 | {Creates a new chunk of this class} |
1281 | -function CreateClassChunk(Owner: TPngObject; Name: TChunkName): TChunk; | |
1281 | +function CreateClassChunk(Owner: TPNGImage; Name: TChunkName): TChunk; | |
1282 | 1282 | var |
1283 | 1283 | i : Integer; |
1284 | 1284 | NewChunk: TChunkClass; |
@@ -1484,7 +1484,7 @@ | ||
1484 | 1484 | {TPngPointerList implementation} |
1485 | 1485 | |
1486 | 1486 | {Object being created} |
1487 | -constructor TPngPointerList.Create(AOwner: TPNGObject); | |
1487 | +constructor TPngPointerList.Create(AOwner: TPNGImage); | |
1488 | 1488 | begin |
1489 | 1489 | inherited Create; {Let ancestor work} |
1490 | 1490 | {Holds owner} |
@@ -1918,7 +1918,7 @@ | ||
1918 | 1918 | end; |
1919 | 1919 | |
1920 | 1920 | {Chunk being created} |
1921 | -constructor TChunk.Create(Owner: TPngObject); | |
1921 | +constructor TChunk.Create(Owner: TPNGImage); | |
1922 | 1922 | var |
1923 | 1923 | ChunkName: String; |
1924 | 1924 | begin |
@@ -2183,7 +2183,7 @@ | ||
2183 | 2183 | {TChunkIHDR implementation} |
2184 | 2184 | |
2185 | 2185 | {Chunk being created} |
2186 | -constructor TChunkIHDR.Create(Owner: TPngObject); | |
2186 | +constructor TChunkIHDR.Create(Owner: TPNGImage); | |
2187 | 2187 | begin |
2188 | 2188 | {Prepare pointers} |
2189 | 2189 | ImageHandle := 0; |
@@ -4115,7 +4115,7 @@ | ||
4115 | 4115 | Run, LongestRun, ii, jj: Cardinal; |
4116 | 4116 | Last, Above, LastAbove: Byte; |
4117 | 4117 | begin |
4118 | - {Selecting more filters using the Filters property from TPngObject} | |
4118 | + {Selecting more filters using the Filters property from TPNGImage} | |
4119 | 4119 | {increases the chances to the file be much smaller, but decreases} |
4120 | 4120 | {the performace} |
4121 | 4121 |
@@ -4338,7 +4338,7 @@ | ||
4338 | 4338 | end; |
4339 | 4339 | |
4340 | 4340 | {Gamma chunk being created} |
4341 | -constructor TChunkgAMA.Create(Owner: TPngObject); | |
4341 | +constructor TChunkgAMA.Create(Owner: TPNGImage); | |
4342 | 4342 | begin |
4343 | 4343 | {Call ancestor} |
4344 | 4344 | inherited Create(Owner); |
@@ -4400,17 +4400,17 @@ | ||
4400 | 4400 | pCardinal(Data)^ := ByteSwap(Value); |
4401 | 4401 | end; |
4402 | 4402 | |
4403 | -{TPngObject implementation} | |
4403 | +{TPNGImage implementation} | |
4404 | 4404 | |
4405 | 4405 | {Assigns from another object} |
4406 | -procedure TPngObject.Assign(Source: TPersistent); | |
4406 | +procedure TPNGImage.Assign(Source: TPersistent); | |
4407 | 4407 | begin |
4408 | 4408 | {Being cleared} |
4409 | 4409 | if Source = nil then |
4410 | 4410 | ClearChunks |
4411 | - {Assigns contents from another TPNGObject} | |
4412 | - else if Source is TPNGObject then | |
4413 | - AssignPNG(Source as TPNGObject) | |
4411 | + {Assigns contents from another TPNGImage} | |
4412 | + else if Source is TPNGImage then | |
4413 | + AssignPNG(Source as TPNGImage) | |
4414 | 4414 | {Copy contents from a TBitmap} |
4415 | 4415 | {$IFDEF UseDelphi}else if Source is TBitmap then |
4416 | 4416 | with Source as TBitmap do |
@@ -4422,7 +4422,7 @@ | ||
4422 | 4422 | end; |
4423 | 4423 | |
4424 | 4424 | {Clear all the chunks in the list} |
4425 | -procedure TPngObject.ClearChunks; | |
4425 | +procedure TPNGImage.ClearChunks; | |
4426 | 4426 | var |
4427 | 4427 | i: Integer; |
4428 | 4428 | begin |
@@ -4435,7 +4435,7 @@ | ||
4435 | 4435 | end; |
4436 | 4436 | |
4437 | 4437 | {Portable Network Graphics object being created as a blank image} |
4438 | -constructor TPNGObject.CreateBlank(ColorType, BitDepth: Cardinal; | |
4438 | +constructor TPNGImage.CreateBlank(ColorType, BitDepth: Cardinal; | |
4439 | 4439 | cx, cy: Integer); |
4440 | 4440 | var NewIHDR: TChunkIHDR; |
4441 | 4441 | begin |
@@ -4469,7 +4469,7 @@ | ||
4469 | 4469 | end; |
4470 | 4470 | |
4471 | 4471 | {Portable Network Graphics object being created} |
4472 | -constructor TPngObject.Create; | |
4472 | +constructor TPNGImage.Create; | |
4473 | 4473 | begin |
4474 | 4474 | {Let it be created} |
4475 | 4475 | inherited Create; |
@@ -4486,7 +4486,7 @@ | ||
4486 | 4486 | end; |
4487 | 4487 | |
4488 | 4488 | {Portable Network Graphics object being destroyed} |
4489 | -destructor TPngObject.Destroy; | |
4489 | +destructor TPNGImage.Destroy; | |
4490 | 4490 | begin |
4491 | 4491 | {Free object list} |
4492 | 4492 | ClearChunks; |
@@ -4499,7 +4499,7 @@ | ||
4499 | 4499 | end; |
4500 | 4500 | |
4501 | 4501 | {Returns linesize and byte offset for pixels} |
4502 | -procedure TPngObject.GetPixelInfo(var LineSize, Offset: Cardinal); | |
4502 | +procedure TPNGImage.GetPixelInfo(var LineSize, Offset: Cardinal); | |
4503 | 4503 | begin |
4504 | 4504 | {There must be an Header chunk to calculate size} |
4505 | 4505 | if HeaderPresent then |
@@ -4542,7 +4542,7 @@ | ||
4542 | 4542 | end; |
4543 | 4543 | |
4544 | 4544 | {Returns image height} |
4545 | -function TPngObject.GetHeight: Integer; | |
4545 | +function TPNGImage.GetHeight: Integer; | |
4546 | 4546 | begin |
4547 | 4547 | {There must be a Header chunk to get the size, otherwise returns 0} |
4548 | 4548 | if HeaderPresent then |
@@ -4551,7 +4551,7 @@ | ||
4551 | 4551 | end; |
4552 | 4552 | |
4553 | 4553 | {Returns image width} |
4554 | -function TPngObject.GetWidth: Integer; | |
4554 | +function TPNGImage.GetWidth: Integer; | |
4555 | 4555 | begin |
4556 | 4556 | {There must be a Header chunk to get the size, otherwise returns 0} |
4557 | 4557 | if HeaderPresent then |
@@ -4560,19 +4560,19 @@ | ||
4560 | 4560 | end; |
4561 | 4561 | |
4562 | 4562 | {Returns if the image is empty} |
4563 | -function TPngObject.GetEmpty: Boolean; | |
4563 | +function TPNGImage.GetEmpty: Boolean; | |
4564 | 4564 | begin |
4565 | 4565 | Result := (Chunks.Count = 0); |
4566 | 4566 | end; |
4567 | 4567 | |
4568 | 4568 | {Raises an error} |
4569 | -procedure TPngObject.RaiseError(ExceptionClass: ExceptClass; Text: String); | |
4569 | +procedure TPNGImage.RaiseError(ExceptionClass: ExceptClass; Text: String); | |
4570 | 4570 | begin |
4571 | 4571 | raise ExceptionClass.Create(Text); |
4572 | 4572 | end; |
4573 | 4573 | |
4574 | 4574 | {Set the maximum size for IDAT chunk} |
4575 | -procedure TPngObject.SetMaxIdatSize(const Value: Integer); | |
4575 | +procedure TPNGImage.SetMaxIdatSize(const Value: Integer); | |
4576 | 4576 | begin |
4577 | 4577 | {Make sure the size is at least 65535} |
4578 | 4578 | if Value < High(Word) then |
@@ -4580,7 +4580,7 @@ | ||
4580 | 4580 | end; |
4581 | 4581 | |
4582 | 4582 | {Draws the image using pixel information from TChunkpHYs} |
4583 | -procedure TPNGObject.DrawUsingPixelInformation(Canvas: TCanvas; Point: TPoint); | |
4583 | +procedure TPNGImage.DrawUsingPixelInformation(Canvas: TCanvas; Point: TPoint); | |
4584 | 4584 | function Rect(Left, Top, Right, Bottom: Integer): TRect; |
4585 | 4585 | begin |
4586 | 4586 | Result.Left := Left; |
@@ -4615,7 +4615,7 @@ | ||
4615 | 4615 | |
4616 | 4616 | {$IFNDEF UseDelphi} |
4617 | 4617 | {Creates a file stream reading from the filename in the parameter and load} |
4618 | - procedure TPngObject.LoadFromFile(const Filename: String); | |
4618 | + procedure TPNGImage.LoadFromFile(const Filename: String); | |
4619 | 4619 | var |
4620 | 4620 | FileStream: TFileStream; |
4621 | 4621 | begin |
@@ -4634,7 +4634,7 @@ | ||
4634 | 4634 | end; |
4635 | 4635 | |
4636 | 4636 | {Saves the current png image to a file} |
4637 | - procedure TPngObject.SaveToFile(const Filename: String); | |
4637 | + procedure TPNGImage.SaveToFile(const Filename: String); | |
4638 | 4638 | var |
4639 | 4639 | FileStream: TFileStream; |
4640 | 4640 | begin |
@@ -4647,13 +4647,13 @@ | ||
4647 | 4647 | {$ENDIF} |
4648 | 4648 | |
4649 | 4649 | {Returns if it has the pixel information chunk} |
4650 | -function TPngObject.HasPixelInformation: Boolean; | |
4650 | +function TPNGImage.HasPixelInformation: Boolean; | |
4651 | 4651 | begin |
4652 | 4652 | Result := (Chunks.ItemFromClass(TChunkpHYs) as tChunkpHYs) <> nil; |
4653 | 4653 | end; |
4654 | 4654 | |
4655 | 4655 | {Returns the pixel information chunk} |
4656 | -function TPngObject.GetPixelInformation: TChunkpHYs; | |
4656 | +function TPNGImage.GetPixelInformation: TChunkpHYs; | |
4657 | 4657 | begin |
4658 | 4658 | Result := Chunks.ItemFromClass(TChunkpHYs) as tChunkpHYs; |
4659 | 4659 | if not Assigned(Result) then |
@@ -4664,7 +4664,7 @@ | ||
4664 | 4664 | end; |
4665 | 4665 | |
4666 | 4666 | {Returns pointer to the chunk TChunkIHDR which should be the first} |
4667 | -function TPngObject.GetHeader: TChunkIHDR; | |
4667 | +function TPNGImage.GetHeader: TChunkIHDR; | |
4668 | 4668 | begin |
4669 | 4669 | {If there is a TChunkIHDR returns it, otherwise returns nil} |
4670 | 4670 | if (Chunks.Count <> 0) and (Chunks.Item[0] is TChunkIHDR) then |
@@ -4678,7 +4678,7 @@ | ||
4678 | 4678 | end; |
4679 | 4679 | |
4680 | 4680 | {Draws using partial transparency} |
4681 | -procedure TPngObject.DrawPartialTrans(DC: HDC; Rect: TRect); | |
4681 | +procedure TPNGImage.DrawPartialTrans(DC: HDC; Rect: TRect); | |
4682 | 4682 | {Adjust the rectangle structure} |
4683 | 4683 | procedure AdjustRect(var Rect: TRect); |
4684 | 4684 | var |
@@ -4913,7 +4913,7 @@ | ||
4913 | 4913 | end; |
4914 | 4914 | |
4915 | 4915 | {Draws the image into a canvas} |
4916 | -procedure TPngObject.Draw(ACanvas: TCanvas; const Rect: TRect); | |
4916 | +procedure TPNGImage.Draw(ACanvas: TCanvas; const Rect: TRect); | |
4917 | 4917 | var |
4918 | 4918 | Header: TChunkIHDR; |
4919 | 4919 | begin |
@@ -4948,7 +4948,7 @@ | ||
4948 | 4948 | PngHeader: Array[0..7] of Char = (#137, #80, #78, #71, #13, #10, #26, #10); |
4949 | 4949 | |
4950 | 4950 | {Loads the image from a stream of data} |
4951 | -procedure TPngObject.LoadFromStream(Stream: TStream); | |
4951 | +procedure TPNGImage.LoadFromStream(Stream: TStream); | |
4952 | 4952 | var |
4953 | 4953 | Header : Array[0..7] of Char; |
4954 | 4954 | HasIDAT : Boolean; |
@@ -5048,13 +5048,13 @@ | ||
5048 | 5048 | end; |
5049 | 5049 | |
5050 | 5050 | {Changing height is not supported} |
5051 | -procedure TPngObject.SetHeight(Value: Integer); | |
5051 | +procedure TPNGImage.SetHeight(Value: Integer); | |
5052 | 5052 | begin |
5053 | 5053 | Resize(Width, Value) |
5054 | 5054 | end; |
5055 | 5055 | |
5056 | 5056 | {Changing width is not supported} |
5057 | -procedure TPngObject.SetWidth(Value: Integer); | |
5057 | +procedure TPNGImage.SetWidth(Value: Integer); | |
5058 | 5058 | begin |
5059 | 5059 | Resize(Value, Height) |
5060 | 5060 | end; |
@@ -5061,7 +5061,7 @@ | ||
5061 | 5061 | |
5062 | 5062 | {$IFDEF UseDelphi} |
5063 | 5063 | {Saves to clipboard format (thanks to Antoine Pottern)} |
5064 | -procedure TPNGObject.SaveToClipboardFormat(var AFormat: Word; | |
5064 | +procedure TPNGImage.SaveToClipboardFormat(var AFormat: Word; | |
5065 | 5065 | var AData: THandle; var APalette: HPalette); |
5066 | 5066 | begin |
5067 | 5067 | with TBitmap.Create do |
@@ -5076,7 +5076,7 @@ | ||
5076 | 5076 | end; |
5077 | 5077 | |
5078 | 5078 | {Loads data from clipboard} |
5079 | -procedure TPngObject.LoadFromClipboardFormat(AFormat: Word; | |
5079 | +procedure TPNGImage.LoadFromClipboardFormat(AFormat: Word; | |
5080 | 5080 | AData: THandle; APalette: HPalette); |
5081 | 5081 | begin |
5082 | 5082 | with TBitmap.Create do |
@@ -5089,7 +5089,7 @@ | ||
5089 | 5089 | end; |
5090 | 5090 | |
5091 | 5091 | {Returns if the image is transparent} |
5092 | -function TPngObject.GetTransparent: Boolean; | |
5092 | +function TPNGImage.GetTransparent: Boolean; | |
5093 | 5093 | begin |
5094 | 5094 | Result := (TransparencyMode <> ptmNone); |
5095 | 5095 | end; |
@@ -5097,7 +5097,7 @@ | ||
5097 | 5097 | {$ENDIF} |
5098 | 5098 | |
5099 | 5099 | {Saving the PNG image to a stream of data} |
5100 | -procedure TPngObject.SaveToStream(Stream: TStream); | |
5100 | +procedure TPNGImage.SaveToStream(Stream: TStream); | |
5101 | 5101 | var |
5102 | 5102 | j: Integer; |
5103 | 5103 | begin |
@@ -5137,7 +5137,7 @@ | ||
5137 | 5137 | end; |
5138 | 5138 | |
5139 | 5139 | {Loads the image from a resource} |
5140 | -procedure TPngObject.LoadFromResourceName(Instance: HInst; | |
5140 | +procedure TPNGImage.LoadFromResourceName(Instance: HInst; | |
5141 | 5141 | const Name: String); |
5142 | 5142 | var |
5143 | 5143 | ResStream: TResourceStream; |
@@ -5156,13 +5156,13 @@ | ||
5156 | 5156 | end; |
5157 | 5157 | |
5158 | 5158 | {Loads the png from a resource ID} |
5159 | -procedure TPngObject.LoadFromResourceID(Instance: HInst; ResID: Integer); | |
5159 | +procedure TPNGImage.LoadFromResourceID(Instance: HInst; ResID: Integer); | |
5160 | 5160 | begin |
5161 | 5161 | LoadFromResourceName(Instance, String(ResID)); |
5162 | 5162 | end; |
5163 | 5163 | |
5164 | -{Assigns this tpngobject to another object} | |
5165 | -procedure TPngObject.AssignTo(Dest: TPersistent); | |
5164 | +{Assigns this TPNGImage to another object} | |
5165 | +procedure TPNGImage.AssignTo(Dest: TPersistent); | |
5166 | 5166 | {$IFDEF UseDelphi} |
5167 | 5167 | function DetectPixelFormat: TPixelFormat; |
5168 | 5168 | begin |
@@ -5191,10 +5191,10 @@ | ||
5191 | 5191 | TRNS: TChunkTRNS; |
5192 | 5192 | {$ENDIF} |
5193 | 5193 | begin |
5194 | - {If the destination is also a TPNGObject make it assign} | |
5194 | + {If the destination is also a TPNGImage make it assign} | |
5195 | 5195 | {this one} |
5196 | - if Dest is TPNGObject then | |
5197 | - TPNGObject(Dest).AssignPNG(Self) | |
5196 | + if Dest is TPNGImage then | |
5197 | + TPNGImage(Dest).AssignPNG(Self) | |
5198 | 5198 | {$IFDEF UseDelphi} |
5199 | 5199 | {In case the destination is a bitmap} |
5200 | 5200 | else if (Dest is TBitmap) and HeaderPresent then |
@@ -5221,7 +5221,7 @@ | ||
5221 | 5221 | end; |
5222 | 5222 | |
5223 | 5223 | {Assigns from a bitmap object} |
5224 | -procedure TPngObject.AssignHandle(Handle: HBitmap; Transparent: Boolean; | |
5224 | +procedure TPNGImage.AssignHandle(Handle: HBitmap; Transparent: Boolean; | |
5225 | 5225 | TransparentColor: ColorRef); |
5226 | 5226 | var |
5227 | 5227 | BitmapInfo: Windows.TBitmap; |
@@ -5283,7 +5283,7 @@ | ||
5283 | 5283 | end; |
5284 | 5284 | |
5285 | 5285 | {Assigns from another PNG} |
5286 | -procedure TPngObject.AssignPNG(Source: TPNGObject); | |
5286 | +procedure TPNGImage.AssignPNG(Source: TPNGImage); | |
5287 | 5287 | var |
5288 | 5288 | J: Integer; |
5289 | 5289 | begin |
@@ -5306,7 +5306,7 @@ | ||
5306 | 5306 | end; |
5307 | 5307 | |
5308 | 5308 | {Returns a alpha data scanline} |
5309 | -function TPngObject.GetAlphaScanline(const LineIndex: Integer): pByteArray; | |
5309 | +function TPNGImage.GetAlphaScanline(const LineIndex: Integer): pByteArray; | |
5310 | 5310 | begin |
5311 | 5311 | with Header do |
5312 | 5312 | if (ColorType = COLOR_RGBALPHA) or (ColorType = COLOR_GRAYSCALEALPHA) then |
@@ -5316,7 +5316,7 @@ | ||
5316 | 5316 | |
5317 | 5317 | {$IFDEF Store16bits} |
5318 | 5318 | {Returns a png data extra scanline} |
5319 | -function TPngObject.GetExtraScanline(const LineIndex: Integer): Pointer; | |
5319 | +function TPNGImage.GetExtraScanline(const LineIndex: Integer): Pointer; | |
5320 | 5320 | begin |
5321 | 5321 | with Header do |
5322 | 5322 | Longint(Result) := (Longint(ExtraImageData) + ((Longint(Height) - 1) * |
@@ -5325,7 +5325,7 @@ | ||
5325 | 5325 | {$ENDIF} |
5326 | 5326 | |
5327 | 5327 | {Returns a png data scanline} |
5328 | -function TPngObject.GetScanline(const LineIndex: Integer): Pointer; | |
5328 | +function TPNGImage.GetScanline(const LineIndex: Integer): Pointer; | |
5329 | 5329 | begin |
5330 | 5330 | with Header do |
5331 | 5331 | Longint(Result) := (Longint(ImageData) + ((Longint(Height) - 1) * |
@@ -5333,7 +5333,7 @@ | ||
5333 | 5333 | end; |
5334 | 5334 | |
5335 | 5335 | {Initialize gamma table} |
5336 | -procedure TPngObject.InitializeGamma; | |
5336 | +procedure TPNGImage.InitializeGamma; | |
5337 | 5337 | var |
5338 | 5338 | i: Integer; |
5339 | 5339 | begin |
@@ -5346,7 +5346,7 @@ | ||
5346 | 5346 | end; |
5347 | 5347 | |
5348 | 5348 | {Returns the transparency mode used by this png} |
5349 | -function TPngObject.GetTransparencyMode: TPNGTransparencyMode; | |
5349 | +function TPNGImage.GetTransparencyMode: TPNGTransparencyMode; | |
5350 | 5350 | var |
5351 | 5351 | TRNS: TChunkTRNS; |
5352 | 5352 | begin |
@@ -5374,7 +5374,7 @@ | ||
5374 | 5374 | end; |
5375 | 5375 | |
5376 | 5376 | {Add a text chunk} |
5377 | -procedure TPngObject.AddtEXt(const Keyword, Text: String); | |
5377 | +procedure TPNGImage.AddtEXt(const Keyword, Text: String); | |
5378 | 5378 | var |
5379 | 5379 | TextChunk: TChunkTEXT; |
5380 | 5380 | begin |
@@ -5384,7 +5384,7 @@ | ||
5384 | 5384 | end; |
5385 | 5385 | |
5386 | 5386 | {Add a text chunk} |
5387 | -procedure TPngObject.AddzTXt(const Keyword, Text: String); | |
5387 | +procedure TPNGImage.AddzTXt(const Keyword, Text: String); | |
5388 | 5388 | var |
5389 | 5389 | TextChunk: TChunkzTXt; |
5390 | 5390 | begin |
@@ -5394,7 +5394,7 @@ | ||
5394 | 5394 | end; |
5395 | 5395 | |
5396 | 5396 | {Removes the image transparency} |
5397 | -procedure TPngObject.RemoveTransparency; | |
5397 | +procedure TPNGImage.RemoveTransparency; | |
5398 | 5398 | var |
5399 | 5399 | TRNS: TChunkTRNS; |
5400 | 5400 | begin |
@@ -5423,7 +5423,7 @@ | ||
5423 | 5423 | end; |
5424 | 5424 | |
5425 | 5425 | {Generates alpha information} |
5426 | -procedure TPngObject.CreateAlpha; | |
5426 | +procedure TPNGImage.CreateAlpha; | |
5427 | 5427 | var |
5428 | 5428 | TRNS: TChunkTRNS; |
5429 | 5429 | begin |
@@ -5465,7 +5465,7 @@ | ||
5465 | 5465 | end; |
5466 | 5466 | |
5467 | 5467 | {Returns transparent color} |
5468 | -function TPngObject.GetTransparentColor: TColor; | |
5468 | +function TPNGImage.GetTransparentColor: TColor; | |
5469 | 5469 | var |
5470 | 5470 | TRNS: TChunkTRNS; |
5471 | 5471 | begin |
@@ -5476,7 +5476,7 @@ | ||
5476 | 5476 | end; |
5477 | 5477 | |
5478 | 5478 | {$OPTIMIZATION OFF} |
5479 | -procedure TPngObject.SetTransparentColor(const Value: TColor); | |
5479 | +procedure TPNGImage.SetTransparentColor(const Value: TColor); | |
5480 | 5480 | var |
5481 | 5481 | TRNS: TChunkTRNS; |
5482 | 5482 | begin |
@@ -5500,13 +5500,13 @@ | ||
5500 | 5500 | end; |
5501 | 5501 | |
5502 | 5502 | {Returns if header is present} |
5503 | -function TPngObject.HeaderPresent: Boolean; | |
5503 | +function TPNGImage.HeaderPresent: Boolean; | |
5504 | 5504 | begin |
5505 | 5505 | Result := ((Chunks.Count <> 0) and (Chunks.Item[0] is TChunkIHDR)) |
5506 | 5506 | end; |
5507 | 5507 | |
5508 | 5508 | {Returns pixel for png using palette and grayscale} |
5509 | -function GetByteArrayPixel(const png: TPngObject; const X, Y: Integer): TColor; | |
5509 | +function GetByteArrayPixel(const png: TPNGImage; const X, Y: Integer): TColor; | |
5510 | 5510 | var |
5511 | 5511 | ByteData: Byte; |
5512 | 5512 | DataDepth: Byte; |
@@ -5552,7 +5552,7 @@ | ||
5552 | 5552 | {$ENDIF} |
5553 | 5553 | |
5554 | 5554 | {Sets a pixel for grayscale and palette pngs} |
5555 | -procedure SetByteArrayPixel(const png: TPngObject; const X, Y: Integer; | |
5555 | +procedure SetByteArrayPixel(const png: TPNGImage; const X, Y: Integer; | |
5556 | 5556 | const Value: TColor); |
5557 | 5557 | const |
5558 | 5558 | ClearFlag: Array[1..8] of Integer = (1, 3, 0, 15, 0, 0, 0, $FF); |
@@ -5582,7 +5582,7 @@ | ||
5582 | 5582 | end; |
5583 | 5583 | |
5584 | 5584 | {Returns pixel when png uses RGB} |
5585 | -function GetRGBLinePixel(const png: TPngObject; | |
5585 | +function GetRGBLinePixel(const png: TPNGImage; | |
5586 | 5586 | const X, Y: Integer): TColor; |
5587 | 5587 | begin |
5588 | 5588 | with pRGBLine(png.Scanline[Y])^[X] do |
@@ -5590,7 +5590,7 @@ | ||
5590 | 5590 | end; |
5591 | 5591 | |
5592 | 5592 | {Sets pixel when png uses RGB} |
5593 | -procedure SetRGBLinePixel(const png: TPngObject; | |
5593 | +procedure SetRGBLinePixel(const png: TPNGImage; | |
5594 | 5594 | const X, Y: Integer; Value: TColor); |
5595 | 5595 | begin |
5596 | 5596 | with pRGBLine(png.Scanline[Y])^[X] do |
@@ -5602,7 +5602,7 @@ | ||
5602 | 5602 | end; |
5603 | 5603 | |
5604 | 5604 | {Returns pixel when png uses grayscale} |
5605 | -function GetGrayLinePixel(const png: TPngObject; | |
5605 | +function GetGrayLinePixel(const png: TPNGImage; | |
5606 | 5606 | const X, Y: Integer): TColor; |
5607 | 5607 | var |
5608 | 5608 | B: Byte; |
@@ -5612,7 +5612,7 @@ | ||
5612 | 5612 | end; |
5613 | 5613 | |
5614 | 5614 | {Sets pixel when png uses grayscale} |
5615 | -procedure SetGrayLinePixel(const png: TPngObject; | |
5615 | +procedure SetGrayLinePixel(const png: TPNGImage; | |
5616 | 5616 | const X, Y: Integer; Value: TColor); |
5617 | 5617 | begin |
5618 | 5618 | PByteArray(png.Scanline[Y])^[X] := GetRValue(Value); |
@@ -5619,7 +5619,7 @@ | ||
5619 | 5619 | end; |
5620 | 5620 | |
5621 | 5621 | {Resizes the PNG image} |
5622 | -procedure TPngObject.Resize(const CX, CY: Integer); | |
5622 | +procedure TPNGImage.Resize(const CX, CY: Integer); | |
5623 | 5623 | function Min(const A, B: Integer): Integer; |
5624 | 5624 | begin |
5625 | 5625 | if A < B then Result := A else Result := B; |
@@ -5702,7 +5702,7 @@ | ||
5702 | 5702 | end; |
5703 | 5703 | |
5704 | 5704 | {Sets a pixel} |
5705 | -procedure TPngObject.SetPixels(const X, Y: Integer; const Value: TColor); | |
5705 | +procedure TPNGImage.SetPixels(const X, Y: Integer; const Value: TColor); | |
5706 | 5706 | begin |
5707 | 5707 | if ((X >= 0) and (X <= Width - 1)) and |
5708 | 5708 | ((Y >= 0) and (Y <= Height - 1)) then |
@@ -5719,7 +5719,7 @@ | ||
5719 | 5719 | |
5720 | 5720 | |
5721 | 5721 | {Returns a pixel} |
5722 | -function TPngObject.GetPixels(const X, Y: Integer): TColor; | |
5722 | +function TPNGImage.GetPixels(const X, Y: Integer): TColor; | |
5723 | 5723 | begin |
5724 | 5724 | if ((X >= 0) and (X <= Width - 1)) and |
5725 | 5725 | ((Y >= 0) and (Y <= Height - 1)) then |
@@ -5736,7 +5736,7 @@ | ||
5736 | 5736 | end; |
5737 | 5737 | |
5738 | 5738 | {Returns the image palette} |
5739 | -function TPngObject.GetPalette: HPALETTE; | |
5739 | +function TPNGImage.GetPalette: HPALETTE; | |
5740 | 5740 | begin |
5741 | 5741 | Result := Header.ImagePalette; |
5742 | 5742 | end; |
@@ -5776,7 +5776,7 @@ | ||
5776 | 5776 | Result := inherited SaveToStream(Stream); |
5777 | 5777 | end; |
5778 | 5778 | |
5779 | -procedure TPngObject.DoSetPalette(Value: HPALETTE; const UpdateColors: boolean); | |
5779 | +procedure TPNGImage.DoSetPalette(Value: HPALETTE; const UpdateColors: boolean); | |
5780 | 5780 | begin |
5781 | 5781 | if (Header.HasPalette) then |
5782 | 5782 | begin |
@@ -5795,13 +5795,13 @@ | ||
5795 | 5795 | end; |
5796 | 5796 | |
5797 | 5797 | {Set palette based on a windows palette handle} |
5798 | -procedure TPngObject.SetPalette(Value: HPALETTE); | |
5798 | +procedure TPNGImage.SetPalette(Value: HPALETTE); | |
5799 | 5799 | begin |
5800 | 5800 | DoSetPalette(Value, true); |
5801 | 5801 | end; |
5802 | 5802 | |
5803 | 5803 | {Returns the library version} |
5804 | -function TPNGObject.GetLibraryVersion: String; | |
5804 | +function TPNGImage.GetLibraryVersion: String; | |
5805 | 5805 | begin |
5806 | 5806 | Result := LibraryVersion |
5807 | 5807 | end; |
@@ -5813,13 +5813,13 @@ | ||
5813 | 5813 | crc_table_computed := FALSE; |
5814 | 5814 | {Register the necessary chunks for png} |
5815 | 5815 | RegisterCommonChunks; |
5816 | - {Registers TPNGObject to use with TPicture} | |
5816 | + {Registers TPNGImage to use with TPicture} | |
5817 | 5817 | {$IFDEF UseDelphi}{$IFDEF RegisterGraphic} |
5818 | - TPicture.RegisterFileFormat('PNG', 'Portable Network Graphics', TPNGObject); | |
5818 | + TPicture.RegisterFileFormat('PNG', 'Portable Network Graphics', TPNGImage); | |
5819 | 5819 | {$ENDIF}{$ENDIF} |
5820 | 5820 | finalization |
5821 | 5821 | {$IFDEF UseDelphi}{$IFDEF RegisterGraphic} |
5822 | - TPicture.UnregisterGraphicClass(TPNGObject); | |
5822 | + TPicture.UnregisterGraphicClass(TPNGImage); | |
5823 | 5823 | {$ENDIF}{$ENDIF} |
5824 | 5824 | {Free chunk classes} |
5825 | 5825 | FreeChunkClassList; |