add GetPixbuf
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Version>1.0.0</Version>
|
||||
<Version>1.0.1</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,12 +7,13 @@ namespace Pilz.UI.Gtk.Symbols;
|
||||
|
||||
public abstract class GtkSymbolFactory<TSymbols> : BaseSymbolFactory<TSymbols>, IGtkSymbolFactory<TSymbols>
|
||||
{
|
||||
public virtual Image? GetImage(TSymbols svgImage, SymbolSize size)
|
||||
|
||||
public virtual Pixbuf? GetPixbuf(TSymbols svgImage, SymbolSize size)
|
||||
{
|
||||
return GetImage(svgImage, ResolveCommonSize(size));
|
||||
return GetPixbuf(svgImage, ResolveCommonSize(size));
|
||||
}
|
||||
|
||||
public virtual Image? GetImage(TSymbols svgImage, Size size)
|
||||
public virtual Pixbuf? GetPixbuf(TSymbols svgImage, Size size)
|
||||
{
|
||||
using var stream = GetImageRessourceStream(svgImage);
|
||||
|
||||
@@ -25,7 +26,19 @@ public abstract class GtkSymbolFactory<TSymbols> : BaseSymbolFactory<TSymbols>,
|
||||
else
|
||||
pixbuf = new(stream, size.Width, size.Height);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
public virtual Image? GetImage(TSymbols svgImage, SymbolSize size)
|
||||
{
|
||||
return GetImage(svgImage, ResolveCommonSize(size));
|
||||
}
|
||||
|
||||
public virtual Image? GetImage(TSymbols svgImage, Size size)
|
||||
{
|
||||
if (GetPixbuf(svgImage, size) is Pixbuf pixbuf)
|
||||
return GetImageFromPixbuf(pixbuf);
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual Image GetImageFromPixbuf(Pixbuf pixbuf)
|
||||
|
||||
@@ -8,5 +8,7 @@ public interface IGtkSymbolFactory<TSymbols> : IBaseSymbolFactory<TSymbols>
|
||||
{
|
||||
Image? GetImage(TSymbols svgImage, Size size);
|
||||
Image? GetImage(TSymbols svgImage, SymbolSize size);
|
||||
Gdk.Pixbuf? GetPixbuf(TSymbols svgImage, Size size);
|
||||
Gdk.Pixbuf? GetPixbuf(TSymbols svgImage, SymbolSize size);
|
||||
Image GetImageFromPixbuf(Gdk.Pixbuf pixbuf);
|
||||
}
|
||||
Reference in New Issue
Block a user