-
Notifications
You must be signed in to change notification settings - Fork 1
A simple example
viachpaliy edited this page Apr 8, 2020
·
3 revisions
To begin, let's take a look at a simple example that draws two intersecting rectangles, one of which has alpha transparency. We'll explore how this works in more detail in later examples.
def drawfun
context = Gdk.cairo_create(@window.window.not_nil!)
context.set_source_rgb(1, 0, 0)
context.rectangle(10, 10, 50, 50)
context.fill
context.set_source_rgba(0, 0, 1, 0.5)
context.rectangle(30, 30, 50, 50)
context.fill
end
This example looks like this: