|
Revision 119, 0.5 kB
(checked in by DRK, 6 years ago)
|
* Added bindings for the Glitz and Xlib backends.
* Checked in cairooo: an OO layer on top of the cairo binding.
* Added snippets directory for cairooo
* Added basic tutorial on how to use cairooo
* Added a simple demo program.
* Added scripts for building import libraries.
* Fixed several bugs.
* Drank WAAY too much coffee.
|
| Line | |
|---|
| 1 |
module snippets.clip; |
|---|
| 2 |
|
|---|
| 3 |
private |
|---|
| 4 |
{ |
|---|
| 5 |
import std.math; |
|---|
| 6 |
import cairooo.all; |
|---|
| 7 |
import snippets.common; |
|---|
| 8 |
} |
|---|
| 9 |
|
|---|
| 10 |
void snippet_clip(Context cr, int width, int height) |
|---|
| 11 |
{ |
|---|
| 12 |
cr.arc(0.5, 0.5, 0.3, 0, 2*PI); |
|---|
| 13 |
cr.clip(); |
|---|
| 14 |
|
|---|
| 15 |
cr.newPath(); // current path is not consumed by Context.clip() |
|---|
| 16 |
cr.rectangle(0, 0, 1, 1); |
|---|
| 17 |
cr.fill(); |
|---|
| 18 |
cr.setSourceRGB(0, 1, 0); |
|---|
| 19 |
cr.moveTo(0, 0); |
|---|
| 20 |
cr.lineTo(1, 1); |
|---|
| 21 |
cr.moveTo(1, 0); |
|---|
| 22 |
cr.lineTo(0, 1); |
|---|
| 23 |
cr.stroke(); |
|---|
| 24 |
} |
|---|
| 25 |
|
|---|
| 26 |
static this() |
|---|
| 27 |
{ |
|---|
| 28 |
snippets_hash["clip"] = &snippet_clip; |
|---|
| 29 |
} |
|---|