2 using System.Collections.Generic;
4 using System.Diagnostics;
8 public class CPreviewMagnifier
11 #region [ プロパティ(拡大率等の取得) ]
33 /// プレビュー画像向けの拡大率か(それとも、演奏画面向けの拡大率か)
35 public enum EPreviewType : int
37 MusicSelect = 0, // 選曲画面
38 PlayingFront = 1, // 演奏画面(ウインドウ表示の動画)
39 PlayingBackground = 2 // 演奏画面(背景全画面表示の動画)
41 public EPreviewType ePreviewType;
45 // 配列の0,1要素はそれぞれ, Preview用, 演奏画面用
46 private int[] WIDTH_VGA_SET = { 204, 278, 640 }; // VGA版DTXManiaのプレビュー画像width値
47 private int[] HEIGHT_VGA_SET = { 269, 355, 1920 }; // VGA版DTXManiaのプレビュー画像height値
48 private int[] WIDTH_HD_SET = { 400, 400, 1920 }; // HD版DTXManiaのプレビュー画像width値
49 private int[] HEIGHT_HD_SET = { 400, 600, 1080 }; // 600は仮 // HD版DTXManiaのプレビュー画像height値
50 private int[] WIDTH_FHD_LIMIT = { 320, 320, 640 }; // VGA版/FullHD版どちらのプレビュー画像とみなすかのwidth閾値
51 private int[] HEIGHT_FHD_LIMIT = { 416, 416, 480 }; // VGA版/FullHD版どちらのプレビュー画像とみなすかのwidth閾値
52 private int[] WIDTH_FHD_SET = { (int)(204 * Scale.X), (int)(278 * 2), 1920 }; // FHD版DTXManiaのプレビュー画像height値
53 private int[] HEIGHT_FHD_SET = { (int)(269 * Scale.Y), (int)(355 * 2), 1080 }; // FHD版DTXManiaのプレビュー画像height値
54 // #37227 2017.5.29 yyagi 105以降の新演奏画面では、BGA/AVI領域の縦横倍率はx2
62 public CPreviewMagnifier()
65 public CPreviewMagnifier(EPreviewType _ePreviewType)
67 CPreviewMagnifier_initializer(_ePreviewType, 0, 0);
69 public CPreviewMagnifier( EPreviewType _ePreviewType, int _px, int _py )
71 CPreviewMagnifier_initializer( _ePreviewType, _px, _py );
73 private void CPreviewMagnifier_initializer( EPreviewType _ePreviewType, int _px, int _py)
75 this.ePreviewType = _ePreviewType;
84 /// <param name="width_org">元の幅</param>
85 /// <param name="height_org">元の高さ</param>
86 /// <param name="magX_org">元の拡大率(幅)</param>
87 /// <param name="magY_org">元の拡大率(高さ)</param>
88 /// <remarks>出力はプロパティで得てください。</remarks>
89 public void GetMagnifier(int width_org, int height_org, float magX_org, float magY_org)
91 //bool bIsPreview = ( this.ePreviewType == EPreviewType.MusicSelect );
93 // #35820 画像サイズに関係なく、プレビュー領域に合わせる add ikanick 15.12.08
94 // #36176 プレビュー画像については、前仕様(204x269)画像はアスペクト比を維持する change ikanick 16.03.20
96 if ( this.ePreviewType == EPreviewType.PlayingBackground ) // フル背景動画に限り、上位指定の表示座標を無視する
98 this.px = this.py = 0;
101 #region [ アスペクト比を維持した拡大縮小 ]
102 this.width = width_org;
103 this.height = height_org;
104 this.magX = magX_org * width_fhd_set / width_org;
105 this.magY = magY_org * height_fhd_set / height_org;
110 px += (int) ( ( width_fhd_set - ( width_org * magY ) ) / 2 );
115 py += (int) ( ( height_fhd_set - ( height_org * magX ) ) / 2 );
120 #region [ bIsPreviewによる配列→定数読み替え ]
121 private int width_vga_set
125 return WIDTH_VGA_SET[ (int)ePreviewType ];
128 private int height_vga_set
132 return HEIGHT_VGA_SET[ (int)ePreviewType ];
135 private int width_hd_set
139 return WIDTH_HD_SET[ (int)ePreviewType ];
142 private int height_hd_set
146 return HEIGHT_HD_SET[ (int)ePreviewType ];
149 private int width_fhd_limit
153 return WIDTH_FHD_LIMIT[ (int)ePreviewType ];
156 private int height_fhd_limit
160 return HEIGHT_FHD_LIMIT[ (int)ePreviewType ];
163 private int width_fhd_set
167 return WIDTH_FHD_SET[ (int)ePreviewType ];
170 private int height_fhd_set
174 return HEIGHT_FHD_SET[ (int)ePreviewType ];