本文整理汇总了C#中CameraControl.Core.Classes.FileItem.LoadInfo方法的典型用法代码示例。如果您正苦于以下问题:C# FileItem.LoadInfo方法的具体用法?C# FileItem.LoadInfo怎么用?C# FileItem.LoadInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CameraControl.Core.Classes.FileItem
的用法示例。
在下文中一共展示了FileItem.LoadInfo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetData
public void SetData(BitmapFile file, FileItem fileItem)
{
if (fileItem == null || fileItem.FileInfo == null)
return;
fileItem.LoadInfo();
file.FileName = Path.GetFileNameWithoutExtension(fileItem.FileName);
file.Comment = "";
if (fileItem.FileInfo.ExifTags.ContainName("Iptc.Application2.Caption"))
file.Comment = fileItem.FileInfo.ExifTags["Iptc.Application2.Caption"];
file.Metadata.Clear();
foreach (ValuePair item in fileItem.FileInfo.ExifTags.Items)
{
file.Metadata.Add(new DictionaryItem() { Name = item.Name, Value = item.Value });
}
file.BlueColorHistogramPoints = ConvertToPointCollection(fileItem.FileInfo.HistogramBlue);
file.RedColorHistogramPoints = ConvertToPointCollection(fileItem.FileInfo.HistogramRed);
file.GreenColorHistogramPoints = ConvertToPointCollection(fileItem.FileInfo.HistogramGreen);
file.LuminanceHistogramPoints = ConvertToPointCollection(fileItem.FileInfo.HistogramLuminance);
// file.InfoLabel = Path.GetFileName(file.FileItem.FileName);
file.InfoLabel = "";
//file.InfoLabel += String.Format(" | {0}x{1}", fileItem.FileInfo.Width, fileItem.FileInfo.Height);
if (fileItem.FileInfo.ExifTags.ContainName("Exif.Photo.ExposureTime"))
{
file.InfoLabel += "E " + fileItem.FileInfo.ExifTags["Exif.Photo.ExposureTime"];
}
if (fileItem.FileInfo.ExifTags.ContainName("Exif.Photo.FNumber"))
{
file.InfoLabel += " | " + fileItem.FileInfo.ExifTags["Exif.Photo.FNumber"];
}
if (fileItem.FileInfo.ExifTags.ContainName("Exif.Photo.ISOSpeedRatings"))
{
file.InfoLabel += " | ISO " + fileItem.FileInfo.ExifTags["Exif.Photo.ISOSpeedRatings"];
}
if (fileItem.FileInfo.ExifTags.ContainName("Exif.Photo.FocalLength"))
{
file.InfoLabel += " | " + fileItem.FileInfo.ExifTags["Exif.Photo.FocalLength"];
}
SetImageInfo(fileItem);
}
示例2: LoadImage
public WriteableBitmap LoadImage(FileItem fileItem, bool fullres, bool showfocuspoints)
{
if (fileItem == null)
return null;
if (!File.Exists(fileItem.LargeThumb) && !fullres)
return null;
if (File.Exists(fileItem.InfoFile))
fileItem.LoadInfo();
if (fileItem.FileInfo == null)
fileItem.FileInfo = new FileInfo();
try
{
BitmapDecoder bmpDec = null;
if (fullres && fileItem.IsRaw)
{
try
{
string dcraw_exe = Path.Combine(Settings.ApplicationFolder, "dcraw.exe");
if (File.Exists(dcraw_exe))
{
string thumb = Path.Combine(Path.GetTempPath(),
Path.GetFileNameWithoutExtension(fileItem.FileName) + ".thumb.jpg");
PhotoUtils.RunAndWait(dcraw_exe,
string.Format(" -e -O \"{0}\" \"{1}\"", thumb, fileItem.FileName));
if (File.Exists(thumb))
{
bmpDec = BitmapDecoder.Create(new Uri(thumb), BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
File.Delete(thumb);
}
}
}
catch (Exception exception)
{
Log.Error("Error get dcraw thumb", exception);
}
}
PhotoUtils.WaitForFile(fullres ? fileItem.FileName : fileItem.LargeThumb);
if (bmpDec == null)
bmpDec = BitmapDecoder.Create(new Uri(fullres ? fileItem.FileName : fileItem.LargeThumb),
BitmapCreateOptions.None,
BitmapCacheOption.OnLoad);
// if no future processing required
if (!showfocuspoints && ServiceProvider.Settings.RotateIndex == 0 && !ServiceProvider.Settings.FlipPreview)
{
fileItem.Loading = false;
var b = new WriteableBitmap(bmpDec.Frames[0]);
b.Freeze();
return b;
}
var bitmap = BitmapFactory.ConvertToPbgra32Format(bmpDec.Frames[0]);
if (showfocuspoints && !fileItem.Transformed)
DrawFocusPoints(fileItem, bitmap);
if (ServiceProvider.Settings.RotateIndex != 0)
{
switch (ServiceProvider.Settings.RotateIndex)
{
case 1:
bitmap = bitmap.Rotate(90);
break;
case 2:
bitmap = bitmap.Rotate(180);
break;
case 3:
bitmap = bitmap.Rotate(270);
break;
}
}
if (ServiceProvider.Settings.FlipPreview)
{
bitmap = bitmap.Flip(WriteableBitmapExtensions.FlipMode.Vertical);
}
bitmap.Freeze();
return bitmap;
}
catch (Exception exception)
{
Log.Error("Error loading image", exception);
if (exception.GetType() == typeof(OutOfMemoryException) && fullres)
{
return LoadImage(fileItem, false);
}
}
return null;
}
示例3: LoadImage
public WriteableBitmap LoadImage(FileItem fileItem, bool fullres)
{
if (ServiceProvider.Settings.LowMemoryUsage)
fullres = false;
if (fileItem == null)
return null;
if (!File.Exists(fileItem.LargeThumb) && !fullres)
return null;
if (File.Exists(fileItem.InfoFile))
fileItem.LoadInfo();
else
fileItem.FileInfo = new FileInfo();
try
{
BitmapDecoder bmpDec = null;
if (fullres && fileItem.IsRaw)
{
try
{
string dcraw_exe = Path.Combine(Settings.ApplicationFolder, "dcraw.exe");
if (File.Exists(dcraw_exe))
{
PhotoUtils.RunAndWait(dcraw_exe, string.Format(" -e {0}", fileItem.FileName));
string thumb = Path.Combine(Path.GetDirectoryName(fileItem.FileName),
Path.GetFileNameWithoutExtension(fileItem.FileName) + ".thumb.jpg");
if (File.Exists(thumb))
{
bmpDec = BitmapDecoder.Create(new Uri(thumb),BitmapCreateOptions.None,BitmapCacheOption.OnLoad);
File.Delete(thumb);
}
}
}
catch (Exception exception)
{
Log.Error("Error get dcraw thumb", exception);
}
}
if (bmpDec == null)
bmpDec = BitmapDecoder.Create(new Uri(fullres ? fileItem.FileName : fileItem.LargeThumb),
BitmapCreateOptions.None,
BitmapCacheOption.OnLoad);
double dw = (double) MaxThumbSize/bmpDec.Frames[0].PixelWidth;
WriteableBitmap bitmap;
if (fullres)
bitmap =
BitmapFactory.ConvertToPbgra32Format(GetBitmapFrame(bmpDec.Frames[0],
(int) (bmpDec.Frames[0].PixelWidth*dw),
(int) (bmpDec.Frames[0].PixelHeight*dw),
BitmapScalingMode.NearestNeighbor));
else
bitmap = BitmapFactory.ConvertToPbgra32Format(bmpDec.Frames[0]);
if (ServiceProvider.Settings.ShowFocusPoints)
DrawFocusPoints(fileItem, bitmap);
if (fileItem.FileInfo !=null && fileItem.FileInfo.ExifTags.ContainName("Exif.Image.Orientation") )
{
if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "bottom, right")
bitmap = bitmap.Rotate(180);
//if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "top, left")
// bitmap = bitmap.Rotate(180);
if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "right, top")
bitmap = bitmap.Rotate(90);
if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "left, bottom")
bitmap = bitmap.Rotate(270);
}
if (ServiceProvider.Settings.RotateIndex != 0)
{
switch (ServiceProvider.Settings.RotateIndex)
{
case 1:
bitmap = bitmap.Rotate(90);
break;
case 2:
bitmap = bitmap.Rotate(180);
break;
case 3:
bitmap = bitmap.Rotate(270);
break;
}
}
bitmap.Freeze();
return bitmap;
}
catch (Exception exception)
{
Log.Error("Error loading image", exception);
}
return null;
}
示例4: LoadImage
public WriteableBitmap LoadImage(FileItem fileItem, bool fullres, bool showfocuspoints)
{
int rotation = 0;
if (fileItem == null)
return null;
if (!File.Exists(fileItem.LargeThumb) && !fullres)
return null;
if (File.Exists(fileItem.InfoFile))
fileItem.LoadInfo();
else
fileItem.FileInfo = new FileInfo();
try
{
BitmapDecoder bmpDec = null;
if (fullres && fileItem.IsRaw)
{
try
{
string dcraw_exe = Path.Combine(Settings.ApplicationFolder, "dcraw.exe");
if (File.Exists(dcraw_exe))
{
PhotoUtils.RunAndWait(dcraw_exe, string.Format(" -e \"{0}\"", fileItem.FileName));
string thumb = Path.Combine(Path.GetDirectoryName(fileItem.FileName),
Path.GetFileNameWithoutExtension(fileItem.FileName) + ".thumb.jpg");
if (File.Exists(thumb))
{
bmpDec = BitmapDecoder.Create(new Uri(thumb),BitmapCreateOptions.None,BitmapCacheOption.OnLoad);
File.Delete(thumb);
}
}
}
catch (Exception exception)
{
Log.Error("Error get dcraw thumb", exception);
}
}
if (ServiceProvider.Settings.Autorotate && fileItem.FileInfo != null && fileItem.FileInfo.ExifTags.ContainName("Exif.Image.Orientation"))
{
if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "bottom, right")
rotation = 180;
//if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "top, left")
// bitmap = bitmap.Rotate(180);
if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "right, top")
rotation = 90;
if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "left, bottom")
rotation = 270;
}
if (bmpDec == null)
bmpDec = BitmapDecoder.Create(new Uri(fullres ? fileItem.FileName : fileItem.LargeThumb),
BitmapCreateOptions.None,
BitmapCacheOption.OnLoad);
// if no future processing required
if (rotation == 0 && !showfocuspoints && ServiceProvider.Settings.RotateIndex == 0 && ServiceProvider.Settings.FlipPreview)
{
return new WriteableBitmap(bmpDec.Frames[0]);
}
var bitmap = BitmapFactory.ConvertToPbgra32Format(bmpDec.Frames[0]);
if (showfocuspoints)
DrawFocusPoints(fileItem, bitmap);
if (rotation != 0)
bitmap = bitmap.Rotate(rotation);
if (ServiceProvider.Settings.RotateIndex != 0)
{
switch (ServiceProvider.Settings.RotateIndex)
{
case 1:
bitmap = bitmap.Rotate(90);
break;
case 2:
bitmap = bitmap.Rotate(180);
break;
case 3:
bitmap = bitmap.Rotate(270);
break;
}
}
if (ServiceProvider.Settings.FlipPreview)
{
bitmap = bitmap.Flip(WriteableBitmapExtensions.FlipMode.Vertical);
}
bitmap.Freeze();
return bitmap;
}
catch (Exception exception)
{
Log.Error("Error loading image", exception);
//.........这里部分代码省略.........
示例5: LoadImage
public WriteableBitmap LoadImage(FileItem fileItem, bool fullres)
{
if (ServiceProvider.Settings.LowMemoryUsage)
fullres = false;
if (fileItem == null)
return null;
if (!File.Exists(fileItem.LargeThumb) && !fullres)
return null;
if (File.Exists(fileItem.InfoFile))
fileItem.LoadInfo();
else
fileItem.FileInfo = new FileInfo();
try
{
BitmapDecoder bmpDec = BitmapDecoder.Create(new Uri(fullres ? fileItem.FileName : fileItem.LargeThumb),
BitmapCreateOptions.None,
BitmapCacheOption.OnLoad);
double dw = (double)MaxThumbSize / bmpDec.Frames[0].PixelWidth;
WriteableBitmap bitmap;
if(fullres)
bitmap =
BitmapFactory.ConvertToPbgra32Format(GetBitmapFrame(bmpDec.Frames[0],
(int)(bmpDec.Frames[0].PixelWidth * dw),
(int)(bmpDec.Frames[0].PixelHeight * dw),
BitmapScalingMode.NearestNeighbor));
else
bitmap = BitmapFactory.ConvertToPbgra32Format(bmpDec.Frames[0]);
if (ServiceProvider.Settings.ShowFocusPoints)
DrawFocusPoints(fileItem, bitmap);
if (fileItem.FileInfo.ExifTags.ContainName("Exif.Image.Orientation") && !fileItem.IsRaw)
{
if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "bottom, right")
bitmap = bitmap.Rotate(180);
//if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "top, left")
// bitmap = bitmap.Rotate(180);
if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "right, top")
bitmap = bitmap.Rotate(90);
if (fileItem.FileInfo.ExifTags["Exif.Image.Orientation"] == "left, bottom")
bitmap = bitmap.Rotate(270);
}
if (ServiceProvider.Settings.RotateIndex != 0)
{
switch (ServiceProvider.Settings.RotateIndex)
{
case 1:
bitmap = bitmap.Rotate(90);
break;
case 2:
bitmap = bitmap.Rotate(180);
break;
case 3:
bitmap = bitmap.Rotate(270);
break;
}
}
bitmap.Freeze();
return bitmap;
}
catch (Exception exception)
{
Log.Error("Error loading image", exception);
}
return null;
}