diff --git a/ChatAAC/ChatAAC.csproj b/ChatAAC/ChatAAC.csproj
index 4d9f633..d63810a 100644
--- a/ChatAAC/ChatAAC.csproj
+++ b/ChatAAC/ChatAAC.csproj
@@ -20,10 +20,14 @@
+
+
+
+
@@ -32,6 +36,7 @@
+
diff --git a/ChatAAC/Converters/BooleanToClassConverter.cs b/ChatAAC/Converters/BooleanToClassConverter.cs
new file mode 100644
index 0000000..5694cf0
--- /dev/null
+++ b/ChatAAC/Converters/BooleanToClassConverter.cs
@@ -0,0 +1,20 @@
+// BooleanToClassConverter.cs
+using Avalonia.Data.Converters;
+using System;
+using System.Globalization;
+
+namespace ChatAAC.Converters
+{
+ public class BooleanToClassConverter : IValueConverter
+ {
+ public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ return value != null ? "symbol action" : "symbol";
+ }
+
+ public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
diff --git a/ChatAAC/Converters/ColorConverter.cs b/ChatAAC/Converters/ColorConverter.cs
new file mode 100644
index 0000000..de8ca3c
--- /dev/null
+++ b/ChatAAC/Converters/ColorConverter.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Globalization;
+using System.Linq;
+using Avalonia.Data.Converters;
+using Avalonia.Media;
+
+namespace ChatAAC.Converters;
+
+public class ColorConverter : IValueConverter
+{
+ public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ if (value is not string colorString) return Colors.Transparent;
+ var rgb = colorString.Split(['(', ',', ')'], StringSplitOptions.RemoveEmptyEntries)
+ .Skip(1) // Skip "rgb"
+ .Select(int.Parse).ToList();
+ return Color.FromArgb(255, (byte)rgb[0], (byte)rgb[1], (byte)rgb[2]);
+ }
+
+ public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file
diff --git a/ChatAAC/Converters/StringToBitmapConverter.cs b/ChatAAC/Converters/StringToBitmapConverter.cs
index 4cc1e40..2e08ac7 100644
--- a/ChatAAC/Converters/StringToBitmapConverter.cs
+++ b/ChatAAC/Converters/StringToBitmapConverter.cs
@@ -1,26 +1,60 @@
+using Avalonia;
using Avalonia.Data.Converters;
using Avalonia.Media.Imaging;
using System;
using System.Globalization;
using System.IO;
+using SkiaSharp;
+using Svg.Skia;
namespace ChatAAC.Converters;
public class StringToBitmapConverter : IValueConverter
{
- public static StringToBitmapConverter Instance = new StringToBitmapConverter();
-
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is not string path || !File.Exists(path)) return null;
try
{
- return new Bitmap(path);
+ // Zakładając, że ścieżka wskazuje na plik SVG
+ if (!path.EndsWith(".svg", StringComparison.OrdinalIgnoreCase)) return new Bitmap(path);
+ using var stream = File.OpenRead(path);
+
+ using var svg = new SKSvg();
+ svg.Load(stream);
+
+ if (svg.Picture == null) return null;
+
+ // Ustawienie docelowego rozmiaru obrazu
+ const int targetWidth = 250;
+ const int targetHeight = 250;
+
+ // Obliczanie skali, aby zachować proporcje obrazu
+ float scaleX = targetWidth / svg.Picture.CullRect.Width;
+ float scaleY = targetHeight / svg.Picture.CullRect.Height;
+ float scale = Math.Min(scaleX, scaleY);
+
+ // Tworzenie i skalowanie bitmapy
+ var scaledSize = new SKImageInfo(targetWidth, targetHeight);
+ using var bitmap = new SKBitmap(scaledSize);
+ using var canvas = new SKCanvas(bitmap);
+ canvas.Clear(SKColors.Transparent);
+
+ var matrix = SKMatrix.CreateScale(scale, scale);
+ canvas.DrawPicture(svg.Picture, ref matrix);
+ canvas.Flush();
+
+ // Konwersja SKBitmap na Bitmapę Avalonii
+ using var image = SKImage.FromBitmap(bitmap);
+ using var data = image.Encode(SKEncodedImageFormat.Png, 100);
+ using var ms = new MemoryStream();
+ data.SaveTo(ms);
+ ms.Seek(0, SeekOrigin.Begin);
+ return new Bitmap(ms);
}
catch (Exception ex)
{
- Console.WriteLine($"Błąd podczas tworzenia Bitmap z {path}: {ex.Message}");
- // Możesz zwrócić domyślny obraz lub null
+ Console.WriteLine($"Błąd podczas tworzenia Bitmap z SVG: {ex.Message}");
return null;
}
}
diff --git a/ChatAAC/Helpers/ButtonStyleHelper.cs b/ChatAAC/Helpers/ButtonStyleHelper.cs
new file mode 100644
index 0000000..6f2c9f0
--- /dev/null
+++ b/ChatAAC/Helpers/ButtonStyleHelper.cs
@@ -0,0 +1,59 @@
+using Avalonia;
+using Avalonia.Controls;
+using System;
+
+namespace ChatAAC.Helpers
+{
+ public static class ButtonStyleHelper
+ {
+ public static readonly AttachedProperty