forked from celiagg/celiagg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the included font into the main package and update docs (celiagg#77
- Loading branch information
Showing
14 changed files
with
56 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
import celiagg as agg | ||
import numpy as np | ||
from skimage.io import imsave | ||
from PIL import Image | ||
|
||
state = agg.GraphicsState(drawing_mode=agg.DrawingMode.DrawStroke, | ||
line_width=10.0) | ||
transform = agg.Transform() | ||
red_paint = agg.SolidPaint(1.0, 0.0, 0.0) | ||
black_paint = agg.SolidPaint(0.0, 0.0, 0.0) | ||
orange_paint = agg.SolidPaint(0.99, 0.66, 0.0) | ||
|
||
canvas = agg.CanvasRGB24(np.ones((400, 400, 3), dtype=np.uint8)) | ||
canvas = agg.CanvasRGB24(np.zeros((400, 400, 3), dtype=np.uint8)) | ||
|
||
path = agg.Path() | ||
path.ellipse(200, 200, 190, 190) | ||
canvas.clear(1.0, 1.0, 1.0) | ||
canvas.draw_shape(path, transform, state, stroke=red_paint) | ||
|
||
font = agg.Font("/Library/Fonts/Verdana.ttf", 96.0, | ||
agg.FontCacheType.RasterFontCache) | ||
font = agg.Font(agg.example_font(), 96.0) | ||
transform.translate(30.0, 220.0) | ||
canvas.draw_text("celiagg", font, transform, state, | ||
stroke=black_paint) | ||
canvas.draw_text("celiagg", font, transform, state, fill=orange_paint) | ||
|
||
imsave("example.png", canvas.array) | ||
image = Image.fromarray(canvas.array, "RGB") | ||
image.save("example.png") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters