# Where is the graphics documentation

**URL:** <https://discourse.julialang.org/t/where-is-the-graphics-documentation/19734>\
**Category:** New to Julia\
**Created:** [January 17, 2019, 5:36am UTC](https://discourse.julialang.org/t/where-is-the-graphics-documentation/19734 "2019-01-17T05:36:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff10111](https://avatars.discourse-cdn.com/v4/letter/j/34f0e0/32.png) [@jeff10111](https://discourse.julialang.org/u/jeff10111)\
**Post date:** [January 17, 2019, 5:36am UTC](https://discourse.julialang.org/t/where-is-the-graphics-documentation/19734/1 "2019-01-17T05:36:16Z")

</div>

I’ve read how to create a gtk window and draw a rectangle to it using the draw function. But I can’t find any documentation beyond that.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 17, 2019, 8:06am UTC](https://discourse.julialang.org/t/where-is-the-graphics-documentation/19734/2 "2019-01-17T08:06:44Z")

</div>

Please provide some details (which library you are using, etc) and preferably code.

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …

---

<div class="post-metadata">

**Author:** ![jonathanBieler](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jonathanBieler](https://discourse.julialang.org/u/jonathanBieler)\
**Post date:** [January 17, 2019, 9:30am UTC](https://discourse.julialang.org/t/where-is-the-graphics-documentation/19734/3 "2019-01-17T09:30:41Z")

</div>

I think he’s referring to this:

[http://juliagraphics.github.io/Gtk.jl/latest/manual/canvas.html](http://juliagraphics.github.io/Gtk.jl/latest/manual/canvas.html)

Gtk uses Cairo.jl to draw, so you can have look at the [examples](https://github.com/JuliaGraphics/Cairo.jl/blob/master/samples/Samples.md) or Cairo’s doc.

Note that the Cairo context in the Gtk example is called `ctx` while it’s called `cr` in Cairo’s, and you have to do `using Cairo`. E.g.

```julia
using Gtk, Graphics, Cairo
c = @GtkCanvas()
win = GtkWindow(c, "Canvas")

@guarded draw(c) do widget

    cr = getgc(c)
    h = height(c)
    w = width(c)

    save(cr);
    set_source_rgb(cr,0.8,0.8,0.8); # light gray
    rectangle(cr,0.0,0.0,256.0,256.0); # background
    fill(cr);
    restore(cr);

    save(cr);
    ## original example, following here

    move_to(cr, 50.0, 75.0);
    line_to(cr, 200.0, 75.0);

    move_to(cr, 50.0, 125.0);
    line_to(cr, 200.0, 125.0);

    move_to(cr, 50.0, 175.0);
    line_to(cr, 200.0, 175.0);

    set_line_width(cr, 30.0);
    set_line_cap(cr, Cairo.CAIRO_LINE_CAP_ROUND);
    stroke(cr);

    ## mark picture with current date
    restore(cr);
    move_to(cr,0.0,12.0);
    set_source_rgb(cr, 0,0,0);
    show_text(cr,Libc.strftime(time()));
end
show(c)

```

---

<div class="post-metadata">

**Author:** ![jeff10111](https://avatars.discourse-cdn.com/v4/letter/j/34f0e0/32.png) [@jeff10111](https://discourse.julialang.org/u/jeff10111)\
**Post date:** [January 17, 2019, 12:46pm UTC](https://discourse.julialang.org/t/where-is-the-graphics-documentation/19734/4 "2019-01-17T12:46:13Z")

</div>

Yeah that’s it. So as for the example of the rectangle function, my question is where exactly does that come from? And are there other functions in the same package? Such as drawing an array of rbg pixels onto the canvas or text or different shapes. Or drawing an image to the canvas? I read somewhere else about opening image files but I don’t recall there being anything related to drawing them to canvas. Can you access the current canvas values such as pixel values? Can you draw individual pixels ( of course you could using the rectangle function but it’s slightly convoluted for that situation.

My question is simply what tools are available beyond rectangle() and where I can read about them

---

<div class="post-metadata">

**Author:** ![jeff10111](https://avatars.discourse-cdn.com/v4/letter/j/34f0e0/32.png) [@jeff10111](https://discourse.julialang.org/u/jeff10111)\
**Post date:** [January 17, 2019, 12:46pm UTC](https://discourse.julialang.org/t/where-is-the-graphics-documentation/19734/5 "2019-01-17T12:46:17Z")

</div>

Thanks I’ll go through that Cairo documentation
