A simpler version of Pycairo's ImageSurface
Project description
SimpleSurface
A simpler version of Pycairo's ImageSurface
This package is an attempt to complement PyCairo's functionality by performing a lot of the heavy lifting needed for non-native functionality. A lot of the work is done behind the scenes, saving your keyboard undue wear and tear.
Comparison Example
Blue Ellipse using PyCairo
import cairo
import math
# Create 600x800 Surface
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 600, 800)
context = cairo.Context(surface)
# Draw a blue ellipse with top-left corner at (50, 50) measuring 150x200 pixels
x = 50
y = 50
width = 150
height = 200
context.save()
context.translate(x + width / 2., y + height / 2.)
context.scale(width / 2., height / 2.)
context.set_source_rgb(0, 0, 1)
context.arc(0., 0., 1., 0., 2 * math.pi)
context.fill()
context.restore()
# Save as a PDF
pdf_surface = cairo.PDFSurface("example.pdf", 600, 800)
pdf_context = cairo.Context(pdf_surface)
pdf_context.set_source_surface(surface)
pdf_context.paint()
pdf_context.show_page()
Blue Ellipse using SimpleSurface
import SimpleSurface
# Create 600x800 Surface
surface = SimpleSurface(600, 800)
# Draw a blue ellipse with top-left corner at (50, 50) measuring 150x200 pixels
surface.ellipse(50, 50, 150, 200, fill_color=(0, 0, 255))
# Save as a PDF
surface.write_to_pdf("example.pdf")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file SimpleSurface-0.0.3.tar.gz.
File metadata
- Download URL: SimpleSurface-0.0.3.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24feebfcf7872abfe368486aaa4ffbe7fafa35c61d740bcc8328dc6ef701d09a
|
|
| MD5 |
91d2d0b103493330a431a3d209396968
|
|
| BLAKE2b-256 |
8c5ad0ada7988a76a0934e2240399f690d45dadc302901e3fc8b00088efab4d0
|
File details
Details for the file SimpleSurface-0.0.3-py3-none-any.whl.
File metadata
- Download URL: SimpleSurface-0.0.3-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b589cbb5f8a4fde87b43e91b9eac175b7bd71621cd178f6758cd1439b204be14
|
|
| MD5 |
964d6261683865c66e9620bc70cc8e88
|
|
| BLAKE2b-256 |
8997a52f3f30670725b54faf7a05dd3b5a94a6d6845133da1200cb41865289ba
|