Drag-Drop-Set-Property-Item

This commit is contained in:
2023-07-03 15:53:10 -07:00
parent d23398db7a
commit 662ddfc44d
22 changed files with 652 additions and 77 deletions

View File

@ -152,22 +152,12 @@ public class D_Face
#pragma warning disable CA1416
private PropertyItem GetPropertyItem(int id, string value)
{
PropertyItem result = (PropertyItem)_ConstructorInfo.Invoke(null);
byte[] bytes = C_Resize.GetBytes(value);
result.Id = id;
result.Len = value.Length + 1;
result.Type = 2;
result.Value = bytes;
return result;
}
private void SaveFaces(FileHolder resizedFileHolder, List<(Shared.Models.Face, FileInfo?, string, bool)> collection)
{
int width;
int height;
Bitmap bitmap;
short type = 2;
Graphics graphics;
Location? location;
Rectangle rectangle;
@ -200,11 +190,11 @@ public class D_Face
{
using (graphics = Graphics.FromImage(bitmap))
graphics.DrawImage(source, new Rectangle(0, 0, width, height), rectangle, GraphicsUnit.Pixel);
propertyItem = GetPropertyItem(fileSource, locationJson);
propertyItem = Shared.Models.Stateless.Methods.IProperty.GetPropertyItem(_ConstructorInfo, fileSource, type, locationJson);
bitmap.SetPropertyItem(propertyItem);
propertyItem = GetPropertyItem(artist, outputResolutionJson);
propertyItem = Shared.Models.Stateless.Methods.IProperty.GetPropertyItem(_ConstructorInfo, artist, type, outputResolutionJson);
bitmap.SetPropertyItem(propertyItem);
propertyItem = GetPropertyItem(userComment, faceEncodingJson);
propertyItem = Shared.Models.Stateless.Methods.IProperty.GetPropertyItem(_ConstructorInfo, userComment, type, faceEncodingJson);
bitmap.SetPropertyItem(propertyItem);
bitmap.Save(fileInfo.FullName, _ImageCodecInfo, _EncoderParameters);
}