Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Libs/cairo-1.0/Internal/ImageSurface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ public class ImageSurface

[DllImport(CairoImportResolver.Library, EntryPoint = "cairo_image_surface_get_width")]
public static extern int GetWidth(SurfaceHandle handle);

[DllImport(CairoImportResolver.Library, EntryPoint = "cairo_image_surface_create_from_png")]
public static extern SurfaceOwnedHandle CreateFromPng(GLib.Internal.NonNullableUtf8StringOwnedHandle filename);
Comment thread
badcel marked this conversation as resolved.
Outdated
}
5 changes: 5 additions & 0 deletions src/Libs/cairo-1.0/Internal/Surface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,9 @@ public partial class Surface

[DllImport(CairoImportResolver.Library, EntryPoint = "cairo_surface_status")]
public static extern Status Status(SurfaceHandle handle);

[DllImport(CairoImportResolver.Library, EntryPoint = "cairo_surface_write_to_png")]
Comment thread
badcel marked this conversation as resolved.
public static extern Status WriteToPng(SurfaceHandle handle, GLib.Internal.NonNullableUtf8StringOwnedHandle filename);

Comment thread
badcel marked this conversation as resolved.
Outdated

}
6 changes: 6 additions & 0 deletions src/Libs/cairo-1.0/Public/ImageSurface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,11 @@ public Span<byte> GetData()
return new Span<byte>(data.ToPointer(), GetSizeInBytes());
}
}

public static Surface CreateFromPng(string filename)
Comment thread
badcel marked this conversation as resolved.
Outdated
{
using var filenameNative = GLib.Internal.NonNullableUtf8StringOwnedHandle.Create(filename);
return new Surface(Internal.ImageSurface.CreateFromPng(filenameNative));
}
}

6 changes: 6 additions & 0 deletions src/Libs/cairo-1.0/Public/Surface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,10 @@ public void MarkDirty(int x, int y, int width, int height)
? null
: new Device(deviceHandle.OwnedCopy());
}

public Status WriteToPng(string filename)
Comment thread
badcel marked this conversation as resolved.
{
using var filenameNative = GLib.Internal.NonNullableUtf8StringOwnedHandle.Create(filename);
return Internal.Surface.WriteToPng(Handle, filenameNative);
}
}
Loading