private void OnFormLoad(object sender, EventArgs e) { GlobalWindowManager.AddWindow(this); BannerFactory.CreateBannerEx(this, m_bannerImage, Properties.Resources.B48x48_KGPG_Sign, KPRes.CreateMasterKey, m_ioInfo.GetDisplayName()); this.Icon = Properties.Resources.KeePass; this.Text = KPRes.CreateMasterKey; FontUtil.SetDefaultFont(m_cbPassword); FontUtil.AssignDefaultBold(m_cbPassword); FontUtil.AssignDefaultBold(m_cbKeyFile); FontUtil.AssignDefaultBold(m_cbUserAccount); Bitmap bmpBig = SystemIcons.Warning.ToBitmap(); m_imgAccWarning = GfxUtil.ScaleImage(bmpBig, DpiUtil.ScaleIntX(16), DpiUtil.ScaleIntY(16), ScaleTransformFlags.UIIcon); bmpBig.Dispose(); m_picAccWarning.Image = m_imgAccWarning; // m_ttRect.SetToolTip(m_cbHidePassword, KPRes.TogglePasswordAsterisks); m_ttRect.SetToolTip(m_btnSaveKeyFile, KPRes.KeyFileCreate); m_ttRect.SetToolTip(m_btnOpenKeyFile, KPRes.KeyFileUseExisting); m_ttRect.SetToolTip(m_tbRepeatPassword, KPRes.PasswordRepeatHint); if (!m_bCreatingNew) { m_lblIntro.Text = KPRes.ChangeMasterKeyIntroShort; } m_icgPassword.Attach(m_tbPassword, m_cbHidePassword, m_lblRepeatPassword, m_tbRepeatPassword, m_lblEstimatedQuality, m_pbPasswordQuality, m_lblQualityInfo, m_ttRect, this, true, false); m_cmbKeyFile.Items.Add(KPRes.NoKeyFileSpecifiedMeta); foreach (KeyProvider prov in Program.KeyProviderPool) { m_cmbKeyFile.Items.Add(prov.Name); } m_cmbKeyFile.SelectedIndex = 0; m_cbPassword.Checked = true; UIUtil.ApplyKeyUIFlags(Program.Config.UI.KeyCreationFlags, m_cbPassword, m_cbKeyFile, m_cbUserAccount, m_cbHidePassword); if (WinUtil.IsWindows9x || NativeLib.IsUnix()) { UIUtil.SetChecked(m_cbUserAccount, false); UIUtil.SetEnabled(m_cbUserAccount, false); UIUtil.SetEnabled(m_lblWindowsAccDesc, false); UIUtil.SetEnabled(m_lblWindowsAccDesc2, false); } CustomizeForScreenReader(); EnableUserControls(); // UIUtil.SetFocus(m_tbPassword, this); // See OnFormShown }
private void OnFormLoad(object sender, EventArgs e) { if (m_pd == null) { Debug.Assert(false); throw new InvalidOperationException(); } GlobalWindowManager.AddWindow(this); BannerFactory.CreateBannerEx(this, m_bannerImage, KeePass.Properties.Resources.B48x48_Binary, KPRes.XmlReplace, KPRes.XmlReplaceDesc); this.Icon = AppIcons.Default; this.Text = KPRes.XmlReplace; Bitmap bmpBig = SystemIcons.Warning.ToBitmap(); m_imgWarning = GfxUtil.ScaleImage(bmpBig, DpiUtil.ScaleIntX(16), DpiUtil.ScaleIntY(16), ScaleTransformFlags.UIIcon); bmpBig.Dispose(); m_picWarning.Image = m_imgWarning; FontUtil.AssignDefaultBold(m_rbRemove); FontUtil.AssignDefaultBold(m_rbReplace); m_rbReplace.Checked = true; m_rbInnerText.Checked = true; EnableControlsEx(); }
public override bool Initialize(IPluginHost host) { Terminate(); if (host == null) { return(false); } m_host = host; PluginTranslate.Init(this, KeePass.Program.Translation.Properties.Iso6391Code); PluginTranslate.TranslationChanged += (o, e) => { PEDCalcValue.SetTranslatedUnits(); }; Tools.DefaultCaption = PluginTranslate.PluginName; Tools.PluginURL = "https://github.com/rookiestyle/pedcalc/"; m_iconActive = GfxUtil.ScaleImage(Resources.pedcalc, DpiUtil.ScaleIntX(16), DpiUtil.ScaleIntY(16)); m_iconInactive = ToolStripRenderer.CreateDisabledImage(m_iconActive); PwEntry.EntryTouched += OnEntryTouched; GlobalWindowManager.WindowAdded += OnWindowAdded; Tools.OptionsFormShown += Tools_OptionsFormShown; PEDCValueDAO.StartLogging(); m_host.ColumnProviderPool.Add(m_cp); AddMenu(); return(true); }
protected override void OnDrawItem(DrawItemEventArgs e) { Color clrBack = e.BackColor, clrFore = e.ForeColor; if ((e.State & DrawItemState.Selected) != DrawItemState.None) { clrBack = SystemColors.Highlight; clrFore = SystemColors.HighlightText; } int nIdx = e.Index; Rectangle rectClip = e.Bounds; int dImg = rectClip.Height - 2; // Don't use RTL property of translation, as the parent (form) // may explicitly turn off the RTL mode bool bRtl = (this.RightToLeft == RightToLeft.Yes); Graphics g = e.Graphics; using (SolidBrush brBack = new SolidBrush(clrBack)) { g.FillRectangle(brBack, rectClip); } Rectangle rectImg = new Rectangle(bRtl ? (rectClip.Right - dImg - 1) : (rectClip.Left + 1), rectClip.Top + 1, dImg, dImg); if ((m_vImages != null) && (nIdx >= 0) && (nIdx < m_vImages.Count) && (m_vImages[nIdx] != null)) { GfxUtil.SetHighQuality(g); g.DrawImage(m_vImages[nIdx], rectImg); } Rectangle rectText = new Rectangle(bRtl ? (rectClip.Left + 1) : (rectClip.Left + dImg + 2 + 1), rectClip.Top + 1, rectClip.Width - dImg - 5, rectClip.Height - 2); TextFormatFlags tff = (TextFormatFlags.PreserveGraphicsClipping | TextFormatFlags.EndEllipsis | TextFormatFlags.NoPrefix | TextFormatFlags.SingleLine | TextFormatFlags.VerticalCenter); if (bRtl) { tff |= (TextFormatFlags.RightToLeft | TextFormatFlags.Right); } string strText = string.Empty; if ((nIdx >= 0) && (nIdx < this.Items.Count)) { strText = ((this.Items[nIdx] as string) ?? string.Empty); } TextRenderer.DrawText(g, strText, e.Font, rectText, clrFore, clrBack, tff); if (((e.State & DrawItemState.Focus) != DrawItemState.None) && ((e.State & DrawItemState.NoFocusRect) == DrawItemState.None)) { e.DrawFocusRectangle(); } }
void SaveScaledImage(string outputpath, int w, int h, string path = TEST_IMAGE) { try { if (!File.Exists(path)) { throw new FileNotFoundException(); } byte[] pb = File.ReadAllBytes(path); GfxUtil.SaveImage(GfxUtil.ScaleImage(GfxUtil.LoadImage(pb), w, h), outputpath); } catch (ArgumentException) { Console.WriteLine("ArgumentException"); } catch (System.Runtime.InteropServices.ExternalException) { Console.WriteLine("System.Runtime.InteropServices.ExternalException"); } catch (Exception exImg) { Console.WriteLine($"Exception {exImg.Message}"); } }
public PwCustomIcon(PwUuid pwUuid, byte[] pbImageDataPng) { Debug.Assert(pwUuid != null); if (pwUuid == null) { throw new ArgumentNullException("pwUuid"); } Debug.Assert(!pwUuid.Equals(PwUuid.Zero)); if (pwUuid.Equals(PwUuid.Zero)) { throw new ArgumentException("pwUuid == 0"); } Debug.Assert(pbImageDataPng != null); if (pbImageDataPng == null) { throw new ArgumentNullException("pbImageDataPng"); } m_pwUuid = pwUuid; m_pbImageDataPng = pbImageDataPng; #if !KeePassLibSD // MemoryStream ms = new MemoryStream(m_pbImageDataPng, false); // m_pCachedImage = Image.FromStream(ms); // ms.Close(); m_pCachedImage = GfxUtil.LoadImage(m_pbImageDataPng); #else m_pCachedImage = null; #endif }
private void UpdateData() { if (bNeedToUpdateEnable) { if (!m_bEnable) { m_TextField.SetMember("textColor", GfxUtil.ColorToUINT(m_DiableColor)); } else { m_TextField.SetMember("textColor", GfxUtil.ColorToUINT(m_Color)); } bNeedToUpdateEnable = false; } if (bNeedToUpdateString) { m_TextField.SetMember("text", m_Text); bNeedToUpdateString = false; } if (bNeedToUpdateColor) { m_TextField.SetMember("textColor", GfxUtil.ColorToUINT(m_Color)); bNeedToUpdateColor = false; } }
//-------------------------------------- // PUBLIC METHODS //-------------------------------------- /// <summary>Initializes the scene.</summary> public override void Init() { AddSystems(new LogicSystem(), new PhysicsSystem(), new CameraSystem(), mSkybox = new SkyBoxSystem(), mRenderer = new RenderingSystem()); #if DEBUG AddSystem(new DebugOverlay()); #endif base.Init(); InitCam(); // Spawn a few balls. for (var i = 0; i < 10; i++) { CreateBall(new Vector3(0.9f * i - 3.5f, 0.3f * i, 0.0f), // Position new Vector3(1.0f, 0.0f, 0.0f), // Velocity 1.0f); // Radius } mRT = GfxUtil.CreateRT(); mDistortFX = Game1.Inst.Content.Load <Effect>("Effects/Distort"); mDistortFX.Parameters["SrcTex"].SetValue(mRT); }
public void TestLoadImage() { var testData = Convert.FromBase64String(testImageData); var image = GfxUtil.LoadImage(testData); Assert.That(image.Width, Is.EqualTo(16)); Assert.That(image.Height, Is.EqualTo(16)); }
public static Image Scale(Image img, int x, int y) { if (img == null) { return(null); } return(GfxUtil.ScaleImage(img, DpiUtil.ScaleIntX(x), DpiUtil.ScaleIntY(y))); }
private void UpdateDataView() { if (m_bInitializing) { return; } string strViewer = m_tscViewers.Text; bool bText = ((strViewer == m_strViewerText) || (strViewer == m_strViewerWeb)); bool bImage = (strViewer == m_strViewerImage); UpdateVisibility(strViewer, false); m_tssSeparator0.Visible = (bText || bImage); m_tslEncoding.Visible = m_tscEncoding.Visible = bText; m_tslZoom.Visible = m_tscZoom.Visible = m_tsbZoomOut.Visible = m_tsbZoomIn.Visible = bImage; try { if (this.DvfUpdating != null) { DvfContextEventArgs args = new DvfContextEventArgs(this, m_pbData, m_strDataDesc, m_tscViewers); this.DvfUpdating(this, args); if (args.Cancel) { return; } } if (strViewer == m_strViewerHex) { UpdateHexView(); } else if (strViewer == m_strViewerText) { string strData = BinaryDataToString(true); SetRtbData(strData, (m_bdc == BinaryDataClass.RichText), false); } else if (strViewer == m_strViewerImage) { if (m_img == null) { m_img = GfxUtil.LoadImage(m_pbData); } UpdateImageView(); } else if (strViewer == m_strViewerWeb) { string strData = BinaryDataToString(false); UIUtil.SetWebBrowserDocument(m_webBrowser, strData); } } catch (Exception) { } UpdateVisibility(strViewer, true); }
/// <summary>Draws the scene by invoking the <see cref="EcsSystem.Draw"/> /// method on all systems in the scene.</summary> /// <param name="t">The total game time, in seconds.</param> /// <param name="dt">The game time, in seconds, since the last call to this method.</param> public override void Draw(float t, float dt) { GfxUtil.SetRT(mRT); Game1.Inst.GraphicsDevice.Clear(Color.White); base.Draw(t, dt); GfxUtil.SetRT(null); GfxUtil.DrawFsQuad(mDistortFX); }
public void TestLoadImage() { var testData = Convert.FromBase64String(TestImageData); //var image = GfxUtil.ScaleImage(testData, 16, 16, ScaleTransformFlags.UIIcon); var image = GfxUtil.LoadImage(testData); Assert.That(image.Width, Is.EqualTo(16)); Assert.That(image.Height, Is.EqualTo(16)); }
private static string MakeIconImg(PwIcon i, PwUuid ci, PfOptions p) { if (p.ClientIcons == null) { return(string.Empty); } Image img = null; PwDatabase pd = p.Database; if ((ci != null) && !ci.Equals(PwUuid.Zero) && (pd != null)) { int cix = pd.GetCustomIconIndex(ci); if (cix >= 0) { cix += (int)PwIcon.Count; if (cix < p.ClientIcons.Images.Count) { img = p.ClientIcons.Images[cix]; } else { Debug.Assert(false); } } else { Debug.Assert(false); } } int ix = (int)i; if ((img == null) && (ix >= 0) && (ix < p.ClientIcons.Images.Count)) { img = p.ClientIcons.Images[ix]; } string strData = GfxUtil.ImageToDataUri(img); if (string.IsNullOrEmpty(strData)) { Debug.Assert(false); return(string.Empty); } StringBuilder sb = new StringBuilder(); sb.Append("<img src=\""); sb.Append(strData); sb.AppendLine("\""); sb.Append("class=\"icon_cli\" alt=\"\" /> "); return(sb.ToString()); }
private static void ImportIcon(XmlNode xn, PwEntry pe, PwDatabase pd) { XmlNode xnIcon = xn.Attributes.GetNamedItem("ICON"); if(xnIcon == null) return; string strIcon = xnIcon.Value; if(!StrUtil.IsDataUri(strIcon)) { Debug.Assert(false); return; } try { byte[] pbImage = StrUtil.DataUriToData(strIcon); if((pbImage == null) || (pbImage.Length == 0)) { Debug.Assert(false); return; } Image img = GfxUtil.LoadImage(pbImage); if(img == null) { Debug.Assert(false); return; } byte[] pbPng; int wMax = PwCustomIcon.MaxWidth; int hMax = PwCustomIcon.MaxHeight; if((img.Width <= wMax) && (img.Height <= hMax)) { using(MemoryStream msPng = new MemoryStream()) { img.Save(msPng, ImageFormat.Png); pbPng = msPng.ToArray(); } } else { using(Image imgSc = GfxUtil.ScaleImage(img, wMax, hMax)) { using(MemoryStream msPng = new MemoryStream()) { imgSc.Save(msPng, ImageFormat.Png); pbPng = msPng.ToArray(); } } } img.Dispose(); PwUuid pwUuid = null; int iEx = pd.GetCustomIconIndex(pbPng); if(iEx >= 0) pwUuid = pd.CustomIcons[iEx].Uuid; else { pwUuid = new PwUuid(true); pd.CustomIcons.Add(new PwCustomIcon(pwUuid, pbPng)); pd.UINeedsIconUpdate = true; pd.Modified = true; } pe.CustomIconUuid = pwUuid; } catch(Exception) { Debug.Assert(false); } }
/// <summary>Updates the cube map by rendering each environment mapped cube face. NOTE: This is /// really slow so don't do this too often.</summary> public void Update() { // Basically, what we do here is position cameras in each direction of the cube and render // to hidden targets, then use them as texture sources in the shader (see CubeMap.fx). var p = mTransf.Position; var rot = Matrix.Identity; var r = Vector3.Transform(Vector3.Right, rot); var l = Vector3.Transform(Vector3.Left, rot); var u = Vector3.Transform(Vector3.Up, rot); var d = Vector3.Transform(Vector3.Down, rot); var b = Vector3.Transform(Vector3.Backward, rot); var f = Vector3.Transform(Vector3.Forward, rot); // TODO: Cache cameras, don't need to realloc them here. var cams = new CCamera[6]; cams[0] = new CCamera { View = Matrix.CreateLookAt(p, p + r, d) }; cams[1] = new CCamera { View = Matrix.CreateLookAt(p, p + l, d) }; cams[2] = new CCamera { View = Matrix.CreateLookAt(p, p + u, b) }; cams[3] = new CCamera { View = Matrix.CreateLookAt(p, p + d, f) }; cams[4] = new CCamera { View = Matrix.CreateLookAt(p, p + b, d) }; cams[5] = new CCamera { View = Matrix.CreateLookAt(p, p + f, d) }; var aspect = 1.0f; var fovRad = 90.0f * 2.0f * MathHelper.Pi / 360.0f; var zFar = 100.0f; var zNear = 0.01f; for (var i = 0; i < 6; i++) { cams[i].Projection = Matrix.CreatePerspectiveFieldOfView(fovRad, aspect, zNear, zFar); GfxUtil.SetRT(mEnvRTs[i]); Game1.Inst.GraphicsDevice.Clear(Color.Magenta); //mRenderer.DrawScene(cams[i], mEid); } GfxUtil.SetRT(null); }
void LateUpdate() { GfxUtil.CaculUIScale(); //GfxBloodManager.Update(); //TopNameManager.Update(); //FloatFontManager.Update(); SelectedTargetTips.Update(); if (windowRegistryList.Count > 0) { base.SFLateUpdate(); } }
/// <summary>Draws the scene by invoking the <see cref="EcsSystem.Draw"/> /// method on all systems in the scene.</summary> /// <param name="t">The total game time, in seconds.</param> /// <param name="dt">The game time, in seconds, since the last call to this method.</param> public override void Draw(float t, float dt) { { // TODO: CameraSystem no longer supports anything but chase cam, so manual setup below. var cam = (CCamera)Game1.Inst.Scene.GetComponentFromEntity <CCamera>(mCamID); var camTransf = (CTransform)Game1.Inst.Scene.GetComponentFromEntity <CTransform>(mCamID); cam.View = Matrix.CreateLookAt(camTransf.Position, cam.Target, Vector3.Up); } GfxUtil.SetRT(mRT); Game1.Inst.GraphicsDevice.Clear(Color.White); base.Draw(t, dt); GfxUtil.SetRT(null); GfxUtil.DrawFsQuad(mDistortFX); }
private void GetObjectProps(string strPath, DriveInfo drvHint, out Image img, ref string strDisplayName) { GetObjectPropsUnscaled(strPath, drvHint, out img, ref strDisplayName); if (img != null) { if ((img.Width != m_nIconDim) || (img.Height != m_nIconDim)) { Image imgScaled = GfxUtil.ScaleImage(img, m_nIconDim, m_nIconDim, ScaleTransformFlags.UIIcon); img.Dispose(); // Dispose unscaled version img = imgScaled; } } }
/// <summary> /// Get the icon as an <c>Image</c> (original size). /// </summary> public Android.Graphics.Bitmap GetImage() { const long lKey = -1; Android.Graphics.Bitmap img; if (m_dImageCache.TryGetValue(lKey, out img)) { return(img); } try { img = GfxUtil.LoadImage(m_pbImageDataPng); } catch (Exception) { Debug.Assert(false); } m_dImageCache[lKey] = img; return(img); }
/// <summary> /// 设置位置,这个是直接设置位置,不是从世界坐标转换过来的。(Unity屏幕坐标) /// </summary> /// <param name="pixelPos">Unity屏幕坐标</param> public virtual void SetPositionDirectly_UnityPoint(Vector2 pixelPos) { //是否在视野中 m_isOnCameraView = GfxUtil.IsOnView(pixelPos, false); m_PixPos = pixelPos; if (m_isOnCameraView) { Vector2 pos = GfxUtil.ScreenPointToStagePoint(pixelPos); if (Mathf.Abs(m_PixPos.x - pos.x) > 0.01f || Mathf.Abs(m_PixPos.y - pos.y) > 0.01f) { m_DisplayInfo.X = pos.x; m_DisplayInfo.Y = pos.y; bNeedToUpdateDisplayInfo = true; } } OnPositionChange(); }
/// <summary> /// 设置位置。这个函数的位置是从世界坐标转换过来的屏幕坐标,Z值是有效值 /// </summary> /// <param name="WorldPos">屏幕坐标</param> public virtual void SetPositionFromWorldSpace(Vector3 ScreenPos) { //是否在视野中 m_isOnCameraView = GfxUtil.IsOnView(ScreenPos, true); m_PixPos = ScreenPos; if (m_isOnCameraView) { Vector2 pos = GfxUtil.ScreenPointToStagePoint(ScreenPos); if (((Mathf.Abs(m_PixPos.x - pos.x) > 0.01f || Mathf.Abs(m_PixPos.y - pos.y) > 0.01f)) && ((Mathf.Abs((float)m_DisplayInfo.X - pos.x) > 1.0f || Mathf.Abs((float)m_DisplayInfo.Y - pos.y) > 1.0f))) { m_DisplayInfo.X = pos.x; m_DisplayInfo.Y = pos.y; bNeedToUpdateDisplayInfo = true; } } OnPositionChange(); }
public List <Image> GetImages(int w, int h, bool bSortByName) { if (w < 0) { Debug.Assert(false); return(null); } if (h < 0) { Debug.Assert(false); return(null); } List <ImageArchiveItem> lItems = new List <ImageArchiveItem>( m_dItems.Values); if (bSortByName) { lItems.Sort(ImageArchive.CompareByName); } List <Image> l = new List <Image>(lItems.Count); foreach (ImageArchiveItem it in lItems) { Image img = it.Image; if (img == null) { Debug.Assert(false); img = UIUtil.CreateColorBitmap24(w, h, Color.White); } if ((img.Width == w) && (img.Height == h)) { l.Add(img); } else { l.Add(GfxUtil.ScaleImage(img, w, h, ScaleTransformFlags.UIIcon)); } } Debug.Assert(l.Count == lItems.Count); return(l); }
/// <summary>Draws the overlay.</summary> /// <param name="t">The total game time, in seconds.</param> /// <param name="dt">The game time, in seconds, since the last call to this /// method.</param> public override void Draw(float t, float dt) { base.Draw(t, dt); // Draw boxes before overlay text. DrawAABBs(); var x = 16.0f; var y = 16.0f; mSB.Begin(); foreach (var fn in mStrFns) { GfxUtil.DrawText(mSB, x, y, fn(t, dt), GfxUtil.DefFont, Color.Magenta); y += 24.0f; } mSB.End(); }
public static BinaryDataClass ClassifyData(byte[] pbData) { if (pbData == null) { Debug.Assert(false); throw new ArgumentNullException("pbData"); } try { Image img = GfxUtil.LoadImage(pbData); if (img != null) { img.Dispose(); return(BinaryDataClass.Image); } } catch (Exception) { } return(BinaryDataClass.Unknown); }
private bool IsValidImage(byte[] data) { // Invalid data if (data == null) { return(false); } try { Image image = GfxUtil.LoadImage(data); return(true); } catch (Exception) { // Invalid image format } return(false); }
public static Image ScaleImage(Image img, bool bForceNewObject) { if (img == null) { Debug.Assert(false); return(null); } // EnsureInitialized(); // Done by ScaleIntX int w = img.Width; int h = img.Height; int sw = ScaleIntX(w); int sh = ScaleIntY(h); if ((w == sw) && (h == sh) && !bForceNewObject) { return(img); } return(GfxUtil.ScaleImage(img, sw, sh, ScaleTransformFlags.UIIcon)); }
public override void Draw(float t, float dt) { if (shouldLeave) // TODO: When we parallelise this probably won't work. { CScore score = (CScore)Game1.Inst.Scene.GetComponentFromEntity <CScore>(player); SfxUtil.PlaySound("Sounds/Effects/horny_end"); Game1.Inst.LeaveScene(); Game1.Inst.EnterScene(new EndGameScene(passedTime, score.Score, won)); } var camera = (CCamera)GetComponentFromEntity <CCamera>(player); if (camera.Position.Y < configs.WaterHeight) { GfxUtil.SetRT(mRT); base.Draw(t, dt); GfxUtil.SetRT(null); mUnderWaterFx.Parameters["SrcTex"].SetValue(mRT); mUnderWaterFx.Parameters["Phase"].SetValue(t); GfxUtil.DrawFsQuad(mUnderWaterFx); } else if (configs.IsRaining) { GfxUtil.SetRT(mRT); base.Draw(t, dt); GfxUtil.SetRT(null); mPostProcessor.ApplyPostProcess(t, dt, mRT); } else { GfxUtil.SetRT(null); base.Draw(t, dt); } mHud.Update(); mHud.Draw(player); }
/// <summary> /// 创建一个Window /// </summary> /// <typeparam name="T">创建的是那个类</typeparam> /// <param name="_name">swf名字,用于区分各个不同的swf</param> /// <param name="_fullPatch">全路径,相对于streamingasset文件夹</param> /// <param name="_backgroundColor">背景颜色(255为单位)</param> /// <param name="_bVisibleOnCreate">是否创建的时候在画布上显示出来</param> /// <param name="_bIgnoreMovie">是否加入忽略列表,目前用于按esc隐藏界面功能</param> /// <param name="_modeType">movie的缩放方式</param> /// <param name="_fromByteStream">从字节流中创建</param> /// <param name="_renderTexture">是否使用Rt</param> /// <param name="_scaleModeType">缩放模式</param> /// <param name="_movieName">电影名称,暂时忽略</param> /// <returns></returns> public T CreateWindow <T>(string _name, string _fullPatch, Color32 _backgroundColor, bool _bVisibleOnCreate = false, ScaleModeType _modeType = ScaleModeType.SM_ShowAll, bool _fromByteStream = true, RenderTexture _renderTexture = null, string _movieName = null) where T : Movie { if (GetWindow(_name) != null) { return(GetWindow(_name) as T); } T newMovie = default(T); newMovie = GfxUtil.CreateSwf <T>(this, _fullPatch, _fromByteStream, _backgroundColor, _renderTexture, _modeType, _movieName); if (null == newMovie) { return(null); } SFMovieEx MovieEx = newMovie as SFMovieEx; MovieEx.IsVisibleOnCreate = _bVisibleOnCreate; windowRegistryList.Add(_name, newMovie); return(newMovie); }
public override object GetObject(string name, CultureInfo culture) { if (name == null) { throw new ArgumentNullException("name"); } if (this.GetObjectPre != null) { CrmEventArgs e = new CrmEventArgs(name, culture, null); this.GetObjectPre(this, e); if (e.Object != null) { return(e.Object); } } object oOvr; if (m_dOverrides.TryGetValue(name, out oOvr)) { return(oOvr); } object o = m_rm.GetObject(name, culture); if (o == null) { Debug.Assert(false); return(null); } try { Image img = (o as Image); if (img != null) { Debug.Assert(!(o is Icon)); Image imgOvr = m_iaAppHighRes.GetForObject(name); if (imgOvr != null) { int wOvr = imgOvr.Width; int hOvr = imgOvr.Height; int wBase = img.Width; int hBase = img.Height; int wReq = DpiUtil.ScaleIntX(wBase); int hReq = DpiUtil.ScaleIntY(hBase); if ((wBase > wOvr) || (hBase > hOvr)) { Debug.Assert(false); // Base has higher resolution imgOvr = img; wOvr = wBase; hOvr = hBase; } if ((wReq != wOvr) || (hReq != hOvr)) { imgOvr = GfxUtil.ScaleImage(imgOvr, wReq, hReq, ScaleTransformFlags.UIIcon); } } else { imgOvr = DpiUtil.ScaleImage(img, false); } m_dOverrides[name] = imgOvr; return(imgOvr); } } catch (Exception) { Debug.Assert(false); } return(o); }