Changeset 521 for GraphicTest/Packages/bgrabitmap/bgraopengltype.pas
- Timestamp:
- Apr 17, 2019, 12:58:41 AM (5 years ago)
- Location:
- GraphicTest
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GraphicTest
- Property svn:ignore
-
old new 8 8 GraphicTest.lps 9 9 GraphicTest.dbg 10 heaptrclog.trc
-
- Property svn:ignore
-
GraphicTest/Packages/bgrabitmap/bgraopengltype.pas
r494 r521 142 142 procedure TextRect(ARect: TRectF; const Text : UTF8String; AHorizAlign: TAlignment; AVertAlign: TTextLayout; AColor: TBGRAPixel); overload; 143 143 function TextWidth(const Text: UTF8String): single; virtual; abstract; 144 function TextHeight(const Text: UTF8String): single; virtual; abstract; overload;145 function TextHeight(const Text: UTF8String; AWidth: single): single; virtual; abstract; overload;144 function TextHeight(const Text: UTF8String): single; overload; virtual; abstract; 145 function TextHeight(const Text: UTF8String; AWidth: single): single; overload; virtual; abstract; 146 146 procedure SetGradientColors(ATopLeft, ATopRight, ABottomRight, ABottomLeft: TBGRAPixel); virtual; abstract; 147 147 … … 184 184 procedure ToggleFlipY; 185 185 procedure ToggleMask; 186 function FilterBlurMotion(ARadius: single; ABlurType: TRadialBlurType; ADirection: TPointF): IBGLTexture; 187 function FilterBlurRadial(ARadius: single; ABlurType: TRadialBlurType): IBGLTexture; 186 188 procedure SetFrame(AIndex: integer); 187 189 procedure FreeMemory; … … 212 214 procedure DrawAffine(x,y: single; const AMatrix: TAffineMatrix; AAlpha: byte = 255); overload; 213 215 procedure DrawAffine(x,y: single; const AMatrix: TAffineMatrix; AColor: TBGRAPixel); overload; 214 procedure DrawTriangle(const APoints: array of TPointF; const ATexCoords: array of TPointF); 215 procedure DrawTriangle(const APoints: array of TPointF; const ATexCoords: array of TPointF; const AColors: array of TColorF); 216 procedure DrawTriangle(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF); 217 procedure DrawTriangle(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF; const AColors: array of TColorF); 218 procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF); 219 procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); 220 procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF); 221 procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); 222 procedure DrawQuad(const APoints: array of TPointF; const ATexCoords: array of TPointF); 223 procedure DrawQuad(const APoints: array of TPointF; const ATexCoords: array of TPointF; const AColors: array of TColorF); 224 procedure DrawQuad(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF); 225 procedure DrawQuad(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF; const AColors: array of TColorF); 226 procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF); 227 procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); 228 procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF); 229 procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); 216 procedure DrawTriangle(const APoints: array of TPointF; const ATexCoords: array of TPointF); overload; 217 procedure DrawTriangle(const APoints: array of TPointF; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload; 218 procedure DrawTriangle(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF); overload; 219 procedure DrawTriangle(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload; 220 procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF); overload; 221 procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload; 222 procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF); overload; 223 procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload; 224 procedure DrawQuad(const APoints: array of TPointF; const ATexCoords: array of TPointF); overload; 225 procedure DrawQuad(const APoints: array of TPointF; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload; 226 procedure DrawQuad(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF); overload; 227 procedure DrawQuad(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload; 228 procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF); overload; 229 procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload; 230 procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF); overload; 231 procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload; 230 232 231 233 property Width: integer read GetWidth; … … 266 268 procedure NoClip; override; 267 269 destructor Destroy; override; 268 procedure SwapRedBlue; over ride; overload;270 procedure SwapRedBlue; overload; override; 269 271 function Resample(newWidth, newHeight: integer; mode: TResampleMode=rmFineResample): TBGRACustomBitmap; override; 270 procedure ApplyGlobalOpacity(alpha: byte); over ride; overload;271 procedure ReplaceColor(before, after: TColor); over ride; overload;272 procedure ReplaceColor(before, after: TBGRAPixel); over ride; overload;273 procedure ReplaceTransparent(after: TBGRAPixel); over ride; overload;272 procedure ApplyGlobalOpacity(alpha: byte); overload; override; 273 procedure ReplaceColor(before, after: TColor); overload; override; 274 procedure ReplaceColor(before, after: TBGRAPixel); overload; override; 275 procedure ReplaceTransparent(after: TBGRAPixel); overload; override; 274 276 procedure SetClipRect(const AValue: TRect); override; 275 277 procedure SetSize(AWidth, AHeight: integer); override; … … 363 365 procedure ToggleFlipY; virtual; abstract; 364 366 procedure ToggleMask; virtual; 367 function FilterBlurMotion({%H-}ARadius: single; {%H-}ABlurType: TRadialBlurType; {%H-}ADirection: TPointF): IBGLTexture; virtual; 368 function FilterBlurRadial({%H-}ARadius: single; {%H-}ABlurType: TRadialBlurType): IBGLTexture; virtual; 365 369 366 370 procedure SetFrameSize(x,y: integer); … … 395 399 procedure DrawAffine(x,y: single; const AMatrix: TAffineMatrix; AAlpha: byte = 255); overload; 396 400 procedure DrawAffine(x,y: single; const AMatrix: TAffineMatrix; AColor: TBGRAPixel); overload; 397 procedure DrawTriangle(const APoints: array of TPointF; const ATexCoords: array of TPointF); 398 procedure DrawTriangle(const APoints: array of TPointF; const ATexCoords: array of TPointF; const AColors: array of TColorF); 399 procedure DrawTriangle(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF); 400 procedure DrawTriangle(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF; const AColors: array of TColorF); 401 procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF); 402 procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); 403 procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF); 404 procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); 405 procedure DrawQuad(const APoints: array of TPointF; const ATexCoords: array of TPointF); 406 procedure DrawQuad(const APoints: array of TPointF; const ATexCoords: array of TPointF; const AColors: array of TColorF); 407 procedure DrawQuad(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF); 408 procedure DrawQuad(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF; const AColors: array of TColorF); 409 procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF); 410 procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); 411 procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF); 412 procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); 401 procedure DrawTriangle(const APoints: array of TPointF; const ATexCoords: array of TPointF); overload; 402 procedure DrawTriangle(const APoints: array of TPointF; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload; 403 procedure DrawTriangle(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF); overload; 404 procedure DrawTriangle(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload; 405 procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF); overload; 406 procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload; 407 procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF); overload; 408 procedure DrawTriangle(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload; 409 procedure DrawQuad(const APoints: array of TPointF; const ATexCoords: array of TPointF); overload; 410 procedure DrawQuad(const APoints: array of TPointF; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload; 411 procedure DrawQuad(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF); overload; 412 procedure DrawQuad(const APoints: array of TPointF; const APointsZ: array of Single; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload; 413 procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF); overload; 414 procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload; 415 procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF); overload; 416 procedure DrawQuad(const APoints3D: array of TPoint3D_128; const ANormals3D: array of TPoint3D_128; const ATexCoords: array of TPointF; const AColors: array of TColorF); overload; 413 417 414 418 property Width: integer read GetWidth; … … 427 431 end; 428 432 433 { TBGLCustomFrameBuffer } 434 435 TBGLCustomFrameBuffer = class 436 protected 437 FCanvas: pointer; 438 function GetTexture: IBGLTexture; virtual; abstract; 439 function GetHandle: pointer; virtual; abstract; 440 function GetMatrix: TAffineMatrix; virtual; abstract; 441 function GetHeight: integer; virtual; abstract; 442 function GetProjectionMatrix: TMatrix4D; virtual; abstract; 443 function GetWidth: integer; virtual; abstract; 444 procedure SetMatrix(AValue: TAffineMatrix); virtual; abstract; 445 procedure SetProjectionMatrix(AValue: TMatrix4D); virtual; abstract; 446 447 public 448 procedure UseOrthoProjection; overload; virtual; 449 procedure UseOrthoProjection(AMinX,AMinY,AMaxX,AMaxY: single); overload; virtual; 450 function MakeTextureAndFree: IBGLTexture; virtual; 451 452 procedure SetCanvas(ACanvas: Pointer); //for internal use 453 property Matrix: TAffineMatrix read GetMatrix write SetMatrix; 454 property ProjectionMatrix: TMatrix4D read GetProjectionMatrix write SetProjectionMatrix; 455 property Width: integer read GetWidth; 456 property Height: integer read GetHeight; 457 property Handle: pointer read GetHandle; 458 property Texture: IBGLTexture read GetTexture; 459 end; 460 429 461 type 430 462 TBGLBitmapAny = class of TBGLCustomBitmap; … … 441 473 442 474 uses BGRAFilterScanner; 475 476 procedure TBGLCustomFrameBuffer.UseOrthoProjection; 477 begin 478 ProjectionMatrix := OrthoProjectionToOpenGL(0,0,Width,Height); 479 end; 480 481 procedure TBGLCustomFrameBuffer.UseOrthoProjection(AMinX, AMinY, AMaxX, AMaxY: single); 482 begin 483 ProjectionMatrix := OrthoProjectionToOpenGL(AMinX,AMinY,AMaxX,AMaxY); 484 end; 485 486 function TBGLCustomFrameBuffer.MakeTextureAndFree: IBGLTexture; 487 begin 488 result := nil; 489 raise exception.create('Not implemented'); 490 end; 491 492 procedure TBGLCustomFrameBuffer.SetCanvas(ACanvas: Pointer); 493 begin 494 FCanvas := ACanvas; 495 end; 443 496 444 497 function OrthoProjectionToOpenGL(AMinX, AMinY, AMaxX, AMaxY: Single): TMatrix4D; … … 595 648 end; 596 649 650 function TBGLCustomTexture.FilterBlurMotion(ARadius: single; ABlurType: TRadialBlurType; 651 ADirection: TPointF): IBGLTexture; 652 begin 653 result := nil; 654 raise exception.Create('Not implemented'); 655 end; 656 657 function TBGLCustomTexture.FilterBlurRadial(ARadius: single; ABlurType: TRadialBlurType): IBGLTexture; 658 begin 659 result := nil; 660 raise exception.Create('Not implemented'); 661 end; 662 597 663 procedure TBGLCustomTexture.Update(ARGBAData: PDWord; AllocatedWidth, 598 664 AllocatedHeight, ActualWidth, ActualHeight: integer; RGBAOrder: boolean); … … 757 823 begin 758 824 if not TBGRAPixel_RGBAOrder and not SupportsBGRAOrder then SwapRedBlue; 825 if LineOrder = riloBottomToTop then VerticalFlip; 759 826 InitFromData(PDWord(Data), Width,Height, Width,Height, TBGRAPixel_RGBAOrder or not SupportsBGRAOrder); 827 if LineOrder = riloBottomToTop then VerticalFlip; 760 828 if not TBGRAPixel_RGBAOrder and not SupportsBGRAOrder then SwapRedBlue; 761 829 end; … … 1004 1072 AAlpha: byte); 1005 1073 begin 1074 {$PUSH}{$OPTIMIZATION OFF} 1006 1075 DoDrawAffine(Origin,HAxis,VAxis, BGRA(255,255,255,AAlpha)); 1076 {$POP} 1007 1077 end; 1008 1078 … … 1010 1080 AColor: TBGRAPixel); 1011 1081 begin 1082 {$PUSH}{$OPTIMIZATION OFF} 1012 1083 DoDrawAffine(Origin,HAxis,VAxis, AColor); 1084 {$POP} 1013 1085 end; 1014 1086
Note:
See TracChangeset
for help on using the changeset viewer.