Changeset 30
- Timestamp:
- Dec 23, 2016, 10:07:39 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.lfm
r28 r30 16 16 object PaintBox1: TPaintBox 17 17 Left = 0 18 Height = 5 8719 Top = 018 Height = 561 19 Top = 26 20 20 Width = 920 21 21 Align = alClient … … 39 39 end> 40 40 SimplePanel = False 41 end 42 object ToolBar1: TToolBar 43 Left = 0 44 Height = 26 45 Top = 0 46 Width = 920 47 Caption = 'ToolBar1' 48 TabOrder = 1 49 object ToolButton1: TToolButton 50 Left = 1 51 Top = 2 52 Action = Core.AFileNew 53 end 41 54 end 42 55 object MainMenu1: TMainMenu -
trunk/Forms/UFormMain.pas
r29 r30 40 40 StatusBar1: TStatusBar; 41 41 Timer1: TTimer; 42 ToolBar1: TToolBar; 43 ToolButton1: TToolButton; 42 44 procedure FormActivate(Sender: TObject); 43 45 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); … … 134 136 View.DestRect := Bounds(0, 0, PaintBox1.Width, PaintBox1.Height); 135 137 //Bitmap.PaintToCanvas(TempBitmap.Canvas, View.SrcRect); 136 //Bitmap.PaintToBitmap(TempBitmap, View.SrcRect);138 Bitmap.PaintToBitmap(TempBitmap, View.SrcRect); 137 139 //TempBitmap.EndUpdate(False); 138 140 PaintBox1.Canvas.StretchDraw(View.DestRect, TempBitmap); -
trunk/Forms/UFormNew.pas
r29 r30 74 74 75 75 // Default 76 SpinEditWidth.Value := 200; 77 SpinEditHeight.Value := 100; 76 if Assigned(Core.Project) then begin 77 SpinEditWidth.Value := Core.Project.Bitmap.Size.X; 78 SpinEditHeight.Value := Core.Project.Bitmap.Size.Y; 79 end else begin 80 SpinEditWidth.Value := 200; 81 SpinEditHeight.Value := 100; 82 end; 78 83 SpinEditDPI.Value := 72; 79 84 end; -
trunk/LibrePaint.lpi
r28 r30 141 141 <StackChecks Value="True"/> 142 142 </Checks> 143 <VerifyObjMethodCallValidity Value="True"/> 143 144 </CodeGeneration> 144 145 <Linking> 145 <Debugging>146 <UseHeaptrc Value="True"/>147 </Debugging>148 146 <Options> 149 147 <Win32> -
trunk/LibrePaint.lpr
r28 r30 22 22 // Heap trace 23 23 DeleteFile(ExtractFilePath(ParamStr(0)) + HeapTraceLog); 24 SetHeapTraceOutput(ExtractFilePath(ParamStr(0)) + HeapTraceLog);24 //SetHeapTraceOutput(ExtractFilePath(ParamStr(0)) + HeapTraceLog); 25 25 {$ENDIF} 26 26 -
trunk/Packages/FastGraphics/ColorFormats/UColorGray1.pas
r26 r30 50 50 procedure PaintToCanvas(Canvas: TCanvas); override; 51 51 procedure PaintToCanvas(Canvas: TCanvas; Rect: TRect); override; 52 procedure PaintToBitmap(Bitmap: TBitmap; Rect: TRect); override; 52 53 procedure LoadFromCanvas(Canvas: TCanvas); override; 54 procedure LoadFromBitmap(Bitmap: TBitmap); override; 53 55 function GetDataSize: Integer; override; 54 56 constructor Create; override; … … 158 160 end; 159 161 162 procedure TBPixmapGray1.PaintToBitmap(Bitmap: TBitmap; Rect: TRect); 163 begin 164 Pixmap.PaintToBitmap(Bitmap, Rect, Pixmap.Gray1ToColor); 165 end; 166 160 167 procedure TBPixmapGray1.LoadFromCanvas(Canvas: TCanvas); 161 168 begin 162 169 Pixmap.LoadFromCanvas(Canvas, Pixmap.ColorToGray1); 170 end; 171 172 procedure TBPixmapGray1.LoadFromBitmap(Bitmap: TBitmap); 173 begin 174 Pixmap.LoadFromBitmap(Bitmap, Pixmap.ColorToGray1); 163 175 end; 164 176 -
trunk/Packages/FastGraphics/ColorFormats/UColorGray2.pas
r26 r30 50 50 procedure PaintToCanvas(Canvas: TCanvas); override; 51 51 procedure PaintToCanvas(Canvas: TCanvas; Rect: TRect); override; 52 procedure PaintToBitmap(Bitmap: TBitmap; Rect: TRect); override; 52 53 procedure LoadFromCanvas(Canvas: TCanvas); override; 54 procedure LoadFromBitmap(Bitmap: TBitmap); override; 53 55 function GetDataSize: Integer; override; 54 56 constructor Create; override; … … 148 150 end; 149 151 152 procedure TBPixmapGray2.PaintToBitmap(Bitmap: TBitmap; Rect: TRect); 153 begin 154 Pixmap.PaintToBitmap(Bitmap, Rect, Pixmap.Gray2ToColor); 155 end; 156 150 157 procedure TBPixmapGray2.LoadFromCanvas(Canvas: TCanvas); 151 158 begin 152 159 Pixmap.LoadFromCanvas(Canvas, Pixmap.ColorToGray2); 160 end; 161 162 procedure TBPixmapGray2.LoadFromBitmap(Bitmap: TBitmap); 163 begin 164 Pixmap.LoadFromBitmap(Bitmap, Pixmap.ColorToGray2); 153 165 end; 154 166 -
trunk/Packages/FastGraphics/ColorFormats/UColorGray4.pas
r26 r30 17 17 TColorGray4 = Byte; 18 18 19 { TPixmapGray4 } 20 19 21 TPixmapGray4 = class(TGPixmapBit<TColorGray4>) 20 22 function Gray4ToColor(Value: TColorGray4): TColor; 23 function ColorToGray4(Value: TColor): TColorGray4; 24 end; 25 26 { TBColorGray4 } 27 28 TBColorGray4 = class(TBColor) 29 Value: TColorGray4; 30 constructor Create(Color: TColorGray4); 31 procedure SetColorName(ColorName: TColorName); override; 32 procedure SetRandom; override; 33 end; 34 35 { TBPixmapGray4 } 36 37 TBPixmapGray4 = class(TBImage) 38 private 39 FillCallBack: TGetColorPos; 40 function FillGetColor(Position: TPoint): TColorGray4; 41 protected 42 procedure SetSize(AValue: TPoint); override; 43 function GetPixel(X, Y: Integer): IBColor; override; 44 procedure SetPixel(X, Y: Integer; AValue: IBColor); override; 45 public 46 Pixmap: TPixmapGray4; 47 procedure Fill(Color: IBColor); override; 48 procedure Fill(Func: TGetColorPos); override; 49 procedure Line(P1, P2: TPoint; Color: IBColor); override; 50 procedure PaintToCanvas(Canvas: TCanvas); override; 51 procedure PaintToCanvas(Canvas: TCanvas; Rect: TRect); override; 52 procedure PaintToBitmap(Bitmap: TBitmap; Rect: TRect); override; 53 procedure LoadFromCanvas(Canvas: TCanvas); override; 54 procedure LoadFromBitmap(Bitmap: TBitmap); override; 55 function GetDataSize: Integer; override; 56 constructor Create; override; 57 destructor Destroy; override; 21 58 end; 22 59 … … 32 69 Name := 'Gray 4-bit'; 33 70 BitDepth := 4; 71 BackendColorClass := TBColorGray4; 72 BackendImageClass := TBPixmapGray4; 34 73 AddChannel('Gray', 0, 4); 35 74 end; … … 43 82 end; 44 83 84 function TPixmapGray4.ColorToGray4(Value: TColor): TColorGray4; 85 begin 86 Result := Trunc((((Value shr 16) and $ff) + ((Value shr 8) and $ff) + ((Value shr 0) and $ff)) / $300 * 16); 87 end; 88 89 { TBColorGray2 } 90 91 constructor TBColorGray4.Create(Color: TColorGray4); 92 begin 93 Value := Color; 94 end; 95 96 procedure TBColorGray4.SetColorName(ColorName: TColorName); 97 begin 98 case ColorName of 99 cnBlack: Value := 0; 100 cnGray: Value := 6; 101 cnSilver: Value := 10; 102 cnWhite: Value := 15; 103 else Value := 0; 104 end; 105 end; 106 107 procedure TBColorGray4.SetRandom; 108 begin 109 Value := Random(16); 110 end; 111 112 { TBPixmapGray2 } 113 114 function TBPixmapGray4.FillGetColor(Position: TPoint): TColorGray4; 115 begin 116 Result := (FillCallBack(Position) as TBColorGray4).Value; 117 end; 118 119 procedure TBPixmapGray4.SetSize(AValue: TPoint); 120 begin 121 inherited; 122 Pixmap.Size := AValue; 123 end; 124 125 function TBPixmapGray4.GetPixel(X, Y: Integer): IBColor; 126 begin 127 Result := TBColorGray4.Create(Pixmap.Pixels[X, Y]); 128 end; 129 130 procedure TBPixmapGray4.SetPixel(X, Y: Integer; AValue: IBColor); 131 begin 132 Pixmap.Pixels[X, Y] := (AValue as TBColorGray4).Value; 133 end; 134 135 procedure TBPixmapGray4.Fill(Color: IBColor); 136 begin 137 if Color is TBColorGray4 then 138 Pixmap.Fill((Color as TBColorGray4).Value); 139 end; 140 141 procedure TBPixmapGray4.Fill(Func: TGetColorPos); 142 begin 143 FillCallBack := Func; 144 Pixmap.Fill(FillGetColor); 145 end; 146 147 procedure TBPixmapGray4.Line(P1, P2: TPoint; Color: IBColor); 148 begin 149 Pixmap.Canvas.Pen.Color := (Color as TBColorGray4).Value; 150 Pixmap.Canvas.Pen.MoveTo(P1); 151 Pixmap.Canvas.Pen.LineTo(P2); 152 end; 153 154 procedure TBPixmapGray4.PaintToCanvas(Canvas: TCanvas); 155 begin 156 Pixmap.PaintToCanvas(Canvas, Pixmap.Gray4ToColor); 157 end; 158 159 procedure TBPixmapGray4.PaintToCanvas(Canvas: TCanvas; Rect: TRect); 160 begin 161 Pixmap.PaintToCanvas(Canvas, Rect, Pixmap.Gray4ToColor); 162 end; 163 164 procedure TBPixmapGray4.PaintToBitmap(Bitmap: TBitmap; Rect: TRect); 165 begin 166 Pixmap.PaintToBitmap(Bitmap, Rect, Pixmap.Gray4ToColor); 167 end; 168 169 procedure TBPixmapGray4.LoadFromCanvas(Canvas: TCanvas); 170 begin 171 Pixmap.LoadFromCanvas(Canvas, Pixmap.ColorToGray4); 172 end; 173 174 procedure TBPixmapGray4.LoadFromBitmap(Bitmap: TBitmap); 175 begin 176 Pixmap.LoadFromBitmap(Bitmap, Pixmap.ColorToGray4); 177 end; 178 179 function TBPixmapGray4.GetDataSize: Integer; 180 begin 181 Result := Pixmap.GetDataSize; 182 end; 183 184 constructor TBPixmapGray4.Create; 185 begin 186 Pixmap := TPixmapGray4.Create; 187 Pixmap.BitsPerPixel := 4; 188 end; 189 190 destructor TBPixmapGray4.Destroy; 191 begin 192 FreeAndNil(Pixmap); 193 inherited; 194 end; 195 196 45 197 end. 46 198 -
trunk/Packages/FastGraphics/UGGraphics.pas
r29 r30 199 199 PixelPtr: PInteger; 200 200 PixelPtrMax: PInteger; 201 PixelPtrMin: PInteger; 201 202 PixelRowPtr: PInteger; 202 203 P: TPixelFormat; … … 209 210 PixelRowPtr := PInteger(RawImage.Data); 210 211 BytePerPixel := RawImage.Description.BitsPerPixel div 8; 212 PixelPtrMin := PixelRowPtr; 211 213 PixelPtrMax := PixelRowPtr + RawImage.Description.Width * RawImage.Description.Height * BytePerPixel; 212 214 for Y := Rect.Top to Rect.Bottom - 1 do begin 213 215 PixelPtr := PixelRowPtr; 214 216 for X := Rect.Left to Rect.Right - 1 do begin 215 if (X >= 0) and (X < FSize.X) and (Y >= 0) and (Y < FSize.Y) and (PixelPtr < PixelPtrMax) then 217 if (X >= 0) and (X < FSize.X) and (Y >= 0) and (Y < FSize.Y) and 218 (PixelPtr < PixelPtrMax) and (PixelPtr > PixelPtrMin) then 216 219 PixelPtr^ := ColorConvertFunc(Pixels[X, Y]); 217 220 Inc(PByte(PixelPtr), BytePerPixel); -
trunk/UCore.lfm
r28 r30 11 11 left = 201 12 12 top = 160 13 object AFileNew: TAction14 Category = 'File'15 Caption = 'New...'16 OnExecute = AFileNewExecute17 end18 13 object AExit: TAction 19 14 Caption = 'Exit' … … 47 42 OnExecute = AZoomNormalExecute 48 43 end 44 object AFileNew: TAction 45 Category = 'File' 46 Caption = 'New...' 47 OnExecute = AFileNewExecute 48 ShortCut = 16462 49 end 49 50 object AFileOpen: TAction 50 51 Category = 'File' 51 52 Caption = 'Open...' 52 53 OnExecute = AFileOpenExecute 54 ShortCut = 16463 53 55 end 54 56 object AFileClose: TAction … … 61 63 Caption = 'Save' 62 64 OnExecute = AFileSaveExecute 65 ShortCut = 16467 63 66 end 64 67 object AFileSaveAs: TAction -
trunk/UCore.pas
r29 r30 43 43 SavePictureDialog1: TSavePictureDialog; 44 44 procedure AExitExecute(Sender: TObject); 45 procedure AFileNewExecute(Sender: TObject); 45 46 procedure AFileCloseExecute(Sender: TObject); 46 47 procedure AFileOpenExecute(Sender: TObject); … … 53 54 procedure AImageNegativeExecute(Sender: TObject); 54 55 procedure AImageRandomExecute(Sender: TObject); 55 procedure AFileNewExecute(Sender: TObject);56 56 procedure AZoomAllExecute(Sender: TObject); 57 57 procedure AZoomInExecute(Sender: TObject);
Note:
See TracChangeset
for help on using the changeset viewer.