Changeset 29
- Timestamp:
- Dec 22, 2016, 9:46:17 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r28 r29 129 129 TempBitmap.SetSize(View.SrcRect.Right - View.SrcRect.Left, 130 130 View.SrcRect.Bottom - View.SrcRect.Top); 131 TempBitmap.BeginUpdate(True);131 //TempBitmap.BeginUpdate(True); 132 132 TempBitmap.Canvas.Brush.Color := clBlack; 133 133 TempBitmap.Canvas.FillRect(0, 0, TempBitmap.Width, TempBitmap.Height); 134 134 View.DestRect := Bounds(0, 0, PaintBox1.Width, PaintBox1.Height); 135 Bitmap.PaintToCanvas(TempBitmap.Canvas, View.SrcRect);135 //Bitmap.PaintToCanvas(TempBitmap.Canvas, View.SrcRect); 136 136 //Bitmap.PaintToBitmap(TempBitmap, View.SrcRect); 137 TempBitmap.EndUpdate(False);137 //TempBitmap.EndUpdate(False); 138 138 PaintBox1.Canvas.StretchDraw(View.DestRect, TempBitmap); 139 139 //PaintBox1.Canvas.Draw(0, 0, TempBitmap); -
trunk/Forms/UFormNew.pas
r28 r29 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Spin, 9 StdCtrls, ActnList, UFGraphics ;9 StdCtrls, ActnList, UFGraphics, URegistry; 10 10 11 11 type … … 32 32 { private declarations } 33 33 public 34 { public declarations }35 34 end; 36 35 … … 71 70 ComboBoxColorFormat.ItemIndex := 0; 72 71 72 if ComboBoxColorFormat.Items.IndexOf(Core.LastColorFormat) <> -1 then 73 ComboBoxColorFormat.ItemIndex := ComboBoxColorFormat.Items.IndexOf(Core.LastColorFormat); 74 73 75 // Default 74 76 SpinEditWidth.Value := 200; … … 79 81 procedure TFormNew.FormClose(Sender: TObject; var CloseAction: TCloseAction); 80 82 begin 83 Core.LastColorFormat := ComboBoxColorFormat.Items[ComboBoxColorFormat.ItemIndex]; 81 84 Core.PersistentForm1.Save(Self); 82 85 end; -
trunk/Packages/Common/Languages/UJobProgressView.cs.po
r28 r29 39 39 msgid "Total estimated time: %s" 40 40 msgstr "CelkovÃœ odhadovanÃœ Äas: %s" 41 -
trunk/Packages/FastGraphics/ColorFormats/UColorRGB8.pas
r28 r29 56 56 procedure PaintToBitmap(Bitmap: TBitmap; Rect: TRect); override; 57 57 procedure LoadFromCanvas(Canvas: TCanvas); override; 58 procedure LoadFromBitmap(Bitmap: TBitmap); override; 58 59 function GetDataSize: Integer; override; 59 60 constructor Create; override; … … 170 171 end; 171 172 173 procedure TBPixmapRGB8.LoadFromBitmap(Bitmap: TBitmap); 174 begin 175 Pixmap.LoadFromBitmap(Bitmap, Pixmap.ColorToRGB8); 176 end; 177 172 178 function TBPixmapRGB8.GetDataSize: Integer; 173 179 begin -
trunk/Packages/FastGraphics/UFGraphics.pas
r27 r29 45 45 procedure PaintToBitmap(Bitmap: TBitmap; Rect: TRect); virtual; 46 46 procedure LoadFromCanvas(Canvas: TCanvas); virtual; 47 procedure LoadFromBitmap(Bitmap: TBitmap); virtual; 47 48 function GetDataSize: Integer; virtual; 48 49 constructor Create; virtual; … … 174 175 procedure PaintToBitmap(Bitmap: TBitmap; Rect: TRect); overload; 175 176 procedure LoadFromCanvas(Canvas: TCanvas); 177 procedure LoadFromBitmap(Bitmap: TBitmap); 176 178 function GetDataSize: Integer; 177 179 constructor Create(AOwner: TComponent); override; … … 383 385 end; 384 386 387 procedure TBImage.LoadFromBitmap(Bitmap: TBitmap); 388 begin 389 end; 390 385 391 function TBImage.GetDataSize: Integer; 386 392 begin … … 495 501 begin 496 502 Backend.LoadFromCanvas(Canvas); 503 end; 504 505 procedure TFPixmap.LoadFromBitmap(Bitmap: TBitmap); 506 begin 507 Backend.LoadFromBitmap(Bitmap); 497 508 end; 498 509 -
trunk/Packages/FastGraphics/UGGraphics.pas
r27 r29 68 68 procedure PaintToBitmap(Bitmap: TBitmap; Rect: TRect; ColorConvertFunc: TGConvertColor); 69 69 procedure LoadFromCanvas(Canvas: TCanvas; ColorConvertFunc: TGConvertFromColor); overload; 70 procedure LoadFromBitmap(Bitmap: TBitmap; ColorConvertFunc: TGConvertFromColor); 70 71 procedure Fill(Color: TGColor); overload; 71 72 procedure Fill(Func: TGGetColor); overload; … … 224 225 end; 225 226 226 procedure TGPixmap<TGColor>.LoadFromCanvas(Canvas: TCanvas; ColorConvertFunc: TGConvertFromColor); overload;227 procedure TGPixmap<TGColor>.LoadFromCanvas(Canvas: TCanvas; ColorConvertFunc: TGConvertFromColor); 227 228 var 228 229 X, Y: Integer; … … 236 237 finally 237 238 Canvas.Unlock; 239 end; 240 end; 241 242 procedure TGPixmap<TGColor>.LoadFromBitmap(Bitmap: TBitmap; ColorConvertFunc: TGConvertFromColor); 243 var 244 X, Y: Integer; 245 PixelPtr: PInteger; 246 PixelPtrMax: PInteger; 247 PixelRowPtr: PInteger; 248 P: TPixelFormat; 249 RawImage: TRawImage; 250 BytePerPixel: Integer; 251 begin 252 try 253 Bitmap.BeginUpdate(False); 254 RawImage := Bitmap.RawImage; 255 PixelRowPtr := PInteger(RawImage.Data); 256 BytePerPixel := RawImage.Description.BitsPerPixel div 8; 257 PixelPtrMax := PixelRowPtr + RawImage.Description.Width * RawImage.Description.Height * BytePerPixel; 258 for Y := 0 to FSize.Y - 1 do begin 259 PixelPtr := PixelRowPtr; 260 for X := 0 to FSize.X - 1 do begin 261 if (X >= 0) and (X < FSize.X) and (Y >= 0) and (Y < FSize.Y) and (PixelPtr < PixelPtrMax) then 262 Pixels[X, Y] := ColorConvertFunc(PixelPtr^); 263 Inc(PByte(PixelPtr), BytePerPixel); 264 end; 265 Inc(PByte(PixelRowPtr), RawImage.Description.BytesPerLine); 266 end; 267 finally 268 Bitmap.EndUpdate(False); 238 269 end; 239 270 end; -
trunk/UCore.pas
r28 r29 7 7 uses 8 8 Classes, SysUtils, FileUtil, ActnList, UProject, UFGraphics, UPersistentForm, 9 Controls, Graphics, ExtDlgs, ExtCtrls, UR Egistry, UApplicationInfo, Registry;9 Controls, Graphics, ExtDlgs, ExtCtrls, URegistry, UApplicationInfo, Registry; 10 10 11 11 const … … 62 62 private 63 63 public 64 LastColorFormat: string; 64 65 Project: TProject; 66 RegistryContext: TRegistryContext; 65 67 procedure ProjectOpen(FileName: string); 66 68 procedure Init; 69 procedure LoadConfig; 70 procedure SaveConfig; 67 71 end; 68 72 … … 88 92 procedure TCore.DataModuleCreate(Sender: TObject); 89 93 begin 94 RegistryContext := RegContext(HKEY(ApplicationInfo1.RegistryRoot), 95 ApplicationInfo1.RegistryKey); 90 96 Project := TProject.Create; 91 97 end; … … 93 99 procedure TCore.DataModuleDestroy(Sender: TObject); 94 100 begin 95 Project.Free; 101 FreeAndNil(Project); 102 SaveConfig; 96 103 end; 97 104 … … 103 110 Image := TImage.Create(nil); 104 111 Image.Picture.LoadFromFile(FileName); 105 Image.Picture.Bitmap.BeginUpdate(True);112 //Image.Picture.Bitmap.BeginUpdate(True); 106 113 Project.Bitmap.Size := Point(Image.Picture.Bitmap.Width, Image.Picture.Bitmap.Height); 107 Project.Bitmap.LoadFromCanvas(Image.Picture.Bitmap.Canvas); 108 Image.Picture.Bitmap.EndUpdate; 114 //Project.Bitmap.LoadFromCanvas(Image.Picture.Bitmap.Canvas); 115 Project.Bitmap.LoadFromBitmap(Image.Picture.Bitmap); 116 //Image.Picture.Bitmap.EndUpdate; 109 117 Image.Free; 110 118 AZoomAll.Execute; … … 115 123 procedure TCore.Init; 116 124 begin 117 PersistentForm1.RegistryContext := Reg Context(HKEY(ApplicationInfo1.RegistryRoot),118 ApplicationInfo1.RegistryKey);125 PersistentForm1.RegistryContext := RegistryContext; 126 LoadConfig; 119 127 120 128 // Set default … … 123 131 Project.View.DestRect := Bounds(0, 0, FormMain.PaintBox1.Width, FormMain.PaintBox1.Height); 124 132 Core.AZoomAll.Execute; 133 end; 134 135 procedure TCore.LoadConfig; 136 begin 137 with TRegistryEx.Create do 138 try 139 RootKey := RegistryContext.RootKey; 140 OpenKey(RegistryContext.Key, True); 141 142 LastColorFormat := ReadStringWithDefault('LastColorFormat', ''); 143 finally 144 Free; 145 end; 146 end; 147 148 procedure TCore.SaveConfig; 149 begin 150 with TRegistryEx.Create do 151 try 152 RootKey := RegistryContext.RootKey; 153 OpenKey(RegistryContext.Key, True); 154 155 WriteString('LastColorFormat', LastColorFormat); 156 finally 157 Free; 158 end; 125 159 end; 126 160
Note:
See TracChangeset
for help on using the changeset viewer.