Class: Pdf417::Lib

Inherits:
Object
  • Object
show all
Defined in:
ext/pdf417/pdf417.c

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.newObject

Makes a new PDF417 object for the given text string



21
22
23
24
25
26
# File 'ext/pdf417/pdf417.c', line 21

static VALUE rb_pdf417_lib_new(VALUE klass) {
  pdf417param *ptr;
  VALUE tdata = Data_Make_Struct(klass, pdf417param, 0, rb_pdf417_lib_cleanup, ptr);
  pdf417init(ptr);
  return tdata;
}

Instance Method Details

#getAspectRatioObject

The y/x aspect ratio



47
48
49
50
51
# File 'ext/pdf417/pdf417.c', line 47

static VALUE rb_pdf417_lib_getAspectRatio(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  return rb_float_new(ptr->aspectRatio);
}

#getBitColumnsObject

The number of code columns



72
73
74
75
76
# File 'ext/pdf417/pdf417.c', line 72

static VALUE rb_pdf417_lib_getBitColumns(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  return INT2NUM(ptr->bitColumns);
}

#getCodeColumnsObject

The number of code columns



84
85
86
87
88
# File 'ext/pdf417/pdf417.c', line 84

static VALUE rb_pdf417_lib_getCodeColumns(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  return INT2NUM(ptr->codeColumns);
}

#getCodeRowsObject

The number of code rows and bitmap lines



109
110
111
112
113
# File 'ext/pdf417/pdf417.c', line 109

static VALUE rb_pdf417_lib_getCodeRows(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  return INT2NUM(ptr->codeRows);
}

#getErrorLevelObject

The error level required 0-8



134
135
136
137
138
# File 'ext/pdf417/pdf417.c', line 134

static VALUE rb_pdf417_lib_getErrorLevel(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  return INT2NUM(ptr->errorLevel);
}

#getLenCodewordsObject

The size of the code words, including error correction codes



159
160
161
162
163
# File 'ext/pdf417/pdf417.c', line 159

static VALUE rb_pdf417_lib_getLenCodewords(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  return INT2NUM(ptr->lenCodewords);
}

#getOutBitsObject

Sets the text to convert into a barcode



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'ext/pdf417/pdf417.c', line 184

static VALUE rb_pdf417_lib_getOutBits(VALUE self) {
  //VALUE list;
  //int lenOutBits, k;
  pdf417param *ptr;

  Data_Get_Struct(self, pdf417param, ptr);
  //lenOutBits = strlen(ptr->outBits);

  //list = rb_ary_new2(lenOutBits);

  //for (k = 0; k < lenOutBits; k++) {
  //  rb_ary_push(list, INT2NUM(ptr->outBits[k]));
  //}

  //return list;
  return rb_str_new2(ptr->outBits);
}

#getTextObject

Sets the text to convert into a barcode



208
209
210
211
212
# File 'ext/pdf417/pdf417.c', line 208

static VALUE rb_pdf417_lib_getText(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  return rb_str_new2(ptr->text);
}

#getYHeightObject

The y/x dot ratio



233
234
235
236
237
# File 'ext/pdf417/pdf417.c', line 233

static VALUE rb_pdf417_lib_getYHeight(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  return rb_float_new(ptr->yHeight);
}

#paintCodeObject

Compute paintCode



34
35
36
37
38
39
# File 'ext/pdf417/pdf417.c', line 34

static VALUE rb_pdf417_lib_paintCode(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  paintCode(ptr);
  return Qnil;
}

#setAspectRatio(aspectRatio) ⇒ Object

The y/x aspect ratio



59
60
61
62
63
64
# File 'ext/pdf417/pdf417.c', line 59

static VALUE rb_pdf417_lib_setAspectRatio(VALUE self, VALUE aspectRatio) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  ptr->aspectRatio = NUM2DBL(aspectRatio);
  return rb_float_new(ptr->aspectRatio);
}

#setCodeColumns(codeColumns) ⇒ Object

The number of code columns



96
97
98
99
100
101
# File 'ext/pdf417/pdf417.c', line 96

static VALUE rb_pdf417_lib_setCodeColumns(VALUE self, VALUE codeColumns) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  ptr->codeColumns = NUM2INT(codeColumns);
  return INT2NUM(ptr->codeColumns);
}

#setCodeRows(codeRows) ⇒ Object

The number of code rows and bitmap lines



121
122
123
124
125
126
# File 'ext/pdf417/pdf417.c', line 121

static VALUE rb_pdf417_lib_setCodeRows(VALUE self, VALUE codeRows) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  ptr->codeRows = NUM2INT(codeRows);
  return INT2NUM(ptr->codeRows);
}

#setErrorLevel(errorLevel) ⇒ Object

The error level required 0-8



146
147
148
149
150
151
# File 'ext/pdf417/pdf417.c', line 146

static VALUE rb_pdf417_lib_setErrorLevel(VALUE self, VALUE errorLevel) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  ptr->errorLevel = NUM2INT(errorLevel);
  return INT2NUM(ptr->errorLevel);
}

#setLenCodewords(lenCodewords) ⇒ Object

The size of the code words, including error correction codes



171
172
173
174
175
176
# File 'ext/pdf417/pdf417.c', line 171

static VALUE rb_pdf417_lib_setLenCodewords(VALUE self, VALUE lenCodewords) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  ptr->lenCodewords = NUM2INT(lenCodewords);
  return INT2NUM(ptr->lenCodewords);
}

#setText(text) ⇒ Object

Sets the text to convert into a barcode



220
221
222
223
224
225
# File 'ext/pdf417/pdf417.c', line 220

static VALUE rb_pdf417_lib_setText(VALUE self, VALUE text) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  ptr->text = StringValuePtr(text);
  return rb_str_new2(ptr->text);
}

#setYHeight(yHeight) ⇒ Object

The y/x dot ratio



245
246
247
248
249
250
# File 'ext/pdf417/pdf417.c', line 245

static VALUE rb_pdf417_lib_setYHeight(VALUE self, VALUE yHeight) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  ptr->yHeight = NUM2DBL(yHeight);
  return rb_float_new(ptr->yHeight);
}