Drawing Pixels
Prev | Chapter 14. The Drawing Area Widget | Next

## Drawing Pixels

You can draw individual pixels with the two methods `Gdk::Drawable::draw_point()` and `Gdk::Drawable::draw_points()`. All drawing methods take a `Gdk::GC` as their first argument, except where noted. The other two arguments to `draw_point()` are the x coordinate (horizontal position relative to the left edge of the widget, starting at 0), and the y coordinate (vertical position relative to the top of the widget, starting at 0). `draw_points()` takes two arguments, the `Gdk::GC` and a collection of `Gdk::Points`. The second argument can be any kind of standard container, such as a `std::vector<Gdk::Point>`. So for example `draw_point()` could be used like this:

    get_window()->draw_point(some_gc, 20, 20);

But `draw_points()` is a bit more complicated and might be used like this:

    std::vector<Gdk::Point> points_array;
    points_array.push_back(Gdk::Point(10, 10));
    points_array.push_back(Gdk::Point(20, 20));
    draw_points(some_gc, points_array); //One way to draw the two points.

Prev | Up | Next
Chapter 14. The Drawing Area Widget | Home | Drawing Lines