DXGDI+

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

DXGDI+

Post by ONiX »

What does GDI+ offer that GR32 does not?

Vector Graphics and Resolution Independence: GDI+ excels at vector drawing, allowing you to define shapes, lines, and text using mathematical descriptions. These vector elements can be scaled, rotated, and transformed without loss of quality, making them resolution-independent. GR32 is primarily a raster graphics library, meaning it operates at the pixel level. While it can draw lines and shapes, they are rendered as pixels, and scaling them up can lead to pixelation unless re-rendered.
Advanced Text Rendering: GDI+ offers sophisticated text rendering capabilities, including anti-aliasing (smooth edges), complex text layout, support for various font features (like ClearType), and the ability to draw text along paths. GR32's text rendering is generally more basic and often relies on underlying OS functions, requiring more manual effort for advanced typography.
Built-in Image Codec Support: GDI+ provides native support for reading and writing a wide variety of common image file formats, such as JPEG, PNG, GIF, TIFF, BMP, and more, directly through its API. This simplifies loading and saving images. GR32 typically requires external libraries or components to handle complex image file formats, as its core focus is on in-memory bitmap manipulation rather than file I/O for diverse formats.
Device Independence and Printing: GDI+ is designed to work seamlessly across different output devices, including screens, printers, and plotters. It provides a consistent drawing model regardless of the target device. While GR32 can draw to bitmaps that can then be displayed or printed, GDI+ offers more direct and integrated support for printing and device contexts.
Richer Set of Drawing Primitives and Transformations: GDI+ offers a broader range of drawing primitives, including advanced gradient brushes, texture brushes, and complex paths. It also provides built-in geometric transformations (scaling, rotation, translation, shearing) that can be applied to the entire drawing surface or specific objects with ease. While GR32 can achieve some similar effects, it often requires more manual implementation or mathematical calculations.
Integration with the Windows Operating System: As a fundamental part of the Windows API, GDI+ is deeply integrated into the operating system's drawing infrastructure. This makes it the standard choice for general-purpose graphics in Windows applications, ensuring compatibility with various Windows features and accessibility options.
ONiX
Site Admin
Posts: 80
Joined: Tue Nov 18, 2025 1:27 am

DXGDIPlus Tutorial

Post by ONiX »

Overview
These tutorial units provide a beginner-friendly introduction to the DXGDI+ library for Delphi 7. The code is designed to be educational and demonstrates the fundamentals of GDI+ graphics programming.

* Each tutorial section includes comments highlighting differences from C++ GDI+

Mine DXGDI+ Variance:
1. Wraps the complex flat API into beginner-friendly procedures
2. Adds helper functions like MakeColor, MakeRectF for convenience
3. Provides predefined color constants (aclBlue, aclRed, etc.)
4. Includes automatic GDI+ initialization in the DXGDIPlusInit unit

Tutorial 1: Drawing Basic Shapes
Creating Graphics objects from HDC
Creating pens and brushes
Drawing rectangles, ellipses
Filling shapes
Proper cleanup procedures
(C) 2025 by Brain Patchwork DX, LLC.
(C) 2025 by Brain Patchwork DX, LLC.
2025-12-29_14-58.png (6.37 KiB) Viewed 670 times
(C) 2025 by Brain Patchwork DX, LLC.
(C) 2025 by Brain Patchwork DX, LLC.
2025-12-29_15-00.png (23 KiB) Viewed 670 times
ONiX
Site Admin
Posts: 80
Joined: Tue Nov 18, 2025 1:27 am

Re: DXGDI+

Post by ONiX »

Tutorial 2: Working with Colors
Creating custom colors with alpha transparency
Using ARGB format
Predefined color constants
Creating gradient effects with alpha blending
(C) 2025 by Brain Patchwork DX, LLC.
(C) 2025 by Brain Patchwork DX, LLC.
2025-12-29_15-16.png (6.5 KiB) Viewed 670 times
(C) 2025 by Brain Patchwork DX, LLC.
(C) 2025 by Brain Patchwork DX, LLC.
2025-12-29_15-20.png (22.42 KiB) Viewed 670 times
ONiX
Site Admin
Posts: 80
Joined: Tue Nov 18, 2025 1:27 am

Re: DXGDI+

Post by ONiX »

Tutorial 3: Using Pens and Brushes
Various pen styles (solid, dashed, dotted)
Line cap styles
Hatch brushes with patterns
Anti-aliasing for smooth lines
(C) 2025 by Brain Patchwork DX, LLC.
(C) 2025 by Brain Patchwork DX, LLC.
2025-12-29_15-25.png (9.24 KiB) Viewed 670 times
(C) 2025 by Brain Patchwork DX, LLC.
(C) 2025 by Brain Patchwork DX, LLC.
2025-12-29_15-29.png (23.28 KiB) Viewed 670 times
ONiX
Site Admin
Posts: 80
Joined: Tue Nov 18, 2025 1:27 am

Re: DXGDI+

Post by ONiX »

Tutorial 4: Drawing Text
Creating font families and fonts
Drawing text at specific locations
String formatting (alignment, centering)
Text rendering hints for quality
(C) 2025 by Brain Patchwork DX, LLC.
(C) 2025 by Brain Patchwork DX, LLC.
2025-12-29_16-40.png (9.41 KiB) Viewed 670 times
(C) 2025 by Brain Patchwork DX, LLC.
(C) 2025 by Brain Patchwork DX, LLC.
2025-12-29_16-43.png (26.37 KiB) Viewed 670 times
ONiX
Site Admin
Posts: 80
Joined: Tue Nov 18, 2025 1:27 am

Re: DXGDI+

Post by ONiX »

Tutorial 5: Working with Paths
Creating and building paths
Adding shapes to paths
Bezier curves
Drawing and filling paths
(C) 2025 by Brain Patchwork DX, LLC.
(C) 2025 by Brain Patchwork DX, LLC.
2025-12-29_16-48.png (12.68 KiB) Viewed 670 times
(C) 2025 by Brain Patchwork DX, LLC.
(C) 2025 by Brain Patchwork DX, LLC.
2025-12-29_16-50.png (21.53 KiB) Viewed 670 times
ONiX
Site Admin
Posts: 80
Joined: Tue Nov 18, 2025 1:27 am

Re: DXGDI+

Post by ONiX »

Tutorial 6: Matrix Transformations
Rotation transformations
Scaling operations
Translation (movement)
Matrix operations for complex transforms
(C) 2025 by Brain Patchwork DX, LLC.
(C) 2025 by Brain Patchwork DX, LLC.
2025-12-29_16-55.png (6.4 KiB) Viewed 670 times
(C) 2025 by Brain Patchwork DX, LLC.
(C) 2025 by Brain Patchwork DX, LLC.
2025-12-29_16-57.png (22.37 KiB) Viewed 670 times
ONiX
Site Admin
Posts: 80
Joined: Tue Nov 18, 2025 1:27 am

Re: DXGDI+

Post by ONiX »

Tutorial 7: Image Loading and Drawing
Demonstrates how to load images from files (e.g., PNG, JPEG).
Drawing images at their original size, scaled to a new size, and drawing portions of an image.
Important: The example uses a placeholder path 'C:\Temp\ExampleImage.png' that MUST be changed by the user to a valid image file on their system.
(C) 2025 by Brain Patchwork DX, LLC.
(C) 2025 by Brain Patchwork DX, LLC.
2025-12-29_17-35.png (290.41 KiB) Viewed 625 times
(C) 2025 by Brain Patchwork DX, LLC.
(C) 2025 by Brain Patchwork DX, LLC.
2025-12-29_18-16.png (33.08 KiB) Viewed 625 times
Post Reply