11 internal IDrawable Owner {
get; } = owner;
13 internal PointF Offset {
get; } = offset;
18 public Guid Id => Owner.Id;
23 public string? Nickname => Owner.Nickname;
28 public bool Visible => Owner.Visible;
33 public int ZOrder => Owner.ZOrder;
40 public RectangleF GetDrawLocationScreen(View view)
42 using var scope =
Enter(view);
43 return Owner.GetDrawLocationScreen(view);
51 public void Draw(BackbufferBase backbuffer, RectangleF destRectScreen) => Owner.Draw(backbuffer, destRectScreen);
53 [ThreadStatic]
private static WrappedDrawable? _current;
54 [ThreadStatic]
private static View? _view;
56 internal static PointF ScreenOffset(View view, SceneLayer layer)
58 if (_current is
null || !ReferenceEquals(_view, view) || !ReferenceEquals(_current.Layer, layer))
61 float zoom = Gondwana.Rendering.RenderContext.Current?.ViewportZoom ?? view.
Viewport.
Zoom;
62 return new(_current.Offset.X * zoom, _current.Offset.Y * zoom);
65 internal IDisposable
Enter(View view) =>
new Scope(
this, view);
67 private sealed class Scope : IDisposable
69 private readonly WrappedDrawable? _prior = _current;
70 private readonly
View? _priorView = _view;
72 internal Scope(WrappedDrawable instance, View view)
Viewport Viewport
Gets the viewport that defines the screen-space rectangle, zoom level, and other rendering parameters...
float Zoom
Zoom factor applied to the world when rendering this view. Values greater than 1 zoom in,...
Represents an object that can be drawn on a visual surface, with properties for visibility and stacki...
@ SceneLayer
Performs direct drawing within a scene layer using world-space coordinates.