|
Revision 179, 0.6 kB
(checked in by John, 4 years ago)
|
added examples
|
| Line | |
|---|
| 1 |
module juno.examples.media.textimage; |
|---|
| 2 |
|
|---|
| 3 |
import juno.media.all; |
|---|
| 4 |
|
|---|
| 5 |
void main() { |
|---|
| 6 |
// Create a bitmap 400 pixels wide by 200 pixels high |
|---|
| 7 |
scope image = new Bitmap(400, 200); |
|---|
| 8 |
|
|---|
| 9 |
// Get the image's drawing surface |
|---|
| 10 |
scope graphics = Graphics.fromImage(image); |
|---|
| 11 |
|
|---|
| 12 |
// Create a font |
|---|
| 13 |
scope font = new Font("Georgia", 30, FontStyle.Bold); |
|---|
| 14 |
|
|---|
| 15 |
// Create a brush |
|---|
| 16 |
scope brush = new SolidBrush(Color.crimson); |
|---|
| 17 |
|
|---|
| 18 |
// Draw the text on the surface |
|---|
| 19 |
graphics.clear(Color.aliceBlue); |
|---|
| 20 |
graphics.drawString("Hello, Juno!", font, brush, 10, 10); |
|---|
| 21 |
|
|---|
| 22 |
// Save the image to a file |
|---|
| 23 |
image.save("hello.gif"); |
|---|
| 24 |
} |
|---|