2 using System.Collections.Generic;
4 using System.Diagnostics;
8 public class CPreviewMagnifier
11 #region [ プロパティ(拡大率等の取得) ]
32 private int freestyle_w, freestyle_h;
35 /// プレビュー画像向けの拡大率か(それとも、演奏画面向けの拡大率か)
37 public enum EPreviewType : int
39 MusicSelect = 0, // 選曲画面
40 PlayingFront = 1, // 演奏画面(ウインドウ表示の動画,サイズ固定(従来方式)
41 PlayingBackground = 2, // 演奏画面(背景全画面表示の動画)
42 PlayingFrontScalable = 3 // 演奏画面(ウインドウ表示の動画,サイズ可変
44 public EPreviewType ePreviewType;
48 // 配列の0,1要素はそれぞれ, Preview用, 演奏画面用
49 private int[] WIDTH_VGA_SET = { 204, 278, 640 }; // VGA版DTXManiaのプレビュー画像width値
50 private int[] HEIGHT_VGA_SET = { 269, 355, 1920 }; // VGA版DTXManiaのプレビュー画像height値
51 private int[] WIDTH_HD_SET = { 400, 400, 1920 }; // HD版DTXManiaのプレビュー画像width値
52 private int[] HEIGHT_HD_SET = { 400, 600, 1080 }; // 600は仮 // HD版DTXManiaのプレビュー画像height値
53 private int[] WIDTH_FHD_LIMIT = { 320, 320, 640 }; // VGA版/FullHD版どちらのプレビュー画像とみなすかのwidth閾値
54 private int[] HEIGHT_FHD_LIMIT = { 416, 416, 480 }; // VGA版/FullHD版どちらのプレビュー画像とみなすかのwidth閾値
55 private int[] WIDTH_FHD_SET = { (int)(204 * Scale.X), (int)(278 * 2), 1920 }; // FHD版DTXManiaのプレビュー画像height値
56 private int[] HEIGHT_FHD_SET = { (int)(269 * Scale.Y), (int)(355 * 2), 1080 }; // FHD版DTXManiaのプレビュー画像height値
57 // #37227 2017.5.29 yyagi 105以降の新演奏画面では、BGA/AVI領域の縦横倍率はx2
65 public CPreviewMagnifier()
68 public CPreviewMagnifier(EPreviewType _ePreviewType)
70 CPreviewMagnifier_initializer(_ePreviewType, 0, 0, 1, 1);
72 public CPreviewMagnifier( EPreviewType _ePreviewType, int _px, int _py )
74 CPreviewMagnifier_initializer( _ePreviewType, _px, _py, 1, 1 );
76 public CPreviewMagnifier(EPreviewType _ePreviewType, int _px, int _py, int _w, int _h)
78 CPreviewMagnifier_initializer(_ePreviewType, _px, _py, _w, _h);
80 private void CPreviewMagnifier_initializer(EPreviewType _ePreviewType, int _px, int _py, int _w, int _h)
82 this.ePreviewType = _ePreviewType;
85 this.freestyle_w = _w;
86 this.freestyle_h = _h;
93 /// <param name="width_org">元の幅</param>
94 /// <param name="height_org">元の高さ</param>
95 /// <param name="magX_org">元の拡大率(幅)</param>
96 /// <param name="magY_org">元の拡大率(高さ)</param>
97 /// <remarks>出力はプロパティで得てください。</remarks>
98 public void GetMagnifier(int width_org, int height_org, float magX_org, float magY_org)
100 //bool bIsPreview = ( this.ePreviewType == EPreviewType.MusicSelect );
102 // #35820 画像サイズに関係なく、プレビュー領域に合わせる add ikanick 15.12.08
103 // #36176 プレビュー画像については、前仕様(204x269)画像はアスペクト比を維持する change ikanick 16.03.20
105 if ( this.ePreviewType == EPreviewType.PlayingBackground ) // フル背景動画に限り、上位指定の表示座標を無視する
107 this.px = this.py = 0;
110 #region [ アスペクト比を維持した拡大縮小 ]
111 this.width = width_org;
112 this.height = height_org;
113 int W = (this.ePreviewType == EPreviewType.PlayingFrontScalable)? freestyle_w : width_fhd_set;
114 int H = (this.ePreviewType == EPreviewType.PlayingFrontScalable)? freestyle_h : height_fhd_set;
115 this.magX = magX_org * W / width_org;
116 this.magY = magY_org * H / height_org;
121 px += (int) ( ( W - ( width_org * magY ) ) / 2 );
126 py += (int) ( ( H - ( height_org * magX ) ) / 2 );
131 #region [ bIsPreviewによる配列→定数読み替え ]
132 private int width_vga_set
136 return WIDTH_VGA_SET[ (int)ePreviewType ];
139 private int height_vga_set
143 return HEIGHT_VGA_SET[ (int)ePreviewType ];
146 private int width_hd_set
150 return WIDTH_HD_SET[ (int)ePreviewType ];
153 private int height_hd_set
157 return HEIGHT_HD_SET[ (int)ePreviewType ];
160 private int width_fhd_limit
164 return WIDTH_FHD_LIMIT[ (int)ePreviewType ];
167 private int height_fhd_limit
171 return HEIGHT_FHD_LIMIT[ (int)ePreviewType ];
174 private int width_fhd_set
178 return WIDTH_FHD_SET[ (int)ePreviewType ];
181 private int height_fhd_set
185 return HEIGHT_FHD_SET[ (int)ePreviewType ];