Skip to content

Commit

Permalink
dev: Add onLutApplied on windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmin42 committed Feb 16, 2025
1 parent 2fb3902 commit b9937ce
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
5 changes: 5 additions & 0 deletions windows/PhotobookNet/DashboardPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -397,5 +397,10 @@ public void OnImageMapped(Guid imageId, VirtualImagePtr image)
{
throw new NotImplementedException();
}

public void OnLutApplied(Guid lutId, VirtualImagePtr image)
{
throw new NotImplementedException();
}
}
}
5 changes: 5 additions & 0 deletions windows/PhotobookNet/TableContentPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,11 @@ public void OnLutAdded(LutIconInfo lutIconInfo)
PhotobookSingletonWrapper.Inst().lutIconInfos.Add(lutIconInfo);
}

public void OnLutApplied(Guid imageId, VirtualImagePtr image)
{

}

public void Post(Functor f)
{
PhotobookSingletonWrapper.Inst().Post(() =>
Expand Down
25 changes: 25 additions & 0 deletions windows/PhotobookRuntimeComponent/PhotobookListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,31 @@ class PhotobookListener : PB::PhotobookListener {
mManagedListener.OnLutAdded(winrt::make<LutIconInfo>(iconInfo));
}

// TODO: Separate guid conversion from here and from other functions.
void onLutApplied(PBDev::LutId lutId, PB::GenericImagePtr image) override
{
auto nativeUuid = lutId.raw();

uint64_t data1 = nativeUuid.data[0] << 24 | nativeUuid.data[1] << 16 |
nativeUuid.data[2] << 8 | nativeUuid.data[3];

uint16_t data2 = nativeUuid.data[4] << 8 | nativeUuid.data[5];
uint16_t data3 = nativeUuid.data[6] << 8 | nativeUuid.data[7];

GUID existingGuid = {(unsigned long)data1,
data2,
data3,
{nativeUuid.data[8], nativeUuid.data[9],
nativeUuid.data[10], nativeUuid.data[11],
nativeUuid.data[12], nativeUuid.data[13],
nativeUuid.data[14], nativeUuid.data[15]}};

winrt::guid managedGuid(existingGuid);

mManagedListener.OnLutApplied(managedGuid,
winrt::make<VirtualImagePtr>(image));
}

void onProjectRead() override { mManagedListener.OnProjectRead(); }
void onMetadataUpdated(std::string focusedProjectName) override
{
Expand Down
2 changes: 2 additions & 0 deletions windows/PhotobookRuntimeComponent/PhotobookListener.idl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ interface PhotobookListener

void OnLutAdded(LutIconInfo lutIconInfo);

void OnLutApplied(Guid lutId, VirtualImagePtr image);

void Post(Functor f);
};
} // namespace PhotobookRuntimeComponent
19 changes: 19 additions & 0 deletions windows/PhotobookRuntimeComponent/PhotobookWin.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,25 @@ class PhotobookListener final : public PB::PhotobookListener {
mManagedListener.OnLutAdded(winrt::make<LutIconInfo>(iconInfo));
}

void onLutApplied(PBDev::LutId lutId, PB::GenericImagePtr image) override
{
auto nativeUuid = lutId.raw();
uint64_t data1 = nativeUuid.data[0] << 24 | nativeUuid.data[1] << 16 |
nativeUuid.data[2] << 8 | nativeUuid.data[3];
uint16_t data2 = nativeUuid.data[4] << 8 | nativeUuid.data[5];
uint16_t data3 = nativeUuid.data[6] << 8 | nativeUuid.data[7];
GUID existingGuid = {(unsigned long)data1,
data2,
data3,
{nativeUuid.data[8], nativeUuid.data[9],
nativeUuid.data[10], nativeUuid.data[11],
nativeUuid.data[12], nativeUuid.data[13],
nativeUuid.data[14], nativeUuid.data[15]}};
winrt::guid managedGuid(existingGuid);
mManagedListener.OnLutApplied(managedGuid,
winrt::make<VirtualImagePtr>(image));
}

void onProjectRead() override { mManagedListener.OnProjectRead(); }
void onMetadataUpdated(std::string focusedProjectName) override
{
Expand Down

0 comments on commit b9937ce

Please sign in to comment.