Skip to content

Commit 6b769ea

Browse files
committed
Adjustments > Color > Color lookup: a full set of filters is now available!
A set of 32 LUTs now ship with PD by default. These 32 filters are adopted from popular Instagram filters. I've minimized them as best I can so they only require ~100 KB in the .exe. These LUTs will be auto-extracted just once. After the initial extraction, the user is free to modify them however they want without worrying about being overwritten in the future.
1 parent 9341f0e commit 6b769ea

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

Classes/pdResources.cls

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Attribute VB_Exposed = False
1515
'PhotoDemon Resource Manager
1616
'Copyright 2016-2022 by Tanner Helland
1717
'Created: 13/December/16
18-
'Last updated: 03/October/19
19-
'Last update: switch to new pdPackage format for performance and memory gains
18+
'Last updated: 21/June/22
19+
'Last update: automatically extract 3D LUT (color lookup table) collection on first run
2020
'
2121
'PhotoDemon needs to include a whole swatch of custom resources. These resources take up a lot of space,
2222
' and we also need to pull different resources depending on things like screen DPI. To simplify this process,
@@ -243,6 +243,34 @@ Friend Function ExtractDefaultAssets() As Boolean
243243
UserPrefs.SetPref_Boolean "Assets", "ExtractedColorProfiles", True
244244
End If
245245

246+
'3D LUTs
247+
If (Not UserPrefs.GetPref_Boolean("Assets", "Extracted3DLUTs", False)) Then
248+
PDDebug.LogAction "3D LUT collection has never been extracted before. Extracting now..."
249+
If Me.LoadGenericResource("luts", tmpBytes) Then
250+
If cPackage.OpenPackage_Memory(VarPtr(tmpBytes(0)), UBound(tmpBytes) + 1) Then
251+
Do While cPackage.GetNextChunk(tmpChunkName, tmpChunkSize, tmpStream)
252+
If (tmpChunkName = "NAME") Then
253+
dstFilename = UserPrefs.GetLUTPath(True) & tmpStream.ReadString_UTF8(tmpChunkSize)
254+
If cPackage.GetNextChunk(tmpChunkName, tmpChunkSize, tmpStream) Then
255+
If (tmpChunkName = "DATA") Then
256+
If (Not Files.FileCreateFromPtr(tmpStream.Peek_PointerOnly(0, tmpChunkSize), tmpChunkSize, dstFilename, True)) Then
257+
RaiseResourceError "ExtractDefaultAssets: failed to create target file " & dstFilename
258+
End If
259+
End If
260+
Else
261+
RaiseResourceError "bad lut data: " & tmpChunkName
262+
End If
263+
Else
264+
RaiseResourceError "bad lut name: " & tmpChunkName
265+
End If
266+
Loop
267+
Else
268+
RaiseResourceError "ExtractDefaultAssets: failed to extract profile resource chunk"
269+
End If
270+
End If
271+
UserPrefs.SetPref_Boolean "Assets", "Extracted3DLUTs", True
272+
End If
273+
246274
End Function
247275

248276
'Given a path to a .pdr file, attempt to load and validate it

PhotoDemon.vbp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ Description="PhotoDemon Photo Editor"
513513
CompatibleMode="0"
514514
MajorVer=8
515515
MinorVer=9
516-
RevisionVer=1644
516+
RevisionVer=1645
517517
AutoIncrementVer=1
518518
ServerSupportFiles=0
519519
VersionComments="Copyright 2000-2022 Tanner Helland - photodemon.org"

0 commit comments

Comments
 (0)