Changeset 473 for trunk/Packages/CevoComponents
- Timestamp:
- Dec 4, 2023, 12:13:15 PM (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CevoComponents/ScreenTools.pas
r468 r473 104 104 procedure UnshareBitmap(Bitmap: TBitmap); 105 105 procedure Gtk2Fix; 106 procedure LoadConfig(Key: string); 107 procedure SaveConfig(Key: string); 106 108 107 109 const … … 193 195 UniFont: array [TFontType] of TFont; 194 196 Gamma: Integer; // global gamma correction (cent) 197 CustomDpiEnabled: Boolean; 198 CustomDpi: Integer; 195 199 196 200 procedure LoadAssets; … … 204 208 uses 205 209 {$IFDEF DPI}Dpi.PixelPointer,{$ELSE}PixelPointer,{$ENDIF} 206 Directories, Sound ;210 Directories, Sound, Registry; 207 211 208 212 var … … 1550 1554 procedure PaintLogo(Canvas: TCanvas; X, Y, LightColor, ShadeColor: Integer); 1551 1555 begin 1556 if not Assigned(LogoBuffer) then Exit; 1552 1557 UnshareBitmap(LogoBuffer); 1553 1558 BitBltCanvas(LogoBuffer.Canvas, 0, 0, Logo.Width, Logo.Height, Canvas, X, Y); … … 1732 1737 end; 1733 1738 1739 procedure LoadConfig(Key: string); 1740 var 1741 Reg: TRegistry; 1742 begin 1743 Reg := TRegistry.Create; 1744 with Reg do try 1745 OpenKey(Key, True); 1746 if ValueExists('Gamma') then Gamma := ReadInteger('Gamma') 1747 else Gamma := 100; 1748 if Gamma <> 100 then InitGammaLookupTable; 1749 if ValueExists('CustomDpiEnabled') then CustomDpiEnabled := Reg.ReadBool('CustomDpiEnabled') 1750 else CustomDpiEnabled := False; 1751 if ValueExists('CustomDpi') then CustomDpi := Reg.ReadInteger('CustomDpi') 1752 else CustomDpi := 96; 1753 {$IFDEF DPI} 1754 if CustomDpiEnabled then Screen.Dpi := CustomDpi 1755 else Screen.Dpi := Screen.GetSystemDpi; 1756 {$ENDIF} 1757 finally 1758 Reg.Free; 1759 end; 1760 end; 1761 1762 procedure SaveConfig(Key: string); 1763 var 1764 Reg: TRegistry; 1765 begin 1766 Reg := TRegistry.Create; 1767 with Reg do try 1768 OpenKey(Key, True); 1769 WriteInteger('Gamma', Gamma); 1770 WriteBool('CustomDpiEnabled', CustomDpiEnabled); 1771 WriteInteger('CustomDpi', CustomDpi); 1772 finally 1773 Free; 1774 end; 1775 end; 1776 1734 1777 procedure LoadAssets; 1735 1778 begin … … 1752 1795 end; 1753 1796 1797 LogoBuffer := TBitmap.Create; 1798 LogoBuffer.PixelFormat := TPixelFormat.pf24bit; 1799 LogoBuffer.SetSize(BigBook.Width, BigBook.Height); 1800 1754 1801 LoadGraphicFile(Colors, GetGraphicsDir + DirectorySeparator + 'Colors.png'); 1755 1802 LoadGraphicFile(Paper, GetGraphicsDir + DirectorySeparator + 'Paper.jpg'); … … 1801 1848 1802 1849 LoadAssets; 1803 1804 LogoBuffer := TBitmap.Create;1805 LogoBuffer.PixelFormat := TPixelFormat.pf24bit;1806 LogoBuffer.SetSize(BigBook.Width, BigBook.Height);1807 1850 end; 1808 1851 … … 1814 1857 FreeAndNil(Phrases); 1815 1858 FreeAndNil(Phrases2); 1816 FreeAndNil(LogoBuffer);1859 if Assigned(LogoBuffer) then FreeAndNil(LogoBuffer); 1817 1860 FreeAndNil(BigImp); 1818 1861 FreeAndNil(Paper);
Note:
See TracChangeset
for help on using the changeset viewer.