Preload logo
This commit is contained in:
parent
22cf884d4d
commit
ce347a7095
2 changed files with 184 additions and 167 deletions
|
|
@ -85,7 +85,7 @@ public class ImageCreatorSharp : IDisposable
|
|||
this.DestDir = destination;
|
||||
}
|
||||
|
||||
public async Task CreaImmagineThread(string Info)
|
||||
public async Task CreaImmagineThread(string Info, Image logo)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -120,7 +120,7 @@ public class ImageCreatorSharp : IDisposable
|
|||
|
||||
AggiungiTesto(g, imgOutputBig);
|
||||
|
||||
aggiungiLogo(imgOutputBig);
|
||||
aggiungiLogo(imgOutputBig, logo);
|
||||
|
||||
SalvaFoto(imgOutputBig, thumbSizeBig, nomeFileBig, nomeFileSmall, thumbSizeSmall, thisFormat);
|
||||
});
|
||||
|
|
@ -676,19 +676,14 @@ public class ImageCreatorSharp : IDisposable
|
|||
|
||||
|
||||
|
||||
private void aggiungiLogo(Bitmap imgOutputBig)
|
||||
private void aggiungiLogo(Bitmap imgOutputBig, Image logo)
|
||||
{
|
||||
// imgOutputBig
|
||||
if (PicSettings.LogoAggiungi == true & File.Exists(PicSettings.LogoNomeFile))
|
||||
{
|
||||
using var ImmagineLogo = Image.FromFile(PicSettings.LogoNomeFile);
|
||||
// using var ImmagineLogo = Image.FromFile(PicSettings.LogoNomeFile);
|
||||
|
||||
Color LogoColoreTrasparente = Color.White;
|
||||
// Dim bmWatermark As Bitmap
|
||||
|
||||
// * Create a Bitmap based on the previously modified photograph Bitmap
|
||||
// bmWatermark = New Bitmap(imgOutputBig)
|
||||
// bmWatermark.SetResolution(imgOutputBig.HorizontalResolution, imgOutputBig.VerticalResolution)
|
||||
|
||||
// * Load this Bitmap into a new Graphic Object
|
||||
using Graphics grWatermark = Graphics.FromImage(imgOutputBig);
|
||||
|
|
@ -711,13 +706,13 @@ public class ImageCreatorSharp : IDisposable
|
|||
|
||||
int FotoLogoH = PicSettings.LogoAltezza;
|
||||
int FotoLogoW = PicSettings.LogoLarghezza;
|
||||
double FattoreAlt = ImmagineLogo.Height / (double)FotoLogoH;
|
||||
double FattoreLarg = ImmagineLogo.Width / (double)FotoLogoW;
|
||||
double FattoreAlt = logo.Height / (double)FotoLogoH;
|
||||
double FattoreLarg = logo.Width / (double)FotoLogoW;
|
||||
Size NuovaSize;
|
||||
if (FattoreLarg > FattoreAlt)
|
||||
NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoW, "Larghezza");
|
||||
NuovaSize = NewthumbSize(logo.Width, logo.Height, FotoLogoW, "Larghezza");
|
||||
else
|
||||
NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoH, "Altezza");
|
||||
NuovaSize = NewthumbSize(logo.Width, logo.Height, FotoLogoH, "Altezza");
|
||||
|
||||
int MargineUsato;
|
||||
int MargineL;
|
||||
|
|
@ -777,7 +772,7 @@ public class ImageCreatorSharp : IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
grWatermark.DrawImage(ImmagineLogo, new Rectangle(xPosOfWm, yPosOfWm, NuovaSize.Width, NuovaSize.Height), 0, 0, ImmagineLogo.Width, ImmagineLogo.Height, GraphicsUnit.Pixel, imageAttributes);
|
||||
grWatermark.DrawImage(logo, new Rectangle(xPosOfWm, yPosOfWm, NuovaSize.Width, NuovaSize.Height), 0, 0, logo.Width, logo.Height, GraphicsUnit.Pixel, imageAttributes);
|
||||
//grWatermark.Dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue