46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using ImageHandlingLibrary.InterFaces;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing.Imaging;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Media.Imaging;
|
|
|
|
namespace ImageHandlingLibrary
|
|
{
|
|
public class Filing : IFiling
|
|
{
|
|
private readonly IRegistring _registring;
|
|
|
|
public Filing(IRegistring registring)
|
|
{
|
|
_registring = registring;
|
|
}
|
|
public BitmapImage ConvertFromDrawImage(System.Drawing.Image _image)
|
|
{
|
|
using (var ms = new MemoryStream())
|
|
{
|
|
//System.Drawing.Image.FromFile(@"D:\CsharpDevelop\PictureHandlingProject\pictures\AgueroVillage.JPG").Save(ms, ImageFormat.Bmp);
|
|
_image.Save(ms, ImageFormat.Bmp);
|
|
ms.Seek(0, SeekOrigin.Begin);
|
|
|
|
var bitmapImage = new BitmapImage();
|
|
bitmapImage.BeginInit();
|
|
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
|
|
bitmapImage.StreamSource = ms;
|
|
bitmapImage.EndInit();
|
|
|
|
return bitmapImage;
|
|
}
|
|
}
|
|
|
|
public string ShowText()
|
|
{
|
|
var output = _registring.GetRegistryRootDir();
|
|
return $"Root directory value is {output} OBS Test!!";
|
|
}
|
|
}
|
|
}
|