Cairo Native Interop?
Open
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 491
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Description
Taking this as my basic example for lack of better explanation
local lgi = require("lgi")
local Gtk = lgi.require("Gtk", "3.0")
local cairo = lgi.cairo
local window = Gtk.Window {
title = "Drawing Area",
default_width = 600,
default_height = 600,
on_destroy = Gtk.main_quit
}
function window:on_draw(cr)
--Here's the context `cr`
--Lets assume this is passed by a controlling C process:
local ptr = cr._native
--Lets try to get an LGI context from the pointer:
local ctx = cairo.Context(ptr) -- This will fail, because it expects a surface
end
local da = Gtk.DrawingArea {
expand = true
}
window:add(da)
window:show_all()
Gtk:main()
Is there a proper way of retrieving the actual cairo.Context object being used with lgi here, or should a workaround be found?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository file or test is named; start with the Lua example and trace how lgi exposes cairo.Context and the _native pointer. Define what supported Cairo interop should look like, then verify the chosen behavior against the GTK drawing callback scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, lua
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100