- Timestamp:
- Jan 21, 2018, 10:21:23 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r17 r18 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 9 ExtCtrls, Menus, ActnList, UKernel, UMemory, UDevice, UPlatformBase, LCLType, 10 UGraphics ;10 UGraphics, GraphType; 11 11 12 12 type … … 188 188 var 189 189 X, Y: Integer; 190 DX, DY: Integer; 191 P, PR: PByte; 192 begin 190 SourceBytePerPixel: Integer; 191 SourceBytePerLine: Integer; 192 SourcePixelPtr: PByte; 193 SourcePixelRowPtr: PByte; 194 RawImage: TRawImage; 195 DestPixelRowPtr: PByte; 196 DestPixelPtr: PByte; 197 DestBytePerPixel: Integer; 198 DestBytePerLine: Integer; 199 SizeX: Integer; 200 SizeY: Integer; 201 begin 202 { var 203 X, Y: Integer; 204 PixelPtr: PInteger; 205 PixelRowPtr: PInteger; 206 RawImage: TRawImage; 207 BytePerPixel: Integer; 208 SourcePixelPtr: Integer; 209 begin 210 try 211 Bitmap.BeginUpdate; 212 RawImage := Bitmap.RawImage; 213 PixelRowPtr := PInteger(RawImage.Data); 214 BytePerPixel := RawImage.Description.BitsPerPixel div 8; 215 for Y := 0 to Bitmap.Height - 1 do begin 216 PixelPtr := PixelRowPtr; 217 for X := 0 to Bitmap.Width - 1 do begin 218 SourcePixelPtr := TMatter(Matter[Surface.ItemsXY[Trunc(X / Bitmap.Width * Surface.Count.X), 219 Trunc(Y / Bitmap.Height * Surface.Count.Y)]]).Color; 220 PixelPtr^ := SwapBRComponent(SourcePixelPtr); 221 Inc(PByte(PixelPtr), BytePerPixel); 222 end; 223 Inc(PByte(PixelRowPtr), RawImage.Description.BytesPerLine); 224 end; 225 finally 226 Bitmap.EndUpdate; 227 end; 228 } 193 229 try 230 TempBitmap.SetSize(VideoDevice.VideoMode.Size.X, VideoDevice.VideoMode.Size.Y); 194 231 TempBitmap.BeginUpdate; 195 TempBitmap.SetSize(PaintBox1.Width, PaintBox1.Height); 196 232 RawImage := TempBitmap.RawImage; 233 DestPixelRowPtr := RawImage.Data; 234 DestBytePerPixel := RawImage.Description.BitsPerPixel div 8; 235 DestBytePerLine := RawImage.Description.BytesPerLine; 197 236 if Assigned(VideoDevice.VideoMemory) then begin 198 DX := VideoDevice.VideoMode.GetBytesPerPixel; 199 DY := VideoDevice.VideoMode.GetBytesPerLine; 200 P := VideoDevice.VideoMemory; 201 for Y := 0 to VideoDevice.VideoMode.Size.Y - 1 do begin 202 PR := P; 203 for X := 0 to VideoDevice.VideoMode.Size.X - 1 do begin 204 TempBitmap.Canvas.Pixels[X, Y] := PInteger(PR)^ and $ffffff; 205 Inc(PR, DX); 237 SourceBytePerPixel := VideoDevice.VideoMode.GetBytesPerPixel; 238 SourceBytePerLine := VideoDevice.VideoMode.GetBytesPerLine; 239 SourcePixelRowPtr := VideoDevice.VideoMemory; 240 SizeX := VideoDevice.VideoMode.Size.X; 241 SizeY := VideoDevice.VideoMode.Size.Y; 242 for Y := 0 to SizeY - 1 do begin 243 SourcePixelPtr := SourcePixelRowPtr; 244 DestPixelPtr := DestPixelRowPtr; 245 for X := 0 to SizeX - 1 do begin 246 PInteger(DestPixelPtr)^ := PInteger(SourcePixelPtr)^ and $ffffff; 247 Inc(SourcePixelPtr, SourceBytePerPixel); 248 Inc(DestPixelPtr, DestBytePerPixel); 206 249 end; 207 Inc(P, DY); 250 Inc(SourcePixelRowPtr, SourceBytePerLine); 251 Inc(DestPixelRowPtr, DestBytePerLine); 208 252 end; 209 253 end; 210 254 finally 255 TempBitmap.EndUpdate; 211 256 PaintBox1.Canvas.Draw(0, 0, TempBitmap); 212 TempBitmap.EndUpdate;213 257 end; 214 258 end; -
trunk/Platform/Base/UPlatformBase.pas
r17 r18 66 66 protected 67 67 procedure SetVideoMode(Mode: TVideoMode); override; 68 function GetVideoMemory: PByte; override; 68 69 public 69 70 VideoMemory: PByte; … … 71 72 Canvas: TCanvas; 72 73 procedure GetSupportedModes(Modes: TObjectList); override; 73 function GetVideoMemory: PByte; override;74 74 procedure VideoMemoryChange; override; 75 75 constructor Create; override;
Note:
See TracChangeset
for help on using the changeset viewer.