IWithPixelDensity.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright (c) 2022 Vuplex Inc. All rights reserved.
  2. //
  3. // Licensed under the Vuplex Commercial Software Library License, you may
  4. // not use this file except in compliance with the License. You may obtain
  5. // a copy of the License at
  6. //
  7. // https://vuplex.com/commercial-library-license
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. namespace Vuplex.WebView {
  15. /// <summary>
  16. /// An interface implemented by a webview if it supports changing its pixel density,
  17. /// which is its number of physical pixels per logical pixel.
  18. /// The default pixel density is `1`, but increasing it to `2` can make web content appear sharper
  19. /// or less blurry on high DPI displays.
  20. /// </summary>
  21. /// <example>
  22. /// <code>
  23. /// await webViewPrefab.WaitUntilInitialized();
  24. /// var webViewWithPixelDensity = webViewPrefab.WebView as IWithPixelDensity;
  25. /// if (webViewWithPixelDensity == null) {
  26. /// Debug.Log("This 3D WebView plugin doesn't yet support IWithPixelDensity: " + webViewPrefab.WebView.PluginType);
  27. /// } else {
  28. /// webViewWithPixelDensity.SetPixelDensity(2);
  29. /// }
  30. /// </code>
  31. /// </example>
  32. /// <seealso cref="WebViewPrefab.PixelDensity"/>
  33. public interface IWithPixelDensity {
  34. /// <summary>
  35. /// Gets the current pixel density.
  36. /// </summary>
  37. float PixelDensity { get; }
  38. /// <summary>
  39. /// Sets the pixel density. The value must be between `0` and `10`, and the default is `1`.
  40. /// </summary>
  41. void SetPixelDensity(float pixelDensity);
  42. }
  43. }