CGE Project Modernization Summary

February 25, 2026 · View on GitHub

Scope of Changes

This modernization effort upgraded a 10+ year old Qt5/QMake project to a modern Qt6/CMake project, including code structure reorganization, build system migration, and documentation improvements.

Key Improvements

1. Code Structure Reorganization

Before: Source files and headers scattered across multiple directories, messy structure

src/
├── common/          # Core functionality
├── filters/         # Filter implementations
├── demo/            # Slideshow demos
├── extend/          # Extensions
├── extends/         # More extensions
└── include/         # Some header files

After: Clean include/src separation

include/cge/         # All public headers
├── core/            # Core functionality
├── filters/         # Filters
├── animation/       # Animation system
├── sprite/          # Sprite rendering
└── slideshow/       # Slideshow

src/                 # Implementation files (mirrors include structure)
├── core/
├── filters/
├── animation/
├── sprite/
├── slideshow/
└── extend/

2. Build System Modernization

Migrated from QMake to CMake:

  • Removed .pro and .pri files
  • Created modern CMakeLists.txt configuration
  • Used file(GLOB) to automatically collect source files
  • Supported build options:
    • BUILD_SHARED_LIBS: Build shared library (default: static library)
    • BUILD_FILTER_GENERATOR: Build filter generator app (default: ON)
    • CMAKE_BUILD_TYPE: Build type (Release/Debug)

Build artifacts:

  • Release: libcge.a (3.1 MB)
  • Debug: libcged.a (25 MB)
  • Shared library: libcge.dylib / libcge.so (optional)

3. Qt6 Compatibility

Core library Qt6 migration complete:

  • QGLFunctionsQOpenGLFunctions
  • QGLWidgetQOpenGLWidget
  • Added Qt version detection macros

filterGenerator app:

  • Qt6 migration complete
  • All deprecated APIs updated (QRegExpQRegularExpression, FBO binding, etc.)
  • Current status: fully functional, built by default

4. Project Naming Simplification

Renamed:

  • CGE4QTcge
  • libCGE4QT.alibcge.a
  • All related references updated

5. Documentation Improvements

New and updated docs:

  • README.md: Enhanced project overview, features, build instructions
  • BUILD.md: Detailed build documentation with platform-specific notes and troubleshooting
  • .gitignore: Updated for modern build tools

Technology Stack

  • Language: C++11
  • Framework: Qt6 (6.7.1+)
  • Build: CMake 3.16+
  • Graphics: OpenGL / OpenGL ES
  • Platforms: macOS, Linux, Windows

Feature Overview

Core Capabilities

  • 70+ built-in image filters
  • GPU-accelerated real-time processing
  • Animation system
  • Slideshow effects engine
  • 2D/3D sprite rendering

Filter Categories

  • Basic Adjustments: Brightness, contrast, saturation, exposure
  • Color Effects: Color balance, levels, curves, white balance
  • Blur Effects: Gaussian blur, bilateral blur, mosaic, motion blur
  • Beauty Filters: Skin smoothing, eye enlargement, skin whitening
  • Artistic Effects: Sketch, halftone, emboss, edge detection
  • Advanced Effects: Vignette, tilt-shift, haze, LUT

Build Instructions

macOS

export QTDIR=/Users/wysaid/Qt/6.7.1/macos
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . -j8

Linux

sudo apt-get install qt6-base-dev qt6-opengl-dev
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . -j8

Windows

set QTDIR=C:\Qt\6.7.1\msvc2019_64
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .

Usage Examples

Basic Usage

#include "cge.h"

CGE::CGEImageHandler handler;
handler.initWithQImage(&image);

CGE::CGEBrightnessFilter* filter = new CGE::CGEBrightnessFilter();
filter->setIntensity(0.5f);
handler.addFilter(filter);

handler.processingFilters();
QImage result = handler.getResultImage();

Integration into a Project

find_package(cge REQUIRED)
target_link_libraries(your_app PRIVATE CGE::cge)

Known Issues

1. filterGenerator App

  • Status: Functional, built by default
  • Qt6 migration complete: all deprecated APIs updated

2. Shared Library (macOS)

  • Problem: Link error "framework 'AGL' not found"
  • Reason: AGL (Apple OpenGL Layer) is deprecated
  • Status: Static library fully functional; shared library optional
  • Recommendation: Use static library (default)

3. OpenGL Deprecation Warnings

  • Warning: macOS 10.14+ marks OpenGL as deprecated
  • Impact: 42 compile warnings; does not affect functionality
  • Future: May need to migrate to Metal or Vulkan

Test Results

Compilation Tests

  • ✅ macOS (Apple Silicon & Intel): Static library builds successfully
  • ✅ Release build: libcge.a (3.1 MB)
  • ✅ Debug build: libcged.a (25 MB)
  • ⚠️ Shared library: macOS link fails; Linux/Windows untested

Functionality Tests

  • ✅ Core library Qt6 compatibility
  • ✅ Basic filter functionality
  • ✅ filterGenerator app: Qt6 migration complete

Future Improvement Suggestions

Short-term (Necessary)

  1. Fix shared library build
    • Remove or conditionally link AGL framework
    • Test on Linux and Windows

Medium-term (Optimization)

  1. Add unit tests

    • Filter functionality tests
    • Image processing pipeline tests
    • Performance benchmarks
  2. Improve documentation

    • API reference documentation (Doxygen)
    • More usage examples
    • Performance tuning guide
  3. Enhance CMake configuration

    • Add find_package support
    • Create Config.cmake file
    • Support FetchContent

Long-term (Exploration)

  1. Modern graphics APIs

    • Consider supporting Metal (macOS/iOS)
    • Consider supporting Vulkan (cross-platform)
  2. Language bindings

    • Python bindings
    • JavaScript/Node.js bindings
  3. Performance optimizations

    • SIMD optimizations
    • Multi-threaded processing
    • GPU compute (Compute Shader)

Migration Checklist

  • Code structure reorganization (src/ and include/ separation)
  • CMake build system
  • Qt6 core library compatibility
  • Project rename (CGE4QT → cge)
  • Documentation updates (README, BUILD.md)
  • Static library build
  • Example programs
  • .gitignore update
  • filterGenerator full Qt6 migration
  • Shared library build fix
  • Cross-platform testing
  • API documentation generation
  • Unit tests

Project Scale

  • Source files: 140+ .cpp files
  • Header files: 140+ .h files
  • Number of filters: 70+
  • Lines of code: ~30,000+
  • Build artifact: 3.1 MB (Release)
  • Compile time: ~20 seconds (-j8)

Contributors

  • Original Author: Wang Yang (wysaid)
  • Modernization: 2024

Documentation generated: 2024