This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program SkiaBlur; | |
uses | |
System.StartUpCopy, | |
FMX.Forms, | |
FMX.Types, | |
FMX.Skia, | |
Unit4 in 'Unit4.pas' {Form4}; | |
{$R *.res} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unit PixelCopy.Android; | |
interface | |
uses | |
Androidapi.JNI.GraphicsContentViewText, | |
FMX.Graphics; | |
function CaptureWindowPixels(const AWindow: JWindow): TBitmap; | |
function CaptureSurfaceHolderPixels(const ASurfaceHolder: JSurfaceHolder): TBitmap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Enable Skia on your project (right click on project > Enable Skia); | |
// 2. Add one TImage as the background; | |
// 3. Add one TSkPaintBox in front of the TImage and add the follow code on the TSkPaintBox.OnDraw event: | |
uses | |
System.Math; | |
procedure TForm1.SkPaintBox1Draw(ASender: TObject; const ACanvas: ISkCanvas; | |
const ADest: TRectF; const AOpacity: Single); | |
var |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GetResizedImage(const AImage: ISkImage; ATargetWidth, ATargetHeight: Integer; | |
ASamplingOptions: TSkSamplingOptions; AProgressive: Boolean = True): ISkImage; | |
function MakeResized(const AImage: ISkImage; ANewWidth, ANewHeight: Integer): ISkImage; | |
var | |
LSurface: ISkSurface; | |
begin | |
LSurface := TSkSurface.MakeRaster(ANewWidth, ANewHeight); | |
LSurface.Canvas.Clear(0); | |
LSurface.Canvas.Scale(ANewWidth / AImage.Width, ANewHeight / AImage.Height); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uses | |
Skia, Skia.FMX.Graphics; | |
procedure TForm1.SkPaintBox1Draw(ASender: TObject; const ACanvas: ISkCanvas; | |
const ADest: TRectF; const AOpacity: Single); | |
var | |
LTextLayout: TSkTextLayout; | |
LPaint: ISkPaint; | |
begin | |
LTextLayout := TSkTextLayout.Create; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function KeyName(const AKey: Word): string; | |
begin | |
case AKey of | |
1: Result := 'vkLButton'; | |
2: Result := 'vkRButton'; | |
3: Result := 'vkCancel'; | |
4: Result := 'vkMButton'; | |
5: Result := 'vkXButton1'; | |
6: Result := 'vkXButton2'; | |
8: Result := 'vkBack'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Form1: TForm1 | |
Left = 0 | |
Top = 0 | |
Caption = 'Form1' | |
ClientHeight = 480 | |
ClientWidth = 580 | |
FormFactor.Width = 320 | |
FormFactor.Height = 480 | |
FormFactor.Devices = [Desktop] | |
OnCreate = FormCreate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uses | |
System.UITypes, Skia; | |
function GetResizedImage(const AImage: ISkImage; const ANewWidth, ANewHeight: Integer): ISkImage; | |
var | |
LSurface: ISkSurface; | |
begin | |
LSurface := TSkSurface.MakeRaster(ANewWidth, ANewHeight); | |
LSurface.Canvas.Clear(TAlphaColors.Null); | |
LSurface.Canvas.Scale(ANewWidth / AImage.Width, ANewHeight / AImage.Height); |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Form1: TForm1 | |
Left = 0 | |
Top = 0 | |
Caption = 'Form1' | |
ClientHeight = 442 | |
ClientWidth = 628 | |
Color = clBtnFace | |
Font.Charset = DEFAULT_CHARSET | |
Font.Color = clWindowText | |
Font.Height = -12 |
NewerOlder