Skip to content

feat(bitimage): implement ESC/POS commands for bit images#45

Merged
adcondev merged 3 commits intomasterfrom
feat/bitimage
Oct 23, 2025
Merged

feat(bitimage): implement ESC/POS commands for bit images#45
adcondev merged 3 commits intomasterfrom
feat/bitimage

Conversation

@adcondev
Copy link
Copy Markdown
Owner

@adcondev adcondev commented Oct 23, 2025

Add functionality for handling bit image printing and graphics data management in thermal receipt printers. This includes commands for selecting bit image modes, defining non-volatile bit images, and printing downloaded bit images.

  • Introduce new commands for bit image operations
  • Enhance support for various image formats and scaling modes
  • Improve error handling for image dimensions and data validation

Descripción

Tipo de cambio

  • 🐛 Bug fix
  • ✨ Nueva funcionalidad
  • 📚 Solo documentación
  • 🔧 Configuración
  • ♻️ Refactoring
  • 📦 Dependencias

¿Cómo se ha probado?

  • Tests automáticos pasan
  • Probado manualmente
  • N/A (solo docs/config)

Checklist

  • El código sigue las convenciones del proyecto
  • Los tests pasan localmente
  • He actualizado la documentación si era necesario

Notas adicionales

This pull request introduces the initial implementation of the escpos/bitimage package, which provides ESC/POS bit image and graphics functionality for thermal receipt printers. The changes establish core types, constants, error handling, interface definitions, and validation logic for bit image commands, downloaded graphics, and related data structures. The implementation is modular and includes comprehensive validation helpers for image modes, dimensions, and color data.

Core bit image functionality:

  • Added the main bitimage.go file, defining types (Mode, PrintMode, NVBitImageData), constants for image size limits, error variables, and the Capability interface for bit image operations, along with validation and helper functions.
  • Created the package-level documentation in doc.go to describe the purpose and scope of the bitimage package.

Download graphics support:

  • Added download_graphics.go with types (DLFunctionCode, DLGraphicsColorData), constants for download graphics limits, error variables, and the DownloadGraphicsCapability interface for managing graphics in volatile memory, including validation helpers for color data and dimensions.

Add functionality for handling bit image printing and graphics
data management in thermal receipt printers. This includes
commands for selecting bit image modes, defining non-volatile
bit images, and printing downloaded bit images.

- Introduce new commands for bit image operations
- Enhance support for various image formats and scaling modes
- Improve error handling for image dimensions and data validation

Signed-off-by: Adrián Constante <ad_con.reload@proton.me>
@adcondev adcondev self-assigned this Oct 23, 2025
Copilot AI review requested due to automatic review settings October 23, 2025 23:02
@github-actions
Copy link
Copy Markdown
Contributor

👋 Thanks for opening this PR, @adcondev!

Here's what will happen next:

  • 🤖 Automated checks will run
  • 🏷️ Labels will be added automatically
  • 👀 A maintainer will review your changes

Please make sure:

  • ✅ All tests pass
  • 📝 The PR title follows conventional commits
  • 📋 The PR template is filled out completely

@github-actions github-actions Bot added documentation Improvements or additions to documentation size/XL labels Oct 23, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements ESC/POS commands for bit image and graphics functionality in thermal receipt printers. The changes introduce comprehensive support for managing bit images, graphics data in volatile and non-volatile memory, including definition, deletion, printing, and capacity management operations.

Key changes:

  • Added bit image command implementations for legacy modes and deprecated NV/downloaded bit images
  • Introduced NV graphics commands for persistent storage with multiple format support (raster/column)
  • Implemented download graphics commands for volatile memory operations with capacity management

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
escpos/shared/utils.go Added 32-bit little-endian conversion utility for extended command formats
escpos/bitimage/doc.go Package documentation describing bit image and graphics functionality
escpos/bitimage/bitimage.go Core types, constants, error definitions, and validation helpers for bit images
escpos/bitimage/bitimage_commands.go Legacy and deprecated bit image command implementations (ESC *, FS p/q, GS *, GS /, GS Q, GS v)
escpos/bitimage/graphics.go Graphics command types, constants, and validation for dot density and buffer operations
escpos/bitimage/graphics_commands.go Graphics buffer commands for raster/column formats with standard and extended sizes
escpos/bitimage/nv_graphics.go NV graphics types, constants, errors, and validation helpers for persistent storage
escpos/bitimage/nv_graphics_commands.go NV graphics operations including capacity queries, data management, and BMP conversion
escpos/bitimage/download_graphics.go Download graphics types, validation, and helper functions for volatile memory
escpos/bitimage/download_graphics_commands.go Download graphics commands for temporary storage with key code management

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread escpos/shared/utils.go Outdated
adcondev and others added 2 commits October 23, 2025 16:03
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Adrián Constante <ad_con.reload@proton.me>
- Implement tests for download graphics commands, including validation functions and error handling.
- Add integration tests for various graphics workflows, ensuring correct command generation and handling of large data.
- Validate graphics dimensions and key codes to ensure robustness in functionality.

Signed-off-by: Adrián Constante <ad_con.reload@proton.me>
@github-actions github-actions Bot added the tests label Oct 23, 2025
@adcondev adcondev merged commit 1b98b1f into master Oct 23, 2025
11 checks passed
@adcondev adcondev deleted the feat/bitimage branch October 23, 2025 23:15
@adcondev adcondev mentioned this pull request Oct 23, 2025
1 task
@adcondev adcondev linked an issue Oct 23, 2025 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/XL tests

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Feature]: add bit image commands to escpos package

2 participants