├── .gitignore ├── README.md ├── fluentdesign.lpi ├── fluentdesign.lpr ├── fluentdesign.png ├── umain.lfm └── umain.pas /.gitignore: -------------------------------------------------------------------------------- 1 | *.bak 2 | *.dbg 3 | *.exe 4 | *.lps 5 | backup/* 6 | backup 7 | lib 8 | debug 9 | *.res 10 | *.lrt 11 | *.o 12 | *.ppu 13 | *.or 14 | *.compiled 15 | *Thumbs.db 16 | *.app/* 17 | *.dSYM -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fluentdesign 2 | Fluent Design effect for Lazarus 3 | 4 | ![alt text](https://raw.githubusercontent.com/lainz/fluentdesign/master/fluentdesign.png) 5 | -------------------------------------------------------------------------------- /fluentdesign.lpi: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | <ResourceType Value="res"/> 11 | <UseXPManifest Value="True"/> 12 | </General> 13 | <BuildModes Count="1"> 14 | <Item1 Name="Default" Default="True"/> 15 | </BuildModes> 16 | <PublishOptions> 17 | <Version Value="2"/> 18 | </PublishOptions> 19 | <RunParams> 20 | <local> 21 | <FormatVersion Value="1"/> 22 | </local> 23 | </RunParams> 24 | <RequiredPackages Count="2"> 25 | <Item1> 26 | <PackageName Value="bgracontrols"/> 27 | </Item1> 28 | <Item2> 29 | <PackageName Value="LCL"/> 30 | </Item2> 31 | </RequiredPackages> 32 | <Units Count="2"> 33 | <Unit0> 34 | <Filename Value="fluentdesign.lpr"/> 35 | <IsPartOfProject Value="True"/> 36 | </Unit0> 37 | <Unit1> 38 | <Filename Value="umain.pas"/> 39 | <IsPartOfProject Value="True"/> 40 | <ComponentName Value="Form1"/> 41 | <HasResources Value="True"/> 42 | <ResourceBaseClass Value="Form"/> 43 | </Unit1> 44 | </Units> 45 | </ProjectOptions> 46 | <CompilerOptions> 47 | <Version Value="11"/> 48 | <PathDelim Value="\"/> 49 | <Target> 50 | <Filename Value="fluentdesign"/> 51 | </Target> 52 | <SearchPaths> 53 | <IncludeFiles Value="$(ProjOutDir)"/> 54 | <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> 55 | </SearchPaths> 56 | <Linking> 57 | <Options> 58 | <Win32> 59 | <GraphicApplication Value="True"/> 60 | </Win32> 61 | </Options> 62 | </Linking> 63 | </CompilerOptions> 64 | <Debugging> 65 | <Exceptions Count="3"> 66 | <Item1> 67 | <Name Value="EAbort"/> 68 | </Item1> 69 | <Item2> 70 | <Name Value="ECodetoolError"/> 71 | </Item2> 72 | <Item3> 73 | <Name Value="EFOpenError"/> 74 | </Item3> 75 | </Exceptions> 76 | </Debugging> 77 | </CONFIG> 78 | -------------------------------------------------------------------------------- /fluentdesign.lpr: -------------------------------------------------------------------------------- 1 | program fluentdesign; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | {$IFDEF UNIX}{$IFDEF UseCThreads} 7 | cthreads, 8 | {$ENDIF}{$ENDIF} 9 | Interfaces, // this includes the LCL widgetset 10 | Forms, umain 11 | { you can add units after this }; 12 | 13 | {$R *.res} 14 | 15 | begin 16 | RequireDerivedFormResource:=True; 17 | Application.Initialize; 18 | Application.CreateForm(TForm1, Form1); 19 | Application.Run; 20 | end. 21 | 22 | -------------------------------------------------------------------------------- /fluentdesign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lainz/fluentdesign/1946be5a7fdf87763d30049c2e8434b5b5d23ce5/fluentdesign.png -------------------------------------------------------------------------------- /umain.lfm: -------------------------------------------------------------------------------- 1 | object Form1: TForm1 2 | Left = 333 3 | Height = 600 4 | Top = 121 5 | Width = 800 6 | BorderStyle = bsNone 7 | Caption = 'Fluent Design' 8 | ClientHeight = 600 9 | ClientWidth = 800 10 | Color = clWhite 11 | OnCreate = FormCreate 12 | OnDestroy = FormDestroy 13 | OnMouseDown = FormMouseDown 14 | LCLVersion = '1.8.4.0' 15 | object BGRAVirtualScreen2: TBGRAVirtualScreen 16 | Left = 0 17 | Height = 600 18 | Top = 0 19 | Width = 800 20 | OnRedraw = BGRAVirtualScreen2Redraw 21 | Align = alClient 22 | Alignment = taLeftJustify 23 | Caption = 'BGRAVirtualScreen2' 24 | ClientHeight = 600 25 | ClientWidth = 800 26 | Color = clWhite 27 | ParentColor = False 28 | TabOrder = 0 29 | OnMouseDown = FormMouseDown 30 | object BGRAVirtualScreen1: TBGRAVirtualScreen 31 | Left = 0 32 | Height = 600 33 | Top = 0 34 | Width = 320 35 | OnRedraw = BGRAVirtualScreen1Redraw 36 | Align = alLeft 37 | Alignment = taLeftJustify 38 | ClientHeight = 600 39 | ClientWidth = 320 40 | Color = clWhite 41 | ParentColor = False 42 | TabOrder = 0 43 | OnMouseDown = FormMouseDown 44 | object Label1: TLabel 45 | Left = 16 46 | Height = 20 47 | Top = 8 48 | Width = 90 49 | Caption = 'Fluent Design' 50 | Font.Height = 20 51 | ParentColor = False 52 | ParentFont = False 53 | end 54 | end 55 | object Label2: TLabel 56 | Left = 344 57 | Height = 40 58 | Top = 32 59 | Width = 260 60 | Caption = 'About Fluent Design' 61 | Font.Height = 40 62 | ParentColor = False 63 | ParentFont = False 64 | end 65 | object Label3: TLabel 66 | Left = 344 67 | Height = 30 68 | Top = 88 69 | Width = 243 70 | Caption = 'Made for Lazarus by Lainz' 71 | Font.Height = 30 72 | ParentColor = False 73 | ParentFont = False 74 | end 75 | object Label4: TLabel 76 | Left = 344 77 | Height = 40 78 | Top = 136 79 | Width = 283 80 | Caption = 'Move the window around to see the effect.'#13#10'Thanks for watching!' 81 | Font.Height = 20 82 | ParentColor = False 83 | ParentFont = False 84 | end 85 | object Button1: TButton 86 | Left = 344 87 | Height = 25 88 | Top = 192 89 | Width = 75 90 | Caption = 'Close' 91 | OnClick = Button1Click 92 | TabOrder = 1 93 | end 94 | end 95 | end 96 | -------------------------------------------------------------------------------- /umain.pas: -------------------------------------------------------------------------------- 1 | unit umain; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | interface 6 | 7 | uses 8 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 | BGRAVirtualScreen, BGRABitmap, BGRABitmapTypes, BCTypes, Registry, Windows, 10 | LMEssages; 11 | 12 | const 13 | BLURSIZE = 50; 14 | ALPHAVALUE = 100; 15 | 16 | type 17 | 18 | { TForm1 } 19 | 20 | TForm1 = class(TForm) 21 | BGRAVirtualScreen1: TBGRAVirtualScreen; 22 | BGRAVirtualScreen2: TBGRAVirtualScreen; 23 | Button1: TButton; 24 | Label1: TLabel; 25 | Label2: TLabel; 26 | Label3: TLabel; 27 | Label4: TLabel; 28 | procedure BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap); 29 | procedure BGRAVirtualScreen2Redraw(Sender: TObject; Bitmap: TBGRABitmap); 30 | procedure Button1Click(Sender: TObject); 31 | procedure FormCreate(Sender: TObject); 32 | procedure FormDestroy(Sender: TObject); 33 | procedure FormMouseDown(Sender: TObject; Button: TMouseButton; 34 | Shift: TShiftState; X, Y: Integer); 35 | private 36 | wallpaper: TBGRABitmap; 37 | procedure WindowPosChanging(var Msg: TMessage); message WM_WINDOWPOSCHANGED; 38 | public 39 | 40 | end; 41 | 42 | var 43 | Form1: TForm1; 44 | 45 | implementation 46 | 47 | {$R *.lfm} 48 | 49 | { TForm1 } 50 | 51 | procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap); 52 | begin 53 | bitmap.PutImage(-Left, -Top, wallpaper, dmSet); 54 | Bitmap.Rectangle(0, 0, Bitmap.Width + 1, Bitmap.Height, BGRABlack, dmSet); 55 | end; 56 | 57 | procedure TForm1.BGRAVirtualScreen2Redraw(Sender: TObject; Bitmap: TBGRABitmap); 58 | begin 59 | Bitmap.Rectangle(0, 0, Bitmap.Width, Bitmap.Height, BGRABlack, dmSet); 60 | end; 61 | 62 | procedure TForm1.Button1Click(Sender: TObject); 63 | begin 64 | Close; 65 | end; 66 | 67 | procedure TForm1.FormCreate(Sender: TObject); 68 | var 69 | wall: string; 70 | reg: TRegistry; 71 | begin 72 | wallpaper := TBGRABitmap.Create; 73 | reg := TRegistry.Create(HKEY_CURRENT_USER); 74 | if reg.OpenKeyReadOnly('Control Panel\Desktop\') then 75 | begin 76 | wall := reg.ReadString('Wallpaper'); 77 | if FileExists(wall) then 78 | begin 79 | wallpaper.LoadFromFile(wall); 80 | BGRAReplace(wallpaper, wallpaper.FilterBlurRadial(BLURSIZE, BLURSIZE, rbBox)); 81 | wallpaper.Rectangle(0, 0, wallpaper.Width, wallpaper.Height, 82 | BGRA(255, 255, 255, ALPHAVALUE), BGRA(255, 255, 255, ALPHAVALUE), dmDrawWithTransparency); 83 | end; 84 | end; 85 | reg.Free; 86 | end; 87 | 88 | procedure TForm1.FormDestroy(Sender: TObject); 89 | begin 90 | wallpaper.Free; 91 | end; 92 | 93 | procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; 94 | Shift: TShiftState; X, Y: Integer); 95 | begin 96 | ReleaseCapture; 97 | SendMessage(Handle, LM_SYSCOMMAND, 61458, 0) ; 98 | end; 99 | 100 | procedure TForm1.WindowPosChanging(var Msg: TMessage); 101 | begin 102 | BGRAVirtualScreen1.DiscardBitmap; 103 | end; 104 | 105 | end. 106 | --------------------------------------------------------------------------------