DXGDI++

Post Reply
ONiX
Site Admin
Posts: 80
Joined: Tue Nov 18, 2025 1:27 am

DXGDI++

Post by ONiX »

Yesterday, I queried google ... what does Graphics32 offer that GDI+ lacks.

So, I pulled from my archives pieces I developed while making a product I called Vinny. Vinny was written shortly after my son Vinny passed away... I was actively working with Boyertown PA Fire Department - where I learned most of the Volunteer Fire Departments were running pirated Adobe Photoshop. So... Vinny consisted of pre-defined "Photo Improvement" routines. Allowing my Department customers to touch-up photos with preset functions. Long story short (well as short as I can manage), I had build some extremely fast pixel level graphics. An area where GDI+ is weak.

Introducing DXDGI++ "Pixel Level" Components
DXGDI++ High-Performance Pixel Buffer & Bitmap Manager
Part of the DXGDI++ Graphics Library

TDXPixelBuffer provides low-level, high-performance pixel manipulation capabilities
including direct memory access, efficient blitting, and optimized pixel
operations that exceed the performance of standard GDI+ for pixel-level work.
This TDXPixelBuffer class provides the core foundation for high-performance pixel operations. Here are the key features it delivers:

Key Features:

Direct Memory Access: Raw pointer access with GetRawData() and GetDataPtr()

Thread-Safe Locking: RAII-style locking with TDXPixelBufferLock

Multiple Pixel Formats: Support for ARGB32, RGB24, RGB16, etc.

Optimized Memory Layout: 4-byte aligned scan lines for better SIMD performance

High-Performance Pixel Access: Inline methods for locked access

Memory Management Options: Managed memory, external memory, or memory-mapped files

Bulk Operations: Clear(), FillRect(), CopyFrom() with optimized implementations

Usage:
(C) 2025 by Brain Patchwork DX, LLC.
(C) 2025 by Brain Patchwork DX, LLC.
2025-12-29_20-08.png (59.6 KiB) Viewed 566 times
Next area of focus is:
DXGDIPlusBlitter - Optimized Blitting and Drawing Engine.
Part of the DXGDI++ Graphics Library

DXGDIPlusBlitter provides lightning-fast image transfers and drawing operations that work with our TDXPixelBuffer.
Key Features:

Direct Memory Access: Works directly with pixel buffer memory

Optimized Algorithms: Uses Bresenham and other efficient rasterization algorithms

Minimal Allocations: Reuses buffers and avoids temporary object creation

SIMD-Ready: Structure designed for easy SIMD optimization additions

Lock Management: Proper buffer locking prevents race conditions
DXGDI++ Advanced Alpha Blending & Compositing Engine
Part of the DXGDI++ Graphics Library

DXGDIPlusAlphaCompositor provides highly optimized functions for various alpha blending
and compositing modes, leveraging direct pixel buffer access. It supports
standard alpha blending, complex blend modes, and handling of pre-multiplied
alpha for accurate and fast compositing.
Key Features:

Extensive Blend Modes: Implements a wide array of Photoshop-like blend modes (Normal, Add, Multiply, Screen, Overlay, Darken, Lighten, Difference, etc.) for ARGB32 pixels.

Optimized PixelBlend Functions: Each blend mode has a dedicated PixelBlend function that performs the raw ARGB32 calculation, designed for efficiency using bitwise operations and integer math.

Span-Based Blending (BlendSpanARGB32): The BlendSpanARGB32 method orchestrates the per-pixel blend functions over an entire horizontal line (span) of pixels. This is a common optimization strategy to reduce loop overhead.

Buffer Composition (Compose): The Compose method allows you to combine an entire SrcBuffer onto a DestBuffer at a specified position, using any of the available blend modes and a global alpha value. It handles clipping automatically.

Pre-multiplied Alpha Support: Includes ConvertToPremultipliedAlpha and ConvertFromPremultipliedAlpha to correctly handle pre-multiplied alpha values, which are essential for physically accurate and artifact-free compositing, especially when dealing with transparency.

Alpha Masking (ApplyAlphaMask): A function to apply an 8-bit grayscale (A8) mask to an ARGB32 destination buffer, letting you control the transparency of regions based on a separate image.

Direct TDXPixelBuffer Integration: Seamlessly works with the TDXPixelBuffer class, leveraging its direct memory access and locking mechanisms.

Usage:
(C) 2025 by Brain Patchwork DX, LLC.
(C) 2025 by Brain Patchwork DX, LLC.
2025-12-29_20-24.png (108.62 KiB) Viewed 566 times
Post Reply