XCBased.jl
Julia bindings for the XCB library. This package abstracts away XCB cookies, errors, events and replies to create a highly usable Julia interface.
Based XCB Julia bindings with futures. ๐ฎ
License: GNU General Public License v3.0
I was using the following code to take a screenshot:
using XCBased, FileIO, ColorTypes
x11_display = ENV["DISPLAY"]
conn = xcb_connect(x11_display)
setup = get_setup(conn)
screen = setup.screens[1]
width = screen.width_in_pixels
height = screen.height_in_pixels
root = screen.root
output_format = XCB_IMAGE_FORMAT_Z_PIXMAP
plane_mask = 2^32 - 1
rep = xcb_get_image(conn, output_format, root, 0, 0, width, height, plane_mask, checked = false)
reply = fetch(rep)
img_data = reply.data
img = Array{Any}(zeros(height, width))
for i in 1:length(img_data)/4
# The next line is the one causing problems
img[Int(ceil(i/width)),Int((4i%width)/4)+1] = RGBX(img_data[Int(4(i-1)+1)]/255, img_data[Int(4(i-1)+2)]/255, img_data[Int(4(i-1)+3)]/255)
end
save("./image.png", img)
xcb_disconnect(conn)
but got a segmentation fault:
signal (11): Segmentation fault
in expression starting at /home/wali/Documents/julia/xshot.jl:23
getindex at ./array.jl:805
unknown function (ip: 0x7faebf2cf9d6)
top-level scope at /home/wali/Documents/julia/xshot.jl:24
unknown function (ip: 0x7faf4635db5f)
unknown function (ip: 0x7faf4635e46c)
jl_toplevel_eval_in at /usr/bin/../lib/julia/libjulia-internal.so.1 (unknown line)
unknown function (ip: 0x7faf342cb837)
unknown function (ip: 0x7faf34302d33)
unknown function (ip: 0x7faf340f70f2)
unknown function (ip: 0x7faf3403bc3d)
unknown function (ip: 0x7faf3403cc6a)
unknown function (ip: 0x7faf3403cdb5)
unknown function (ip: 0x7faf46380ade)
repl_entrypoint at /usr/bin/../lib/julia/libjulia-internal.so.1 (unknown line)
main at julia (unknown line)
__libc_start_main at /usr/bin/../lib/libc.so.6 (unknown line)
_start at julia (unknown line)
Allocations: 10511937 (Pool: 10510873; Big: 1064); GC: 6
[1] 52961 segmentation fault (core dumped) julia xshot.jl
Getting the following error now:
ERROR: UndefVarError: libxcb.so.1 not defined
Stacktrace:
[1] xcb_connect(displayname::String, screenp::Base.RefValue{Int32})
@ XCBased.LibXCB ~/.julia/packages/XCBased/I86AA/gen/xcb_api.jl:90
[2] xcb_connect(display_name::String)
@ XCBased ~/.julia/packages/XCBased/I86AA/src/XCBased.jl:38
[3] top-level scope
@ REPL[3]:1
Probably something to do with dbf19f0 ?
Hi,
I saw your package being registered in Registry and was curious to know how it compares to XCB.jl?
Hi, I was using this to take a screenshot, but got the following error:
ERROR: type xcb_get_image_reply_t has no field data
Stacktrace:
[1] getproperty(x::XCBased.LibXCB.xcb_get_image_reply_t, f::Symbol)
@ Base ./Base.jl:33
[2] XCBGetImageReply(replyptr::Ptr{XCBased.LibXCB.xcb_get_image_reply_t})
@ XCBased ~/.julia/packages/XCBased/nDjnG/src/replies/get_image.jl:10
[3] fetch(f::XCBGetImageFuture)
@ XCBased ~/.julia/packages/XCBased/nDjnG/src/futures/get_image.jl:26
[4] top-level scope
@ REPL[12]:1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.