개정판 09b40aad
decodeImage 수정
Change-Id: Iea9964f77b6759bf4a7b9befce60dafe4a4f7732
KCOM/Controls/DecodeImage.cs | ||
---|---|---|
11 | 11 |
|
12 | 12 |
namespace KCOM.Controls |
13 | 13 |
{ |
14 |
[TemplatePart(Name = PART_IMAGE, Type = typeof(Image))] |
|
14 |
// [TemplatePart(Name = PART_IMAGE, Type = typeof(Image))]
|
|
15 | 15 |
public class ScaleDecodeImage : System.Windows.Controls.Control |
16 | 16 |
{ |
17 |
private const string PART_IMAGE = "PART_IMAGE"; |
|
18 |
|
|
19 |
private Image ImageControl; |
|
17 |
// private const string PART_IMAGE = "PART_IMAGE"; |
|
18 |
//private Image ImageControl; |
|
20 | 19 |
|
21 | 20 |
public override void OnApplyTemplate() |
22 | 21 |
{ |
23 | 22 |
base.OnApplyTemplate(); |
24 | 23 |
|
25 |
ImageControl = GetTemplateChild(PART_IMAGE) as Image; |
|
24 |
//ImageControl = GetTemplateChild(PART_IMAGE) as Image;
|
|
26 | 25 |
} |
27 | 26 |
|
28 | 27 |
|
28 |
public static readonly DependencyProperty ViewSourceProperty = DependencyProperty.Register( |
|
29 |
"ViewSource", typeof(BitmapImage), typeof(ScaleDecodeImage)); |
|
30 |
|
|
31 |
|
|
32 |
public BitmapImage ViewSource |
|
33 |
{ |
|
34 |
get => (BitmapImage)GetValue(ViewSourceProperty); |
|
35 |
set => SetValue(ViewSourceProperty, value); |
|
36 |
} |
|
37 |
|
|
29 | 38 |
public static readonly DependencyProperty SourceProperty = DependencyProperty.Register( |
30 |
"Source", typeof(BitmapImage), typeof(ScaleDecodeImage),new PropertyMetadata(new PropertyChangedCallback(SourcePropertyChaged))); |
|
39 |
"Source", typeof(BitmapImage), typeof(ScaleDecodeImage), new PropertyMetadata(new PropertyChangedCallback(SourcePropertyChaged)));
|
|
31 | 40 |
|
32 | 41 |
|
33 | 42 |
public BitmapImage Source |
... | ... | |
40 | 49 |
{ |
41 | 50 |
var owner = d as ScaleDecodeImage; |
42 | 51 |
|
43 |
if(owner != null) |
|
52 |
if (owner != null)
|
|
44 | 53 |
{ |
45 |
owner.Scale = 1.0; |
|
54 |
if (e.NewValue != null) |
|
55 |
{ |
|
56 |
owner.ViewSource = (BitmapImage)e.NewValue; |
|
57 |
owner.Scale = 1.0; |
|
58 |
} |
|
46 | 59 |
} |
47 | 60 |
} |
48 | 61 |
|
49 | 62 |
public static readonly DependencyProperty ScaleProperty = DependencyProperty.Register( |
50 |
"Scale", typeof(double), typeof(ScaleDecodeImage), new PropertyMetadata(0.0,new PropertyChangedCallback(ScalePropertyChaged))); |
|
63 |
"Scale", typeof(double), typeof(ScaleDecodeImage), new PropertyMetadata(0.0, new PropertyChangedCallback(ScalePropertyChaged)));
|
|
51 | 64 |
|
52 | 65 |
|
53 | 66 |
public double Scale |
... | ... | |
56 | 69 |
set => SetValue(ScaleProperty, value); |
57 | 70 |
} |
58 | 71 |
|
59 |
private static async void ScalePropertyChaged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
72 |
private static void ScalePropertyChaged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
|
60 | 73 |
{ |
61 | 74 |
var owner = d as ScaleDecodeImage; |
62 | 75 |
|
63 | 76 |
if (owner != null) |
64 | 77 |
{ |
65 |
if(owner.ImageControl != null) |
|
66 |
{ |
|
67 |
var value = owner.Scale; |
|
68 |
System.Windows.Media.Imaging.BitmapImage image = owner.Source.Clone(); |
|
78 |
var value = owner.Scale; |
|
79 |
System.Windows.Media.Imaging.BitmapImage image = owner.Source.Clone(); |
|
69 | 80 |
|
70 |
image.DecodePixelWidth = (int)(image.PixelWidth * value);
|
|
71 |
image.DecodePixelHeight = (int)(image.PixelHeight * value);
|
|
81 |
image.DecodePixelWidth = (int)(image.PixelWidth * value); |
|
82 |
image.DecodePixelHeight = (int)(image.PixelHeight * value); |
|
72 | 83 |
|
73 |
await owner.Dispatcher.InvokeAsync(() => { owner.ImageControl.Source = image; }); |
|
74 |
|
|
75 |
} |
|
84 |
owner.ViewSource = image; |
|
76 | 85 |
} |
77 | 86 |
} |
78 | 87 |
} |
KCOM/KCOM.csproj.user | ||
---|---|---|
16 | 16 |
<StartArguments>eyJEb2N1bWVudEl0ZW1JRCI6IjQwMDAwMTQyIiwiYlBhcnRuZXIiOmZhbHNlLCJDcmVhdGVGaW5hbFBERlBlcm1pc3Npb24iOmZhbHNlLCJOZXdDb21tZW50UGVybWlzc2lvbiI6dHJ1ZSwiUHJvamVjdE5PIjoiMDAwMDAwIiwiVXNlcklEIjoiZG9mdGVjaCIsIk1vZGUiOjB9</StartArguments> |
17 | 17 |
</PropertyGroup> |
18 | 18 |
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> |
19 |
<StartArguments>eyJEb2N1bWVudEl0ZW1JRCI6IjQwMDAwMTQyIiwiYlBhcnRuZXIiOmZhbHNlLCJDcmVhdGVGaW5hbFBERlBlcm1pc3Npb24iOmZhbHNlLCJOZXdDb21tZW50UGVybWlzc2lvbiI6dHJ1ZSwiUHJvamVjdE5PIjoiMDAwMDAwIiwiVXNlcklEIjoiZG9mdGVjaCIsIk1vZGUiOjB9</StartArguments>
|
|
19 |
<StartArguments>eyJEb2N1bWVudEl0ZW1JRCI6IjQwMDAwMTQwIiwiYlBhcnRuZXIiOmZhbHNlLCJDcmVhdGVGaW5hbFBERlBlcm1pc3Npb24iOnRydWUsIk5ld0NvbW1lbnRQZXJtaXNzaW9uIjp0cnVlLCJQcm9qZWN0Tk8iOiIwMDAwMDAiLCJVc2VySUQiOiJIMjAxMTM1NyIsIk1vZGUiOjB9</StartArguments>
|
|
20 | 20 |
<StartAction>Project</StartAction> |
21 | 21 |
<StartProgram>C:\Program Files\DOFTECH\MARKUS\KCOM.exe</StartProgram> |
22 | 22 |
</PropertyGroup> |
KCOM/Resources/DecodeImageTemplate.xaml | ||
---|---|---|
5 | 5 |
<Setter Property="Template"> |
6 | 6 |
<Setter.Value> |
7 | 7 |
<ControlTemplate TargetType="local:ScaleDecodeImage"> |
8 |
<Image x:Name="PART_IMAGE" Stretch="Fill" RenderOptions.BitmapScalingMode="HighQuality" RenderOptions.EdgeMode="Unspecified" RenderOptions.ClearTypeHint="Enabled"/> |
|
8 |
<Image x:Name="PART_IMAGE" Stretch="Fill" Source="{TemplateBinding ViewSource}" RenderOptions.BitmapScalingMode="HighQuality" RenderOptions.EdgeMode="Unspecified" RenderOptions.ClearTypeHint="Enabled"/>
|
|
9 | 9 |
</ControlTemplate> |
10 | 10 |
</Setter.Value> |
11 | 11 |
</Setter> |
KCOM/Views/MainMenu.xaml.cs | ||
---|---|---|
557 | 557 |
#region 페이지 이미지 로딩 수정 |
558 | 558 |
|
559 | 559 |
// ViewerDataModel.Instance.ImageViewPath = await ImageSourceHelper.GetDownloadImageAsync(pageUri, pageWidth * contentScale, pageHeight * contentScale); |
560 |
ViewerDataModel.Instance.ImageViewPath = await ImageSourceHelper.GetDownloadImageAsync(pageUri, pageWidth, pageHeight); |
|
560 |
|
|
561 |
ViewerDataModel.Instance.ImageViewPath = await ImageSourceHelper.GetDownloadImageAsync(pageUri, pageWidth, pageHeight); |
|
561 | 562 |
ScaleImage(pageWidth,pageHeight); |
562 | 563 |
|
563 | 564 |
ViewerDataModel.Instance.ImageViewWidth = pageWidth; |
내보내기 Unified diff