Add color-key transparency support for logo overlays
- Allow users to select a transparent color for logo images (watermarks) via UI (checkbox, color picker, preview). - Apply color-key transparency in both System.Drawing and ImageSharp backends: specified color in logo is made fully transparent. - Persist transparency settings in PicSettings and SettingsDto; bind to DataModel and UI controls. - Update logo preview to reflect transparency in real time. - Add option to select image processing library (System.Drawing or ImageSharp) in UI and settings. - Fix bug in SettingsService parameter loading for int/double/DateTime. - Fully integrate color-key transparency into image processing and settings serialization.
This commit is contained in:
parent
63751af18d
commit
8872080741
9 changed files with 732 additions and 168 deletions
|
|
@ -30,6 +30,7 @@ namespace ImageCatalog_2
|
|||
public ICommand SaveSettingsCommand { get; }
|
||||
public ICommand LoadSettingsCommand { get; }
|
||||
public ICommand SelectColorCommand { get; }
|
||||
public ICommand SelectTransparentColorCommand { get; }
|
||||
|
||||
private readonly ITestService _service;
|
||||
private readonly ILogger<DataModel> _logger;
|
||||
|
|
@ -67,6 +68,7 @@ namespace ImageCatalog_2
|
|||
SaveSettingsCommand = new RelayCommand(SaveSettings);
|
||||
LoadSettingsCommand = new RelayCommand(LoadSettings);
|
||||
SelectColorCommand = new RelayCommand(SelectColor);
|
||||
SelectTransparentColorCommand = new RelayCommand(SelectTransparentColor);
|
||||
|
||||
// Load available fonts
|
||||
AvailableFonts = LoadAvailableFonts();
|
||||
|
|
@ -341,6 +343,28 @@ namespace ImageCatalog_2
|
|||
}
|
||||
}
|
||||
|
||||
private string _transparentColor = "#FFFFFF";
|
||||
public string TransparentColor
|
||||
{
|
||||
get => _transparentColor;
|
||||
set
|
||||
{
|
||||
_transparentColor = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private bool _useTransparentColor;
|
||||
public bool UseTransparentColor
|
||||
{
|
||||
get => _useTransparentColor;
|
||||
set
|
||||
{
|
||||
_useTransparentColor = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
// Logo/Watermark settings
|
||||
private string _logoFile = "";
|
||||
public string LogoFile
|
||||
|
|
@ -1129,6 +1153,7 @@ namespace ImageCatalog_2
|
|||
public event EventHandler SelectColorRequested;
|
||||
// Request that the View shows a message to the user (message, caption, icon)
|
||||
public event EventHandler<Tuple<string, string, MessageBoxIcon>> ShowMessageRequested;
|
||||
public event EventHandler SelectTransparentColorRequested;
|
||||
|
||||
private void SelectSourceFolder(object parameter)
|
||||
{
|
||||
|
|
@ -1160,6 +1185,11 @@ namespace ImageCatalog_2
|
|||
SelectColorRequested?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void SelectTransparentColor(object parameter)
|
||||
{
|
||||
SelectTransparentColorRequested?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public async Task SaveSettingsToFileAsync(string filePath)
|
||||
{
|
||||
await _settingsService.SaveSettingsAsync(filePath, this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue