Skip to main content

GPU-accelerated drawing primitives for pixtreme

Project description

pixtreme-draw

GPU-accelerated drawing primitives for pixtreme

Overview

pixtreme-draw provides high-performance drawing operations for rendering shapes, text, and masks directly on GPU memory.

Features

  • Shape Drawing: Circles, rectangles with anti-aliasing
  • Text Rendering: GPU-accelerated text with custom fonts
  • Mask Generation: Rounded masks for compositing
  • Zero-Copy: Direct GPU memory operations via CuPy

Installation

Requirements:

  • Python >= 3.12
  • CUDA Toolkit 12.x
  • NVIDIA GPU with compute capability >= 6.0
pip install pixtreme-draw

Requires pixtreme-core, pixtreme-filter, and CUDA Toolkit 12.x.

Quick Start

import pixtreme_draw as pd
import pixtreme_core as px

# Read image
img = px.imread("input.jpg")

# Draw filled circle
img = pd.circle(img, center_x=256, center_y=256, radius=100, color=(0.0, 1.0, 0.0))

# Draw filled rectangle
img = pd.rectangle(img, top_left_x=100, top_left_y=100, bottom_right_x=300, bottom_right_y=300, color=(1.0, 0.0, 0.0))

# Add text label with background
img = pd.add_label(img, text="Hello World", org=(50, 50), color=(1.0, 1.0, 1.0))

# Save result
px.imwrite("output.jpg", img)

API

Shape Drawing

# Circle (filled)
pd.circle(image, center_x, center_y, radius, color=(1.0, 1.0, 1.0))

# Rectangle (filled)
pd.rectangle(image, top_left_x, top_left_y, bottom_right_x, bottom_right_y, color=(1.0, 1.0, 1.0))

Text Rendering

# Simple text
pd.put_text(image, text, org, font_face=cv2.FONT_HERSHEY_SIMPLEX, font_scale=1.0, color=(1.0, 1.0, 1.0), thickness=2)

# Text with background label
pd.add_label(image, text, org=(0, 0), font_scale=1.0, color=(1.0, 1.0, 1.0), label_color=(0.0, 0.0, 0.0))

Mask Generation

# Rounded mask for compositing
mask = pd.create_rounded_mask(dsize=(512, 512), radius_ratio=0.1, blur_size=0, sigma=1.0)

License

MIT License - see LICENSE file for details.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pixtreme_draw-0.8.5.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pixtreme_draw-0.8.5-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file pixtreme_draw-0.8.5.tar.gz.

File metadata

  • Download URL: pixtreme_draw-0.8.5.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.18

File hashes

Hashes for pixtreme_draw-0.8.5.tar.gz
Algorithm Hash digest
SHA256 78b6c49dd27e373c32ac1d1d4a2629803dffdc2bbcdbce3d26463f4532162823
MD5 095fc4e9a9500819a0db696234bef3b2
BLAKE2b-256 7ce9063b09a5ae2886fb2ec4d8fbf6029a345d6acb93c4cf47407d8c86941064

See more details on using hashes here.

File details

Details for the file pixtreme_draw-0.8.5-py3-none-any.whl.

File metadata

File hashes

Hashes for pixtreme_draw-0.8.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3270e4950b646f4ab17f9bca8b304fbccf7eec683d7db8bf8582b97fe6d9821d
MD5 3773c9d26f75d2d1839a9002abf5fb9c
BLAKE2b-256 25841616e3ba1f6338c9a7a8f0f6d5132cb59a4c8db859f6097b8162628d3d25

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page