Skip to content

Conversation

@jblang
Copy link
Member

@jblang jblang commented Dec 4, 2025

Starting with zoomd.h, I'm replacing the repeated inclusion of these *d.h with C++ templated functions. This is easier to understand and more typesafe than using macros.

Replace repeated inclusion of zoomd.h with different preprocessor defines
with a modern template-based approach. All zoom functions (calcline,
calccolumn, dosymmetry2, fillline) are now templates in the tpl namespace,
instantiated for each pixel depth (8, 16, 24, 32-bit).

This eliminates macro-based code generation while maintaining the same
functionality and performance. The new pixel_traits.h header provides
type-safe pixel operations for all supported color depths.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@jblang jblang changed the base branch from master to algodoc December 4, 2025 03:48
jblang and others added 11 commits December 3, 2025 21:58
Converts the 3D pseudo-stereoscopic filter from preprocessor-based
code generation to modern C++ templates. Functions convert_3d,
convertup_3d, and do_3d are now templates in the tpl namespace,
using PixelTraits for type-safe pixel operations across different
bit depths (8, 16, 24, and 32 bpp).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Converts the boundary trace algorithm from preprocessor-based code
generation to modern C++ templates. Functions tracecolor, tracepoint,
queue, bfill, and dosymmetries are now templates in the tpl namespace,
using PixelTraits for type-safe pixel operations across different
bit depths (8, 16, 24, and 32 bpp).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Converts the edge detection filter from preprocessor-based code
generation to modern C++ templates. The do_edge function is now a
template in the tpl namespace, using PixelTraits for type-safe pixel
operations across different bit depths (8, 16, 24, and 32 bpp).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Converts the second edge detection filter from preprocessor-based code
generation to modern C++ templates. The do_edge2 function is now a
template in the tpl namespace, using PixelTraits for type-safe pixel
operations across different bit depths (8, 16, 24, and 32 bpp).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Converts the palette emulator filter from preprocessor-based code
generation to modern C++ templates. The cpalette function is now a
template in the tpl namespace, using PixelTraits for type-safe pixel
operations across different bit depths (8, 16, 24, and 32 bpp).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Converts the image rotation filter from preprocessor-based code
generation to modern C++ templates. The do_rotate function is now a
template in the tpl namespace, using PixelTraits for type-safe pixel
operations across different bit depths (8, 16, 24, and 32 bpp).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Converts the starfield filter from preprocessor-based code generation
to modern C++ templates. The do_starfield function is now a template
in the tpl namespace, using PixelTraits for type-safe pixel operations
across different bit depths (8, 16, 24, and 32 bpp).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Converts the random dot stereogram filter from preprocessor-based code
generation to modern C++ templates. The do_stereogram function is now a
template in the tpl namespace, using PixelTraits for type-safe pixel
operations across different bit depths (8, 16, 24, and 32 bpp).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Converted grlibd.h to use type-safe C++ templates with PixelTraits parameter,
replacing the old preprocessor-based approach of repeated includes with different
macros for each pixel depth. Updated image.cpp to use template instantiations
via #define aliases for backward compatibility.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
…ssor

Converted autod.h to use type-safe C++ templates with PixelTraits parameter,
replacing the old preprocessor-based approach of repeated includes with different
macros for each pixel depth. Updated autopilot.cpp to use direct template
instantiations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Merged all remaining *d.h template header files into their corresponding
.cpp implementation files:
- btraced.h → btrace.cpp (boundary trace templates)
- edge2d.h → edge2.cpp (edge detection algorithm 2)
- edged.h → edge.cpp (edge detection algorithm 1)
- paletted.h → palettef.cpp (palette conversion)
- rotated.h → rotate.cpp (image rotation)
- stard.h → star.cpp (starfield effect)
- stereod.h → stereogram.cpp (random dot stereogram)
- zoomd.h → zoom.cpp (zoom with solid guessing)
- 3dd.h → 3d.cpp (3D rendering)

All template functions now reside inline within the tpl namespace in their
respective .cpp files. Updated engine.pri to remove all deleted header
files. Build tested and verified.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@jblang jblang changed the title Claude template Replace preprocessor abuse with templates for pixel depth-specific functions Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants