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