////////////////////////////////////////////////////////////////// // Private Methods ////////////////////////////////////////////////////////////////// private void UpdateImageResolution(ZView zView, IntPtr connection) { // Get the current viewport size. Vector2 viewportSize = ZCoreProxy.Instance.GetViewportSize(); UInt16 imageWidth = (UInt16)viewportSize.x; UInt16 imageHeight = (UInt16)viewportSize.y; // Set image width and height. if (imageWidth != _imageWidth || imageHeight != _imageHeight) { // Begin settings batch. try { zView.BeginSettingsBatch(connection); } catch (PluginException e) { Debug.LogError(string.Format("Failed to begin settings batch for updating image resolution: {0}", e.PluginError)); return; } // Update image resolution. try { // Update the connection's image resolution settings. zView.SetSetting(connection, ZView.SettingKey.ImageWidth, imageWidth); zView.SetSetting(connection, ZView.SettingKey.ImageHeight, imageHeight); // Update the internally cached image resolution in order to check // if the image resolution has changed in subsequent frames. _imageWidth = imageWidth; _imageHeight = imageHeight; } catch (PluginException e) { Debug.LogError(string.Format("Failed to set image resolution settings: {0}", e.PluginError)); } // End settings batch. try { zView.EndSettingsBatch(connection); } catch (PluginException e) { Debug.LogError(string.Format("Failed to end settings batch for updating image resolution: {0}", e.PluginError)); } } }