ext/rqr/qr_draw_ps.cpp in z-rqr-0.2.3 vs ext/rqr/qr_draw_ps.cpp in z-rqr-0.2.4
- old
+ new
@@ -1,14 +1,7 @@
#include "qr_draw_ps.h"
-//=================================================================================
-// QRDrawPS::QRDrawPS
-//=================================================================================
-QRDrawPS::QRDrawPS()
-{
-}
-
//=============================================================================
// QRDrawPS::draw
//=============================================================================
int QRDrawPS::draw(char *filename, int modulesize, int symbolsize,
unsigned char data[MAX_MODULESIZE][MAX_MODULESIZE], void *opt)
@@ -44,38 +37,38 @@
unsigned char lt[4];
struct stat st;
if((stream=fopen(this->filename, "wb")) == NULL) return(1);
- /* ダミーヘッダー書き込み */
+ /* _~[wb_[ */
this->write_header(stream);
- /* TIFF書き込み */
+ /* TIFF */
this->write_preview(stream, data);
fclose(stream);
- /* EPS書き込み */
+ /* EPS */
this->write(data, "a");
- /* EPSサイズ算出 */
+ /* EPSTCYZo */
stat(this->filename, &st);
unsigned int esize = st.st_size - (this->tsize+30);
- /* ヘッダー書き換え */
+ /* wb_[ */
if((stream=fopen(this->filename, "rb+")) == NULL) return(1);
- /* PS開始位置 */
+ /* PSJnʒu */
fseek(stream, 4, SEEK_SET);
this->littleEndian(30+this->tsize, lt);
fprintf(stream, "%c%c%c%c", lt[0], lt[1], lt[2], lt[3]);
- /* PS長 */
+ /* PS */
fseek(stream, 8, SEEK_SET);
this->littleEndian(esize, lt);
fprintf(stream, "%c%c%c%c", lt[0], lt[1], lt[2], lt[3]);
- /* TIFFプレビュー長 */
+ /* TIFFvr[ */
fseek(stream, 24, SEEK_SET);
this->littleEndian(this->tsize, lt);
fprintf(stream, "%c%c%c%c", lt[0], lt[1], lt[2], lt[3]);
fclose(stream);
@@ -91,31 +84,31 @@
//=============================================================================
void QRDrawPS::write_header(FILE *stream)
{
unsigned char lt[4];
- /* ナミモニ */
+ /* i~j */
fprintf(stream, "%c%c%c%c", 0xC5, 0xD0, 0xD3, 0xC6);
- /* PostScript開始位置 */
+ /* PostScriptJnʒu */
fprintf(stream, "%c%c%c%c", 0x00, 0x00, 0x00, 0x00);
- /* PostScript長さ */
+ /* PostScript */
fprintf(stream, "%c%c%c%c", 0x00, 0x00, 0x00, 0x00);
/* MetaFile */
fprintf(stream, "%c%c%c%c", 0x00, 0x00, 0x00, 0x00);
fprintf(stream, "%c%c%c%c", 0x00, 0x00, 0x00, 0x00);
- /* TIFFプレビュー開始位置 */
+ /* TIFFvr[Jnʒu */
littleEndian(30, lt);
fprintf(stream, "%c%c%c%c", lt[0], lt[1], lt[2], lt[3]);
- /* TIFFプレビュー長 */
+ /* TIFFvr[ */
fprintf(stream, "%c%c%c%c", 0x00, 0x00, 0x00, 0x00);
- /* チェックサム */
+ /* `FbNT */
fprintf(stream, "%c%c", 0xff, 0xff);
}
//=================================================================================
// littleEndian
@@ -140,20 +133,20 @@
unsigned char *p;
tmpnam(tmp);
if( tif.draw(tmp, this->msize, this->ssize, data, NULL) ) return(1);
- /* TIFFをオープンしてファイルサイズを取得する */
+ /* TIFFI[văt@CTCY擾 */
if((t=fopen(tmp, "rb")) == NULL){
remove(tmp);
return(1);
}
fseek(t, 0, SEEK_END);
this->tsize = ftell(t);
fseek(t, 0, SEEK_SET);
- /* TIFF本体の書き込み */
+ /* TIFF{̂̏ */
p = (unsigned char *)malloc(this->tsize);
fread(p, 1, this->tsize, t);
fwrite(p, 1, this->tsize, stream);
free(p);
@@ -207,10 +200,10 @@
fprintf(stream, "0 size margin 2 mul add neg rlineto\n");
fprintf(stream, "closepath\n");
fprintf(stream, "1 setgray\n");
fprintf(stream, "fill\n");
- // ドット描画
+ // hbg`
for(i=0; i<this->ssize; i++){
for(j=0; j<this->ssize; j++) fprintf(stream, "%d ", data[j][i]);
fprintf(stream, "\n");
}