Changeset 23
- Timestamp:
- Dec 22, 2016, 1:20:06 PM (8 years ago)
- Location:
- branches/gbitmap
- Files:
-
- 2 added
- 2 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gbitmap/ColorFormats/UColorGray1.pas
r21 r23 6 6 7 7 uses 8 Classes, SysUtils, Graphics, GImage, GPixmap;8 Classes, SysUtils, Graphics, UFGraphics, UGGraphics; 9 9 10 10 type … … 20 20 21 21 TPixmapGray1 = class(TGPixmapBit<TColorGray1>) 22 function Gray1ToColor(Value: TColorGray1): Graphics.TColor;22 function Gray1ToColor(Value: TColorGray1): TColor; 23 23 end; 24 24 … … 32 32 end; 33 33 34 { TB ImageGray1 }34 { TBPixmapGray1 } 35 35 36 TB ImageGray1 = class(TBImage)36 TBPixmapGray1 = class(TBImage) 37 37 private 38 38 FillCallBack: TGetColorPos; … … 64 64 BitDepth := 1; 65 65 BackendColorClass := TBColorGray1; 66 BackendImageClass := TB ImageGray1;66 BackendImageClass := TBPixmapGray1; 67 67 AddChannel('Gray', 0, 1); 68 68 end; … … 70 70 { TPixmapGray1 } 71 71 72 function TPixmapGray1.Gray1ToColor(Value: TColorGray1): Graphics.TColor;72 function TPixmapGray1.Gray1ToColor(Value: TColorGray1): TColor; 73 73 begin 74 74 Value := (Value and $1) * $ff; … … 97 97 end; 98 98 99 { TB ImageGray1 }99 { TBPixmapGray1 } 100 100 101 function TB ImageGray1.FillGetColor(Position: TPoint): TColorGray1;101 function TBPixmapGray1.FillGetColor(Position: TPoint): TColorGray1; 102 102 begin 103 103 Result := (FillCallBack(Position) as TBColorGray1).Value; 104 104 end; 105 105 106 procedure TB ImageGray1.SetSize(AValue: TPoint);106 procedure TBPixmapGray1.SetSize(AValue: TPoint); 107 107 begin 108 108 inherited; … … 110 110 end; 111 111 112 function TB ImageGray1.GetPixel(X, Y: Integer): IBColor;112 function TBPixmapGray1.GetPixel(X, Y: Integer): IBColor; 113 113 begin 114 114 Result := TBColorGray1.Create(Pixmap.Pixels[X, Y]); 115 115 end; 116 116 117 procedure TB ImageGray1.SetPixel(X, Y: Integer; AValue: IBColor);117 procedure TBPixmapGray1.SetPixel(X, Y: Integer; AValue: IBColor); 118 118 begin 119 119 Pixmap.Pixels[X, Y] := (AValue as TBColorGray1).Value; 120 120 end; 121 121 122 procedure TB ImageGray1.Fill(Color: IBColor);122 procedure TBPixmapGray1.Fill(Color: IBColor); 123 123 begin 124 124 if Color is TBColorGray1 then … … 126 126 end; 127 127 128 procedure TB ImageGray1.Fill(Func: TGetColorPos);128 procedure TBPixmapGray1.Fill(Func: TGetColorPos); 129 129 begin 130 130 FillCallBack := Func; … … 132 132 end; 133 133 134 procedure TB ImageGray1.PaintToCanvas(Canvas: TCanvas);134 procedure TBPixmapGray1.PaintToCanvas(Canvas: TCanvas); 135 135 begin 136 136 Pixmap.PaintToCanvas(Canvas, Pixmap.Gray1ToColor); 137 137 end; 138 138 139 function TB ImageGray1.GetDataSize: Integer;139 function TBPixmapGray1.GetDataSize: Integer; 140 140 begin 141 141 Result := Pixmap.GetDataSize; 142 142 end; 143 143 144 constructor TB ImageGray1.Create;144 constructor TBPixmapGray1.Create; 145 145 begin 146 146 Pixmap := TPixmapGray1.Create; … … 148 148 end; 149 149 150 destructor TB ImageGray1.Destroy;150 destructor TBPixmapGray1.Destroy; 151 151 begin 152 152 FreeAndNil(Pixmap); -
branches/gbitmap/ColorFormats/UColorGray2.pas
r21 r23 6 6 7 7 uses 8 Classes, SysUtils, Graphics, GPixmap, GImage;8 Classes, SysUtils, Graphics, UGGraphics, UFGraphics; 9 9 10 10 type … … 20 20 21 21 TPixmapGray2 = class(TGPixmapBit<TColorGray2>) 22 function Gray2ToColor(Value: TColorGray2): Graphics.TColor;22 function Gray2ToColor(Value: TColorGray2): TColor; 23 23 end; 24 24 … … 32 32 end; 33 33 34 { TB ImageGray2 }34 { TBPixmapGray2 } 35 35 36 TB ImageGray2 = class(TBImage)36 TBPixmapGray2 = class(TBImage) 37 37 private 38 38 FillCallBack: TGetColorPos; … … 65 65 BitDepth := 2; 66 66 BackendColorClass := TBColorGray2; 67 BackendImageClass := TB ImageGray2;67 BackendImageClass := TBPixmapGray2; 68 68 AddChannel('Gray', 0, 2); 69 69 end; … … 92 92 end; 93 93 94 { TB ImageGray2 }94 { TBPixmapGray2 } 95 95 96 function TB ImageGray2.FillGetColor(Position: TPoint): TColorGray2;96 function TBPixmapGray2.FillGetColor(Position: TPoint): TColorGray2; 97 97 begin 98 98 Result := (FillCallBack(Position) as TBColorGray2).Value; 99 99 end; 100 100 101 procedure TB ImageGray2.SetSize(AValue: TPoint);101 procedure TBPixmapGray2.SetSize(AValue: TPoint); 102 102 begin 103 103 inherited; … … 105 105 end; 106 106 107 function TB ImageGray2.GetPixel(X, Y: Integer): IBColor;107 function TBPixmapGray2.GetPixel(X, Y: Integer): IBColor; 108 108 begin 109 109 Result := TBColorGray2.Create(Pixmap.Pixels[X, Y]); 110 110 end; 111 111 112 procedure TB ImageGray2.SetPixel(X, Y: Integer; AValue: IBColor);112 procedure TBPixmapGray2.SetPixel(X, Y: Integer; AValue: IBColor); 113 113 begin 114 114 Pixmap.Pixels[X, Y] := (AValue as TBColorGray2).Value; 115 115 end; 116 116 117 procedure TB ImageGray2.Fill(Color: IBColor);117 procedure TBPixmapGray2.Fill(Color: IBColor); 118 118 begin 119 119 if Color is TBColorGray2 then … … 121 121 end; 122 122 123 procedure TB ImageGray2.Fill(Func: TGetColorPos);123 procedure TBPixmapGray2.Fill(Func: TGetColorPos); 124 124 begin 125 125 FillCallBack := Func; … … 127 127 end; 128 128 129 procedure TB ImageGray2.PaintToCanvas(Canvas: TCanvas);129 procedure TBPixmapGray2.PaintToCanvas(Canvas: TCanvas); 130 130 begin 131 131 Pixmap.PaintToCanvas(Canvas, Pixmap.Gray2ToColor); 132 132 end; 133 133 134 function TB ImageGray2.GetDataSize: Integer;134 function TBPixmapGray2.GetDataSize: Integer; 135 135 begin 136 136 Result := Pixmap.GetDataSize; 137 137 end; 138 138 139 constructor TB ImageGray2.Create;139 constructor TBPixmapGray2.Create; 140 140 begin 141 141 Pixmap := TPixmapGray2.Create; … … 143 143 end; 144 144 145 destructor TB ImageGray2.Destroy;145 destructor TBPixmapGray2.Destroy; 146 146 begin 147 147 FreeAndNil(Pixmap); … … 151 151 { TPixmapGray2 } 152 152 153 function TPixmapGray2.Gray2ToColor(Value: TColorGray2): Graphics.TColor;153 function TPixmapGray2.Gray2ToColor(Value: TColorGray2): TColor; 154 154 begin 155 155 Value := (Value and $3) * (255 div (4 - 1)); -
branches/gbitmap/ColorFormats/UColorGray4.pas
r21 r23 6 6 7 7 uses 8 Classes, SysUtils, GPixmap, GImage, Graphics;8 Classes, SysUtils, UGGraphics, UFGraphics, Graphics; 9 9 10 10 type -
branches/gbitmap/ColorFormats/UColorGray8.pas
r21 r23 6 6 7 7 uses 8 Classes, SysUtils, GImage, GPixmap, Graphics;8 Classes, SysUtils, UFGraphics, UGGraphics, Graphics; 9 9 10 10 type -
branches/gbitmap/ColorFormats/UColorRGB565.pas
r21 r23 6 6 7 7 uses 8 Classes, SysUtils, Graphics, GPixmap, GImage;8 Classes, SysUtils, Graphics, UGGraphics, UFGraphics; 9 9 10 10 type -
branches/gbitmap/ColorFormats/UColorRGB8.pas
r22 r23 6 6 7 7 uses 8 Classes, SysUtils, GPixmap, GImage, Graphics;8 Classes, SysUtils, UGGraphics, UFGraphics, Graphics; 9 9 10 10 type … … 37 37 end; 38 38 39 { TB ImageRGB8 }39 { TBPixmapRGB8 } 40 40 41 TB ImageRGB8 = class(TBImage)41 TBPixmapRGB8 = class(TBImage) 42 42 private 43 43 FillCallBack: TGetColorPos; … … 66 66 BitDepth := 24; 67 67 Name := 'RGB8'; 68 BackendImageClass := TB ImageRGB8;68 BackendImageClass := TBPixmapRGB8; 69 69 BackendColorClass := TBColorRGB8; 70 70 AddChannel('Red', 0, 8); … … 112 112 end; 113 113 114 { TB ImageRGB8 }114 { TBPixmapRGB8 } 115 115 116 function TB ImageRGB8.FillGetColor(Position: TPoint): TColorRGB8;116 function TBPixmapRGB8.FillGetColor(Position: TPoint): TColorRGB8; 117 117 begin 118 118 Result := (FillCallBack(Position) as TBColorRGB8).Value; 119 119 end; 120 120 121 procedure TB ImageRGB8.SetSize(AValue: TPoint);121 procedure TBPixmapRGB8.SetSize(AValue: TPoint); 122 122 begin 123 123 inherited; … … 125 125 end; 126 126 127 procedure TB ImageRGB8.Fill(Color: IBColor);127 procedure TBPixmapRGB8.Fill(Color: IBColor); 128 128 begin 129 129 if Color is TBColorRGB8 then … … 131 131 end; 132 132 133 procedure TB ImageRGB8.Fill(Func: TGetColorPos);133 procedure TBPixmapRGB8.Fill(Func: TGetColorPos); 134 134 begin 135 135 FillCallBack := Func; … … 137 137 end; 138 138 139 procedure TB ImageRGB8.PaintToCanvas(Canvas: TCanvas);139 procedure TBPixmapRGB8.PaintToCanvas(Canvas: TCanvas); 140 140 begin 141 141 Pixmap.PaintToCanvas(Canvas, Pixmap.RGB8ToColor); 142 142 end; 143 143 144 function TB ImageRGB8.GetDataSize: Integer;144 function TBPixmapRGB8.GetDataSize: Integer; 145 145 begin 146 146 Result := Pixmap.GetDataSize; 147 147 end; 148 148 149 constructor TB ImageRGB8.Create;149 constructor TBPixmapRGB8.Create; 150 150 begin 151 151 Pixmap := TPixmapRGB8.Create; 152 152 end; 153 153 154 destructor TB ImageRGB8.Destroy;154 destructor TBPixmapRGB8.Destroy; 155 155 begin 156 156 FreeAndNil(Pixmap); -
branches/gbitmap/ColorFormats/UColorRGBA8.pas
r21 r23 6 6 7 7 uses 8 Classes, SysUtils, Graphics, GPixmap, GImage;8 Classes, SysUtils, Graphics, UGGraphics, UFGraphics; 9 9 10 10 type -
branches/gbitmap/UFormMain.pas
r22 r23 6 6 7 7 uses 8 GImage, Classes, SysUtils, FileUtil, Forms, Graphics, Controls, Dialogs, Menus,9 ExtCtrls, StdCtrls, GPixmap, UPixmapSpecialized, UColorGray1, UColorGray2,8 UFGraphics, Classes, SysUtils, FileUtil, Forms, Graphics, Controls, Dialogs, Menus, 9 ExtCtrls, StdCtrls, UGGraphics, UPixmapSpecialized, UColorGray1, UColorGray2, 10 10 UColorGray4, UColorGray8, UColorRGB8, UColorRGBA8, UColorRGB565; 11 11 … … 29 29 function RGB8Random(Position: TPoint): TColorRGB8; 30 30 function RGB16Random(Position: TPoint): TColorRGB16; 31 function ColorRandom(Position: TPoint; ColorFormat: TColorFormat): GImage.TColor;31 function ColorRandom(Position: TPoint; ColorFormat: TColorFormat): UFGraphics.TFColor; 32 32 public 33 33 procedure TestGray1; … … 98 98 end; 99 99 100 function TForm1.ColorRandom(Position: TPoint; ColorFormat: TColorFormat): GImage.TColor;101 begin 102 Result := GImage.TColor.Create;100 function TForm1.ColorRandom(Position: TPoint; ColorFormat: TColorFormat): UFGraphics.TFColor; 101 begin 102 Result := UFGraphics.TFColor.Create; 103 103 Result.ColorFormat := ColorFormat; 104 104 Result.SetRandom; … … 271 271 procedure TForm1.TestImage; 272 272 var 273 Image: GImage.TPixmap;274 begin 275 Image := GImage.TPixmap.Create;273 Image: TFPixmap; 274 begin 275 Image := TFPixmap.Create; 276 276 with Image do begin 277 277 Size := Point(100, 100); 278 278 ColorFormat := ColorFormatManager.Formats[5]; 279 Fill( GImage.TColor.Create(ColorFormat, cnWhite));280 Pixels[0, 0] := GImage.TColor.Create(ColorFormat, cnBlack);279 Fill(TFColor.Create(ColorFormat, cnWhite)); 280 Pixels[0, 0] := TFColor.Create(ColorFormat, cnBlack); 281 281 Fill(ColorRandom); 282 282 PaintToCanvas(Image1.Picture.Bitmap.Canvas); -
branches/gbitmap/UPixmapSpecialized.pas
r22 r23 6 6 7 7 uses 8 Classes, SysUtils, Graphics, GPixmap;8 Classes, SysUtils, Graphics, UGGraphics; 9 9 10 10 type -
branches/gbitmap/project1.lpi
r21 r23 83 83 </Unit1> 84 84 <Unit2> 85 <Filename Value=" GPixmap.pas"/>85 <Filename Value="UGGraphics.pas"/> 86 86 <IsPartOfProject Value="True"/> 87 87 </Unit2> 88 88 <Unit3> 89 <Filename Value=" GImage.pas"/>89 <Filename Value="UFGraphics.pas"/> 90 90 <IsPartOfProject Value="True"/> 91 91 </Unit3> -
branches/gbitmap/project1.lpr
r21 r23 8 8 {$ENDIF}{$ENDIF} 9 9 Interfaces, // this includes the LCL widgetset 10 SysUtils, Forms, UFormMain, GPixmap, GImage, UPixmapSpecialized, UColorRGB8 10 SysUtils, Forms, UFormMain, UGGraphics, 11 UFGraphics, UPixmapSpecialized, UColorRGB8 11 12 { you can add units after this }; 12 13
Note:
See TracChangeset
for help on using the changeset viewer.