2 using System.Collections.Generic;
\r
4 using System.Diagnostics;
\r
8 public class CPreviewMagnifier
\r
10 #region [ プロパティ(拡大率等の取得) ]
\r
29 /// プレビュー画像向けの拡大率か(それとも、演奏画面向けの拡大率か)
\r
31 public bool bIsPreview;
\r
35 // 配列の0,1要素はそれぞれ, Preview用, 演奏画面用
\r
36 private int[] WIDTH_VGA_SET = { 204, 278 }; // VGA版DTXManiaのプレビュー画像width値
\r
37 private int[] HEIGHT_VGA_SET = { 269, 355 }; // VGA版DTXManiaのプレビュー画像height値
\r
38 private int[] WIDTH_HD_SET = { 400, 400 }; // HD版DTXManiaのプレビュー画像width値
\r
39 private int[] HEIGHT_HD_SET = { 400, 600 }; // 600は仮 // HD版DTXManiaのプレビュー画像height値
\r
40 private int[] WIDTH_FHD_LIMIT = { 320, 320 }; // VGA版/FullHD版どちらのプレビュー画像とみなすかのwidth閾値
\r
41 private int[] HEIGHT_FHD_LIMIT = { 416, 416 }; // VGA版/FullHD版どちらのプレビュー画像とみなすかのwidth閾値
\r
42 private int[] WIDTH_FHD_SET = { (int) ( 204 * Scale.X ), (int) ( 278 * Scale.X ) }; // FHD版DTXManiaのプレビュー画像height値
\r
43 private int[] HEIGHT_FHD_SET = { (int) ( 269 * Scale.Y ), (int) ( 355 * Scale.Y ) }; // FHD版DTXManiaのプレビュー画像height値
\r
50 public CPreviewMagnifier()
\r
58 /// <param name="width_org">元の幅</param>
\r
59 /// <param name="height_org">元の高さ</param>
\r
60 /// <param name="magX_org">元の拡大率(幅)</param>
\r
61 /// <param name="magY_org">元の拡大率(高さ)</param>
\r
62 /// <param name="bIsPreview">選曲画面(preview)用か、演奏画面用か</param>
\r
63 /// <remarks>出力はプロパティで得てください。</remarks>
\r
64 public void GetMagnifier( int width_org, int height_org, float magX_org, float magY_org, bool bIsPreview)
\r
66 this.bIsPreview = bIsPreview;
\r
68 // #35820 画像サイズに関係なく、プレビュー領域に合わせる add ikanick 15.12.08
\r
69 this.width = width_fhd_set;
\r
70 this.height = height_fhd_set;
\r
71 this.magX = magX_org * width_vga_set / width_org * Scale.X;
\r
72 this.magY = magY_org * height_vga_set / height_org * Scale.Y;
\r
75 #if false // FHD対応の名残
\r
76 #region [ HD版DTXManiaのプレビュー画像は特別扱いする ]
\r
77 if ( width_org == width_hd_set && height_org == height_hd_set ) // HD版DTXManiaのプレビュー画像は特別扱いする
\r
79 this.width = width_org;
\r
80 this.height = height_org;
\r
81 this.magX = 1.5f * magX_org;
\r
82 this.magY = 1.5f * magY_org;
\r
88 if ( width_org <= width_vga_set ) // width <= 204 なら、拡大率だけ変更
\r
90 this.width = width_org;
\r
91 this.magX = magX_org * Scale.X;
\r
93 else if ( width_fhd_limit > width_org && width_org > width_vga_set ) // width >= 320 なら原寸表示
\r
95 this.width = width_vga_set;
\r
96 this.magX = magX_org * Scale.X;
\r
98 else if ( width_org >= width_fhd_limit )
\r
100 this.width = (int) ( width_vga_set * Scale.X );
\r
101 this.magX = magX_org; // / width_hd_set;
\r
105 this.width = width_org;
\r
106 this.magX = magX_org * Scale.X;
\r
111 if ( height_org <= height_vga_set ) // height <= 269 なら、拡大率だけ変更
\r
113 this.height = height_org;
\r
114 this.magY = magY_org * Scale.Y;
\r
116 else if ( height_fhd_limit > height_org && height_org > height_vga_set ) // height >= 416 なら原寸表示
\r
118 this.height = height_vga_set;
\r
119 this.magY = magY_org * Scale.Y;
\r
121 else if ( width_org >= height_fhd_limit )
\r
123 this.height = (int) ( height_vga_set * Scale.Y );
\r
124 this.magY = magY_org; // / height_fhd_set;
\r
128 this.height = height_org;
\r
129 this.magY = magY_org * Scale.Y;
\r
135 #region [ bIsPreviewによる配列→定数読み替え ]
\r
136 private int width_vga_set
\r
140 return bIsPreview? WIDTH_VGA_SET[ 0 ] : WIDTH_VGA_SET[ 1 ];
\r
143 private int height_vga_set
\r
147 return bIsPreview? HEIGHT_VGA_SET[ 0 ] : HEIGHT_VGA_SET[ 1 ];
\r
150 private int width_hd_set
\r
154 return bIsPreview? WIDTH_HD_SET[ 0 ] : WIDTH_HD_SET[1];
\r
157 private int height_hd_set
\r
161 return bIsPreview? HEIGHT_HD_SET[ 0 ] : HEIGHT_HD_SET[ 1 ];
\r
164 private int width_fhd_limit
\r
168 return bIsPreview? WIDTH_FHD_LIMIT[ 0 ] : WIDTH_FHD_LIMIT[ 1 ];
\r
171 private int height_fhd_limit
\r
175 return bIsPreview? HEIGHT_FHD_LIMIT[ 0 ] : HEIGHT_FHD_LIMIT[ 1 ];
\r
178 private int width_fhd_set
\r
182 return bIsPreview ? WIDTH_FHD_SET[ 0 ] : WIDTH_FHD_SET[ 1 ];
\r
185 private int height_fhd_set
\r
189 return bIsPreview ? HEIGHT_FHD_SET[ 0 ] : HEIGHT_FHD_SET[ 1 ];
\r