P4 Software
/
BarcoderX English
Applies to: BarcoderX Basic and Ultimate
Status: Built, not yet released. The PNG writer, and the PNG renderer that draws the result of the label engine and saves it as a PNG file, exist and are tested, but nothing is released yet and there is nothing to download. They are libraries inside the engine that is still being built. There is no released package, and the licensed engine will be the only public way to produce output. The PNG writer cannot be called on its own. The PNG renderer takes only the result of the label engine, and the label service runs the engine and the renderer together: see The label service. This page says what is built and what is not.
PNG is the picture format BarcoderX uses for previews, web pages and any other use where you need a picture of a label. See Output formats for the other formats. This page describes two parts. The first is the PNG renderer, which draws a label and saves it as a PNG file. The second is the PNG writer itself: the part that takes the pixels of a picture and writes a valid PNG file.
BarcoderX writes the PNG file with its own code. The only part it takes from .NET is the compression of the picture data.
Between the label engine and the PNG writer there is the PNG renderer. It draws the list of drawing steps of one label on a surface and saves the surface as a PNG file. See The label engine for the list of drawing steps and Drawing shapes for the surfaces. You give it the whole result of the label engine, the kind of picture you want and a time limit. The limits are set when the renderer is created. It gives back the PNG file, or messages that say why there is none. It accepts nothing else: the list of drawing steps is not public, and so no program can draw something that the engine did not make.
| Kind of picture | What it is for |
|---|---|
| Black and white, 1 bit | What a printer would get. There are no grays and no smoothing: a dot is black or white. |
| Gray | A picture in 256 grays. |
| Color | A preview for a screen. The page is opaque white. A transparent page is planned. |
BarcoderX checks every limit before it spends the resource it protects. The program that uses the renderer sets every limit when it creates it. None has a default that the renderer would use behind the program's back, and a limit that cannot be used is refused with BX3700 at the first drawing. A label never sets its own limits.
| Limit | Set by the program | Highest the renderer accepts |
|---|---|---|
| Pixels of a black-and-white picture, of a gray picture and of a color picture | Three figures | 256,000,000 each |
| Longest side of a surface | The drawing limits of the label | 262,144 pixels |
| Path segments in one path | The drawing limits of the label | 4,000,000 |
| Size of one PNG file | One figure | 2,000,000,000 bytes |
| Resolution | A lowest and a highest | None above what the engine draws (96 to 1,200 dots per inch) |
| Labels drawn at the same time | One number, at least 1 | None |
The other drawing limits are the ones on Drawing shapes. The label service sets these figures from its settings file: see The label service. The highest values are the figures that the plan sets for the output of a whole job, 256 MB and 2 GB, applied to one file. A single label should in practice have a much lower limit, and there is no figure for one label yet. How the job figures are applied to one file is a first choice that the builders made (builder's choice, owner confirmation pending). It has not been confirmed yet and can change before the first release.
When a program is already drawing the number of labels it allows, the next one is refused at once with BX3707 and is not queued. A program can work out how many labels it can draw at once from its memory and from the limits. With the limits proposed for a public demo page (see The label engine), one color label is estimated to need about 135 MB. About 88 MB were measured.
You give the writer the pixels of a picture, its width and height, and which kind of pixels they are. These kinds are accepted:
| Kind of picture | What each pixel holds |
|---|---|
| Color with transparency | Red, green, blue and opacity, 8 bits each. Opacity is "straight": the color is not already multiplied by it. If your pixels are premultiplied, convert them first. |
| Color | Red, green and blue, 8 bits each. |
| Gray | One 8-bit value, 0 is black. |
| Black and white, 1 bit | Eight pixels to a byte, the leftmost pixel in the highest bit, each row padded to a whole byte. You can give it in either of two conventions: where 1 means black (the convention of a label bitmap), or where 1 means white (the convention of PNG itself). The file always follows the PNG convention. |
| Palette | An 8-bit number for each pixel that points into a palette of 1 to 256 colors. Each palette color can have its own opacity. The writer stores the numbers at the smallest size that holds the palette: 1, 2, 4 or 8 bits. |
BarcoderX checks every limit before it allocates any memory, so a picture that is too large is refused at once, not after the computer has run out of memory.
| Limit | Value |
|---|---|
| Pixels in one picture | 64,000,000 (64 million) by default. The program that calls the writer can set a different limit. |
| Width and height | At least 1 and at most 2,147,483,647 each, as the PNG standard requires. The pixel limit is reached long before that. |
| Palette | 1 to 256 colors. A palette is allowed only with palette pictures, and every pixel must point to a color that is in it. |
| Resolution | A positive, finite number of dots per inch. |
| Length of the pixel data | Must match the width, height and kind of picture exactly. |
A picture that breaks a limit is not written. The writer reports a clear reason, with a diagnostic code from 3100 to 3106. See Diagnostic codes. A running job can also be canceled between rows.
In BarcoderX's automatic tests, the PNG files for ten test cases are identical, byte for byte, on Windows x64, Linux x64 and Linux arm64. The cases use six pictures, five small ones and one of about 600 KB before compression, some of them at several compression levels.
Read this with care:
The part that BarcoderX writes itself, the prepared rows before compression, is tested on every platform and does not depend on .NET.
BarcoderX is a product of P4 Software.
Was this page helpful?