특수 조건
=> 화면에 보여지는 이미지 파일을 삭제 하고자 할 경우 : BitmapCacheOption.OnLoad 값으로 설정 해야 삭제 가능( 로드 시 전체 이미지를 메모리로 캐시합니다.이미지 데이터에 대한 모든 요청은 메모리 저장소에서 채워집니다.)
// Image Option 1 : 35 msec
public void Test1()
{
Stopwatch sw = new Stopwatch(); sw.Start();
BitmapImage img = new BitmapImage(new Uri(@"d:/a.jpg"));
this.xImage.Source = img;
sw.Stop();
System.Diagnostics.Debug.WriteLine("Test1 : " + sw.Elapsed.TotalMilliseconds + " msec");
}
// Image Option 2 : 1125 msec
public void Test2()
{
Stopwatch sw = new Stopwatch(); sw.Start();
BitmapImage img = new BitmapImage();
img.BeginInit();
img.CacheOption = BitmapCacheOption.OnLoad;
img.UriSource = new Uri(@"d:/a.jpg");
img.EndInit();
this.xImage.Source = img;
sw.Stop();
System.Diagnostics.Debug.WriteLine("Test2 : " + sw.Elapsed.TotalMilliseconds + " msec");
}
// Image Option 3 : 394 msec
public void Test3()
{
Stopwatch sw = new Stopwatch(); sw.Start();
BitmapImage img = new BitmapImage();
img.BeginInit();
img.CacheOption = BitmapCacheOption.OnLoad;
img.DecodePixelWidth = 300;
img.UriSource = new Uri(@"d:/a.jpg");
img.EndInit();
this.xImage.Source = img;
sw.Stop();
System.Diagnostics.Debug.WriteLine("Test3 : " + sw.Elapsed.TotalMilliseconds + " msec");
}
// Image Option 4 : 0.17 msec
public void Test4()
{
Stopwatch sw = new Stopwatch(); sw.Start();
BitmapImage img = new BitmapImage();
img.BeginInit();
img.CacheOption = BitmapCacheOption.OnDemand;
img.CreateOptions = BitmapCreateOptions.DelayCreation;
img.DecodePixelWidth = 300;
img.UriSource = new Uri(@"d:/a.jpg");
img.EndInit();
this.xImage.Source = img;
sw.Stop();
System.Diagnostics.Debug.WriteLine("Test4 : " + sw.Elapsed.TotalMilliseconds + " msec");
}
// Image Option 5 : 0.18 msec
public void Test5()
{
Stopwatch sw = new Stopwatch(); sw.Start();
BitmapImage img = new BitmapImage();
img.BeginInit();
img.CacheOption = BitmapCacheOption.OnLoad;
img.CreateOptions = BitmapCreateOptions.DelayCreation;
img.DecodePixelWidth = 300;
img.UriSource = new Uri(@"d:/a.jpg");
img.EndInit();
this.xImage.Source = img;
sw.Stop();
System.Diagnostics.Debug.WriteLine("Test5 : " + sw.Elapsed.TotalMilliseconds + " msec");
}
- 대표 전화 : 02) 2061 - 0753 - Fax : 02) 2061 - 0759 - Skype : devzone24
- 주소 : 서울특별시 양천구 목1동 923-14. 현대드림타워 1024호
- 기술 문의: 02) 2061-1259 김민석 기술이사
댓글 없음:
댓글 쓰기