![]() |
NSVisualEffectView
Hallo,
hat schon einmal jemand ![]() Peter |
AW: NSVisualEffectView
Zitat:
Damit kann alles Transparent gestaltet werden inclusive aufgesetzten Controls die alle auf Interface basieren. EDIT: Es geht hier aber wohl um macOS? (FMX?) Damit kann ich nicht dienen. |
AW: NSVisualEffectView
Genau,
dieses View wurde später eingeführt und erlaubt so hardwarebeschleunigte Spezialeffekte, wie den Hintergrund des Fensters durchschimmern zu lassen. Das klingt jetzt erstmal nach nichts essentiellem, aber wenn du eine Anwendung unter Mac anbieten möchtest, dann wirkt diese ein bisschen wie ein Fremdkörper. Gefühlt jede Anwendung nutzt dieses neue View. Man kann jetzt tricksen und ein transparentes Fenster erstellen und dann die Rahmen selber malen, aber das ist friem und jedes Mal, wenn Apple sich entscheidet die Fenster mehr bzw. weniger abzurunden, musst du das dann anpassen. Peter |
AW: NSVisualEffectView
Zitat:
Nun gut wie schon gesagt für macOs kann ich leider nichts tun. Sorry |
AW: NSVisualEffectView
Man kann so etwas machen. Ich hab es aber nicht wirklich getestet.
Delphi-Quellcode:
Christian
unit UNSVisualEffectView;
interface {$IFDEF MACOS} {$IFNDEF IOS} uses MacApi.CocoaTypes, MacApi.AppKit, MacApi.ObjectiveC, FMX.Forms; const NSVisualEffectMaterialAppearanceBased = 0; NSVisualEffectMaterialLight = 1; NSVisualEffectMaterialDark = 2; NSVisualEffectMaterialTitlebar = 3; NSVisualEffectBlendingModeBehindWindow = 0; NSVisualEffectBlendingModeWithinWindow = 1; NSVisualEffectStateFollowsWindowActiveState = 0; NSVisualEffectStateActive = 1; NSVisualEffectStateInactive = 2; NSVisualEffectViewMaterialFullScreenUI = 15; type NSVisualEffectMaterial = NSInteger; NSVisualEffectMaterialPtr = ^NSVisualEffectMaterial; NSVisualEffectBlendingMode = NSInteger; NSVisualEffectBlendingModePtr = ^NSVisualEffectBlendingMode; NSVisualEffectState = NSInteger; NSVisualEffectStatePtr = ^NSVisualEffectState; NSVisualEffectViewClass = interface(NSViewClass) ['{EF4AB3D6-5620-44CD-82F0-FD80FB79FB9D}'] { class } procedure setMaterial(newValue: NSVisualEffectMaterial); cdecl; { class } function material: NSVisualEffectMaterial; cdecl; { class } function interiorBackgroundStyle: NSBackgroundStyle; cdecl; { class } procedure setBlendingMode (newValue: NSVisualEffectBlendingMode); cdecl; { class } function blendingMode: NSVisualEffectBlendingMode; cdecl; { class } procedure setState(newValue: NSVisualEffectState); cdecl; { class } function state: NSVisualEffectState; cdecl; { class } procedure setMaskImage(newValue: NSImage); cdecl; { class } function maskImage: NSImage; cdecl; { class } procedure viewDidMoveToWindow; cdecl; { class } procedure viewWillMoveToWindow(newWindow: NSWindow); cdecl; end; NSVisualEffectView = interface(NSView) procedure setMaterial(newValue: NSVisualEffectMaterial); cdecl; function material: NSVisualEffectMaterial; cdecl; function interiorBackgroundStyle: NSBackgroundStyle; cdecl; procedure setBlendingMode(newValue: NSVisualEffectBlendingMode); cdecl; function blendingMode: NSVisualEffectBlendingMode; cdecl; procedure setState(newValue: NSVisualEffectState); cdecl; function state: NSVisualEffectState; cdecl; procedure setMaskImage(newValue: NSImage); cdecl; function maskImage: NSImage;cdecl; procedure viewDidMoveToWindow;cdecl; procedure viewWillMoveToWindow(newWindow: NSWindow);cdecl; end; TNSVisualEffectView = class(TOCGenericImport<NSVisualEffectViewClass, NSVisualEffectView>) end; procedure AppendToForm(const AForm: TCommonCustomForm); {$ENDIF} {$ENDIF} implementation {$IFDEF MACOS} {$IFNDEF IOS} uses FMX.Platform.Mac; procedure AppendToForm(const AForm: TCommonCustomForm); var NSWin: NSWindow; BlurView: NSVisualEffectView; ContentView: NSView; begin NSWin := WindowHandleToPlatform(AForm.Handle).Wnd; NSWin.setOpaque(false); NSWin.setAlphaValue(0.98); BlurView := TNSVisualEffectView.Wrap( TNSVisualEffectView.Alloc.initWithFrame( MakeNSRect(0,0, AForm.Width, AForm.Height))); BlurView.setBlendingMode(NSVisualEffectBlendingModeBehindWindow); BlurView.setMaterial(NSVisualEffectViewMaterialFullScreenUI); BlurView.setState(NSVisualEffectStateActive); ContentView := TNSView.Wrap(NSWin.ContentView); ContentView.setAutoresizesSubviews(True); ContentView.addSubview(BlurView); end; {$ENDIF} {$ENDIF} end. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:55 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz