ext/rqr/qr_draw_tiff.cpp in z-rqr-0.2.3 vs ext/rqr/qr_draw_tiff.cpp in z-rqr-0.2.4

- old
+ new

@@ -1,34 +1,7 @@ #include "qr_draw_tiff.h" -//================================================================================= -// QRDrawPNG::QRDrawPNG -//================================================================================= -QRDrawTIFF::QRDrawTIFF() -{ -#ifdef USE_TIFF - bit_image = NULL; -#endif -} - -//================================================================================= -// QRDrawTIFF::~QRDrawTIFF -//================================================================================= -QRDrawTIFF::~QRDrawTIFF() -{ -#ifdef USE_TIFF - int i; - - if(bit_image){ - for(i=0; i<this->rsize; i++){ - free(bit_image[i]); - } - free(bit_image); - } -#endif -} - //============================================================================= // QRDrawPNG::draw //============================================================================= int QRDrawTIFF::draw(char *filename, int modulesize, int symbolsize, unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE], void *opt) @@ -51,24 +24,24 @@ int QRDrawTIFF::raster(unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE]) { #ifdef USE_TIFF int bitw = (int)ceil(this->rsize/8) + 1; - /* 実際にデータを置く領域を確保 */ + /* ۂɃf[^üm */ bit_image = (unsigned char **)malloc(sizeof(unsigned char *) * this->rsize); for(int i=0; i<this->rsize; i++){ bit_image[i] = (unsigned char *)malloc(bitw); memset(bit_image[i], 0, bitw); } for(int i=0; i<this->ssize; i++){ - int dp = MARGIN_SIZE*this->msize / 8; //横方向のバイト位置 - int sht =(MARGIN_SIZE*this->msize % 8) ? 3 : 7; //ビットシフト - unsigned char c = 0; //1バイトの構成を保存 + int dp = MARGIN_SIZE*this->msize / 8; //̃oCgʒu + int sht =(MARGIN_SIZE*this->msize % 8) ? 3 : 7; //rbgVtg + unsigned char c = 0; //1oCg̍\ۑ for(int j=0; j<this->ssize; j++){ - /* 1行分生成 */ + /* 1s */ for(int k=0; k<this->msize; k++){ c += (data[j][i] << sht); sht--; bit_image[(i+MARGIN_SIZE)*this->msize][ dp ] = c; @@ -78,11 +51,11 @@ c = 0; dp++; } } } - /* モジュールサイズ分縦方向に増やす */ + /* W[TCYcɑ₷ */ for(int k=1; k<this->msize; k++){ memcpy(bit_image[(i+MARGIN_SIZE)*this->msize+k], bit_image[(i+MARGIN_SIZE)*this->msize], bitw); } } @@ -102,24 +75,24 @@ int i; /* Open the TIFF file */ if( (tiff=TIFFOpen(this->filename, "w")) == NULL ) return(1); - /* タグ */ - TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, this->rsize); /* 幅(ピクセル数) */ - TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, this->rsize); /* 高(スキャンライン数) */ - TIFFSetField(tiff, TIFFTAG_COMPRESSION, COMPRESSION_NONE); /* 圧縮モード */ - TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 1); /* ピクセルの深さ */ - TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE); /* カラータイプ */ - TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 1); /* カラープレーン数 */ - TIFFSetField(tiff, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); /* スキャン方向 */ + /* ^O */ + TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, this->rsize); /* (sNZ) */ + TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, this->rsize); /* (XLC) */ + TIFFSetField(tiff, TIFFTAG_COMPRESSION, COMPRESSION_NONE); /* k[h */ + TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 1); /* sNZ̐[ */ + TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE); /* J[^Cv */ + TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 1); /* J[v[ */ + TIFFSetField(tiff, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); /* XL */ TIFFSetField(tiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); /* ? */ - TIFFSetField(tiff, TIFFTAG_XRESOLUTION, 72.0); /* 解像度 */ - TIFFSetField(tiff, TIFFTAG_YRESOLUTION, 72.0); /* 解像度 */ - TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); /* 解像度の単位(RESUNIT_INCH:インチ) */ - TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIP, this->rsize); /* 1ストリップに何行格納されるか */ + TIFFSetField(tiff, TIFFTAG_XRESOLUTION, 72.0); /* 𑜓x */ + TIFFSetField(tiff, TIFFTAG_YRESOLUTION, 72.0); /* 𑜓x */ + TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); /* 𑜓x̒P(RESUNIT_INCH:C`) */ + TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIP, this->rsize); /* 1Xgbvɉsi[邩 */ - /* 1行ずつ書き込み */ + /* 1s */ for(i=0 ; i<this->rsize ; i++){ if( TIFFWriteScanline(tiff, bit_image[i], i, 0) < 0 ){ TIFFClose(tiff); return(1); }