Add Cairo.Surface.DeviceScale property (#251)

This commit is contained in:
zii-dmg 2021-05-25 12:55:01 +03:00 committed by GitHub
parent 4e4cc157b7
commit 317440bafe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View file

@ -1027,6 +1027,10 @@ namespace Cairo
internal delegate void d_cairo_surface_get_device_offset(IntPtr surface, out double x, out double y);
internal static d_cairo_surface_get_device_offset cairo_surface_get_device_offset = FuncLoader.LoadFunction<d_cairo_surface_get_device_offset>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Cairo), "cairo_surface_get_device_offset"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void d_cairo_surface_get_device_scale(IntPtr surface, out double x, out double y);
internal static d_cairo_surface_get_device_scale cairo_surface_get_device_scale = FuncLoader.LoadFunction<d_cairo_surface_get_device_scale>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Cairo), "cairo_surface_get_device_scale"));
//[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
//internal static extern void cairo_surface_get_fallback_resolution (IntPtr surface, out double x_pixels_per_inch, out double y_pixels_per_inch);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
@ -1065,6 +1069,11 @@ namespace Cairo
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void d_cairo_surface_set_device_offset(IntPtr surface, double x, double y);
internal static d_cairo_surface_set_device_offset cairo_surface_set_device_offset = FuncLoader.LoadFunction<d_cairo_surface_set_device_offset>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Cairo), "cairo_surface_set_device_offset"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void d_cairo_surface_set_device_scale(IntPtr surface, double x, double y);
internal static d_cairo_surface_set_device_scale cairo_surface_set_device_scale = FuncLoader.LoadFunction<d_cairo_surface_set_device_scale>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Cairo), "cairo_surface_set_device_scale"));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void d_cairo_surface_set_fallback_resolution(IntPtr surface, double x, double y);
internal static d_cairo_surface_set_fallback_resolution cairo_surface_set_fallback_resolution = FuncLoader.LoadFunction<d_cairo_surface_set_fallback_resolution>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Cairo), "cairo_surface_set_fallback_resolution"));

View file

@ -205,6 +205,20 @@ namespace Cairo {
}
}
public PointD DeviceScale {
get {
CheckDisposed ();
double x, y;
NativeMethods.cairo_surface_get_device_scale (handle, out x, out y);
return new PointD(x, y);
}
set {
CheckDisposed ();
NativeMethods.cairo_surface_set_device_scale (handle, value.X, value.Y);
}
}
[Obsolete ("Use Dispose()")]
public void Destroy()
{