feat(bitimage): implement ESC/POS commands for bit images#45
Merged
feat(bitimage): implement ESC/POS commands for bit images#45
Conversation
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>
Contributor
|
👋 Thanks for opening this PR, @adcondev! Here's what will happen next:
Please make sure:
|
Contributor
There was a problem hiding this comment.
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.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Descripción
Tipo de cambio
¿Cómo se ha probado?
Checklist
Notas adicionales
This pull request introduces the initial implementation of the
escpos/bitimagepackage, 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:
bitimage.gofile, defining types (Mode,PrintMode,NVBitImageData), constants for image size limits, error variables, and theCapabilityinterface for bit image operations, along with validation and helper functions.doc.goto describe the purpose and scope of thebitimagepackage.Download graphics support:
download_graphics.gowith types (DLFunctionCode,DLGraphicsColorData), constants for download graphics limits, error variables, and theDownloadGraphicsCapabilityinterface for managing graphics in volatile memory, including validation helpers for color data and dimensions.