mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-18 09:04:37 -04:00
Remove spaces before EOL
This commit is contained in:
parent
45441a6da7
commit
31cc0ae78a
70 changed files with 906 additions and 844 deletions
|
@ -8,14 +8,14 @@
|
|||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the project nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
|
@ -26,7 +26,7 @@
|
|||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
@ -61,19 +61,19 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||
uint32_t* strip_offset;
|
||||
uint32_t* strip_bytes;
|
||||
#endif
|
||||
|
||||
|
||||
tiff_header_t header;
|
||||
tiff_ifd_t ifd;
|
||||
uint16_t temp;
|
||||
uint32_t temp32;
|
||||
|
||||
|
||||
fgred = (16 * ctoi(symbol->fgcolour[0])) + ctoi(symbol->fgcolour[1]);
|
||||
fggrn = (16 * ctoi(symbol->fgcolour[2])) + ctoi(symbol->fgcolour[3]);
|
||||
fgblu = (16 * ctoi(symbol->fgcolour[4])) + ctoi(symbol->fgcolour[5]);
|
||||
bgred = (16 * ctoi(symbol->bgcolour[0])) + ctoi(symbol->bgcolour[1]);
|
||||
bggrn = (16 * ctoi(symbol->bgcolour[2])) + ctoi(symbol->bgcolour[3]);
|
||||
bgblu = (16 * ctoi(symbol->bgcolour[4])) + ctoi(symbol->bgcolour[5]);
|
||||
|
||||
|
||||
rows_per_strip = 8192 / (symbol->bitmap_width * 3);
|
||||
if (rows_per_strip == 0) {
|
||||
rows_per_strip = 1;
|
||||
|
@ -83,7 +83,7 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||
if ((symbol->bitmap_height % rows_per_strip) != 0) {
|
||||
strip_count++;
|
||||
}
|
||||
|
||||
|
||||
#ifndef _MSC_VER
|
||||
uint32_t strip_offset[strip_count];
|
||||
uint32_t strip_bytes[strip_count];
|
||||
|
@ -92,7 +92,7 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||
strip_bytes = (uint32_t*) _alloca(strip_count * sizeof(uint32_t));
|
||||
#endif
|
||||
free_memory = 8;
|
||||
|
||||
|
||||
for(i = 0; i < strip_count; i++) {
|
||||
strip_offset[i] = free_memory;
|
||||
if (i != (strip_count - 1)) {
|
||||
|
@ -109,7 +109,7 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||
free_memory++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (free_memory > 0xffff0000) {
|
||||
#ifdef _MSC_VER
|
||||
free(strip_offset);
|
||||
|
@ -134,15 +134,15 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||
return ZINT_ERROR_FILE_ACCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Header */
|
||||
header.byte_order = 0x4949;
|
||||
header.identity = 42;
|
||||
header.offset = free_memory;
|
||||
|
||||
|
||||
fwrite(&header, sizeof(tiff_header_t), 1, tif_file);
|
||||
free_memory += sizeof(tiff_ifd_t);
|
||||
|
||||
|
||||
/* Pixel data */
|
||||
for (row = 0; row < symbol->bitmap_height; row++) {
|
||||
for (column = 0; column < symbol->bitmap_width; column++) {
|
||||
|
@ -164,126 +164,126 @@ int tif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Image File Directory */
|
||||
|
||||
/* Image File Directory */
|
||||
ifd.entries = 14;
|
||||
ifd.offset = 0;
|
||||
|
||||
|
||||
ifd.new_subset.tag = 0xfe;
|
||||
ifd.new_subset.type = 4;
|
||||
ifd.new_subset.count = 1;
|
||||
ifd.new_subset.offset = 0;
|
||||
|
||||
|
||||
ifd.image_width.tag = 0x0100;
|
||||
ifd.image_width.type = 3; // SHORT
|
||||
ifd.image_width.count = 1;
|
||||
ifd.image_width.offset = symbol->bitmap_width;
|
||||
|
||||
|
||||
ifd.image_length.tag = 0x0101;
|
||||
ifd.image_length.type = 3; // SHORT
|
||||
ifd.image_length.count = 1;
|
||||
ifd.image_length.offset = symbol->bitmap_height;
|
||||
|
||||
|
||||
ifd.bits_per_sample.tag = 0x0102;
|
||||
ifd.bits_per_sample.type = 3; // SHORT
|
||||
ifd.bits_per_sample.count = 3;
|
||||
ifd.bits_per_sample.offset = free_memory;
|
||||
free_memory += 6;
|
||||
|
||||
|
||||
ifd.compression.tag = 0x0103;
|
||||
ifd.compression.type = 3;
|
||||
ifd.compression.count = 1;
|
||||
ifd.compression.offset = 1; // Uncompressed
|
||||
|
||||
|
||||
ifd.photometric.tag = 0x0106;
|
||||
ifd.photometric.type = 3; // SHORT
|
||||
ifd.photometric.count = 1;
|
||||
ifd.photometric.offset = 2; // RGB Model
|
||||
|
||||
|
||||
ifd.strip_offsets.tag = 0x0111;
|
||||
ifd.strip_offsets.type = 4; // LONG
|
||||
ifd.strip_offsets.count = strip_count;
|
||||
ifd.strip_offsets.offset = free_memory;
|
||||
free_memory += strip_count * 4;
|
||||
|
||||
|
||||
ifd.samples_per_pixel.tag = 0x0115;
|
||||
ifd.samples_per_pixel.type = 3;
|
||||
ifd.samples_per_pixel.count = 1;
|
||||
ifd.samples_per_pixel.offset = 3;
|
||||
|
||||
|
||||
ifd.rows_per_strip.tag = 0x0116;
|
||||
ifd.rows_per_strip.type = 4;
|
||||
ifd.rows_per_strip.count = 1;
|
||||
ifd.rows_per_strip.offset = rows_per_strip;
|
||||
|
||||
|
||||
ifd.strip_byte_counts.tag = 0x0117;
|
||||
ifd.strip_byte_counts.type = 4;
|
||||
ifd.strip_byte_counts.count = strip_count;
|
||||
ifd.strip_byte_counts.offset = free_memory;
|
||||
free_memory += strip_count * 4;
|
||||
|
||||
|
||||
ifd.x_resolution.tag = 0x011a;
|
||||
ifd.x_resolution.type = 5;
|
||||
ifd.x_resolution.count = 1;
|
||||
ifd.x_resolution.offset = free_memory;
|
||||
free_memory += 8;
|
||||
|
||||
|
||||
ifd.y_resolution.tag = 0x011b;
|
||||
ifd.y_resolution.type = 5;
|
||||
ifd.y_resolution.count = 1;
|
||||
ifd.y_resolution.offset = free_memory;
|
||||
// free_memory += 8;
|
||||
|
||||
|
||||
ifd.planar_config.tag = 0x11c;
|
||||
ifd.planar_config.type = 3;
|
||||
ifd.planar_config.count = 1;
|
||||
ifd.planar_config.offset = 1;
|
||||
|
||||
|
||||
ifd.resolution_unit.tag = 0x0128;
|
||||
ifd.resolution_unit.type = 3;
|
||||
ifd.resolution_unit.count = 1;
|
||||
ifd.resolution_unit.offset = 2; // Inches
|
||||
|
||||
|
||||
fwrite(&ifd, sizeof(tiff_ifd_t), 1, tif_file);
|
||||
|
||||
|
||||
/* Bits per sample */
|
||||
temp = 8;
|
||||
fwrite(&temp, 2, 1, tif_file); // Red Bytes
|
||||
fwrite(&temp, 2, 1, tif_file); // Green Bytes
|
||||
fwrite(&temp, 2, 1, tif_file); // Blue Bytes
|
||||
|
||||
|
||||
/* Strip offsets */
|
||||
for(i = 0; i < strip_count; i++) {
|
||||
fwrite(&strip_offset[i], 4, 1, tif_file);
|
||||
}
|
||||
|
||||
|
||||
/* Strip byte lengths */
|
||||
for(i = 0; i < strip_count; i++) {
|
||||
fwrite(&strip_bytes[i], 4, 1, tif_file);
|
||||
}
|
||||
|
||||
|
||||
/* X Resolution */
|
||||
temp32 = 72;
|
||||
fwrite(&temp32, 4, 1, tif_file);
|
||||
temp32 = 1;
|
||||
fwrite(&temp32, 4, 1, tif_file);
|
||||
|
||||
|
||||
/* Y Resolution */
|
||||
temp32 = 72;
|
||||
fwrite(&temp32, 4, 1, tif_file);
|
||||
temp32 = 1;
|
||||
fwrite(&temp32, 4, 1, tif_file);
|
||||
|
||||
|
||||
if (symbol->output_options & BARCODE_STDOUT) {
|
||||
fflush(tif_file);
|
||||
} else {
|
||||
fclose(tif_file);
|
||||
}
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
free(strip_offset);
|
||||
free(strip_bytes);
|
||||
#endif
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue