|
Revision 119, 0.9 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.set_line_cap; |
|---|
| 2 |
|
|---|
| 3 |
private |
|---|
| 4 |
{ |
|---|
| 5 |
import std.math; |
|---|
| 6 |
import cairooo.all; |
|---|
| 7 |
import snippets.common; |
|---|
| 8 |
} |
|---|
| 9 |
|
|---|
| 10 |
void snippet_set_line_cap(Context cr, int width, int height) |
|---|
| 11 |
{ |
|---|
| 12 |
cr.lineWidth = 0.12; |
|---|
| 13 |
cr.lineCap = LineCap.Butt; |
|---|
| 14 |
cr.moveTo(0.25, 0.2); cr.lineTo(0.25, 0.8); |
|---|
| 15 |
cr.stroke(); |
|---|
| 16 |
cr.lineCap = LineCap.Round; |
|---|
| 17 |
cr.moveTo(0.5, 0.2); cr.lineTo(0.5, 0.8); |
|---|
| 18 |
cr.stroke(); |
|---|
| 19 |
cr.lineCap = LineCap.Square; |
|---|
| 20 |
cr.moveTo(0.75, 0.2); cr.lineTo(0.75, 0.8); |
|---|
| 21 |
cr.stroke(); |
|---|
| 22 |
|
|---|
| 23 |
// draw helping lines |
|---|
| 24 |
cr.setSourceRGB(1, 0.2, 0.2); |
|---|
| 25 |
cr.lineWidth = 0.01; |
|---|
| 26 |
cr.moveTo(0.25, 0.2); cr.lineTo(0.25, 0.8); |
|---|
| 27 |
cr.moveTo(0.5, 0.2); cr.lineTo(0.5, 0.8); |
|---|
| 28 |
cr.moveTo(0.75, 0.2); cr.lineTo(0.75, 0.8); |
|---|
| 29 |
cr.stroke(); |
|---|
| 30 |
} |
|---|
| 31 |
|
|---|
| 32 |
static this() |
|---|
| 33 |
{ |
|---|
| 34 |
snippets_hash["set_line_cap"] = &snippet_set_line_cap; |
|---|
| 35 |
} |
|---|