Стартовый пул
This commit is contained in:
BIN
bgrabitmap/test/gammafactor/gammafactor.ico
Normal file
BIN
bgrabitmap/test/gammafactor/gammafactor.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
84
bgrabitmap/test/gammafactor/gammafactor.lpi
Normal file
84
bgrabitmap/test/gammafactor/gammafactor.lpi
Normal file
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="10"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="gammafactor"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="3">
|
||||
<Item1>
|
||||
<PackageName Value="bgracontrols"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="BGRABitmapPack"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item3>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="gammafactor.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="umain.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="gammafactor"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
21
bgrabitmap/test/gammafactor/gammafactor.lpr
Normal file
21
bgrabitmap/test/gammafactor/gammafactor.lpr
Normal file
@@ -0,0 +1,21 @@
|
||||
program gammafactor;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, umain
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
75
bgrabitmap/test/gammafactor/umain.lfm
Normal file
75
bgrabitmap/test/gammafactor/umain.lfm
Normal file
@@ -0,0 +1,75 @@
|
||||
object Form1: TForm1
|
||||
Left = 294
|
||||
Height = 304
|
||||
Top = 176
|
||||
Width = 423
|
||||
Caption = 'Gamma factor'
|
||||
ClientHeight = 304
|
||||
ClientWidth = 423
|
||||
OnCreate = FormCreate
|
||||
Position = poDefault
|
||||
LCLVersion = '1.8.2.0'
|
||||
WindowState = wsMaximized
|
||||
object BGRAVirtualScreen1: TBGRAVirtualScreen
|
||||
Left = 0
|
||||
Height = 160
|
||||
Top = 144
|
||||
Width = 423
|
||||
OnRedraw = BGRAVirtualScreen1Redraw
|
||||
Align = alClient
|
||||
Alignment = taLeftJustify
|
||||
Color = clWhite
|
||||
ParentColor = False
|
||||
TabOrder = 0
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Height = 144
|
||||
Top = 0
|
||||
Width = 423
|
||||
Align = alTop
|
||||
ClientHeight = 144
|
||||
ClientWidth = 423
|
||||
TabOrder = 1
|
||||
object TrackBar_Gamma: TTrackBar
|
||||
Left = 16
|
||||
Height = 37
|
||||
Top = 32
|
||||
Width = 392
|
||||
Frequency = 2
|
||||
Max = 60
|
||||
Min = 20
|
||||
OnChange = TrackBar_GammaChange
|
||||
Position = 20
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabOrder = 0
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 14
|
||||
Height = 17
|
||||
Top = 8
|
||||
Width = 84
|
||||
Caption = 'Gamma factor:'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label_GammaValue: TLabel
|
||||
Left = 104
|
||||
Height = 17
|
||||
Top = 8
|
||||
Width = 5
|
||||
Caption = '?'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 16
|
||||
Height = 57
|
||||
Top = 80
|
||||
Width = 392
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = False
|
||||
Caption = 'With the right gamma value, the lightness should be uniform. For LCD screen this can be impossible. In that case, the lightness should be equal in the middle of the screen.'
|
||||
ParentColor = False
|
||||
WordWrap = True
|
||||
end
|
||||
end
|
||||
end
|
87
bgrabitmap/test/gammafactor/umain.pas
Normal file
87
bgrabitmap/test/gammafactor/umain.pas
Normal file
@@ -0,0 +1,87 @@
|
||||
unit umain;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
||||
ComCtrls, StdCtrls, BGRAVirtualScreen, BGRABitmap, BGRABitmapTypes;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
BGRAVirtualScreen1: TBGRAVirtualScreen;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label_GammaValue: TLabel;
|
||||
Panel1: TPanel;
|
||||
TrackBar_Gamma: TTrackBar;
|
||||
procedure BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure TrackBar_GammaChange(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
FInitialised: boolean;
|
||||
public
|
||||
{ public declarations }
|
||||
procedure UpdateLabelGamma;
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FInitialised:= false;
|
||||
UpdateLabelGamma;
|
||||
TrackBar_Gamma.Position := round(BGRAGetGamma*20);
|
||||
FInitialised:= true;
|
||||
end;
|
||||
|
||||
procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
|
||||
const stripSize = 20;
|
||||
var c: TBGRAPixel;
|
||||
pattern: TBGRABitmap;
|
||||
i: Integer;
|
||||
begin
|
||||
c := clWhite;
|
||||
c.Lightness := 32768;
|
||||
pattern := TBGRABitmap.Create(2,2);
|
||||
pattern.SetPixel(0,0,BGRABlack);
|
||||
pattern.SetPixel(1,0,BGRAWhite);
|
||||
pattern.SetPixel(0,1,BGRAWhite);
|
||||
pattern.SetPixel(1,1,BGRABlack);
|
||||
for i := 0 to Bitmap.Width div stripSize do
|
||||
begin
|
||||
Bitmap.FillRect(stripSize*i,0,stripSize*i+ stripSize div 2,Bitmap.Height,c,dmSet);
|
||||
Bitmap.FillRect(stripSize*i+ stripSize div 2,0,stripSize*(i+1),Bitmap.Height,pattern,dmSet);
|
||||
end;
|
||||
pattern.Free;
|
||||
end;
|
||||
|
||||
procedure TForm1.TrackBar_GammaChange(Sender: TObject);
|
||||
begin
|
||||
if FInitialised then
|
||||
begin
|
||||
BGRASetGamma(TrackBar_Gamma.Position/20);
|
||||
UpdateLabelGamma;
|
||||
BGRAVirtualScreen1.RedrawBitmap;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.UpdateLabelGamma;
|
||||
begin
|
||||
Label_GammaValue.Caption:= FloatToStrF(BGRAGetGamma, ffFixed, 2,2);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user