Class: HPDFImage

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

Instance Method Summary collapse

Instance Method Details

#get_bits_per_componentObject



1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
# File 'ext/hpdf.c', line 1267

static VALUE
hpdf_image_get_bits_per_component (VALUE obj)
{
    HPDF_Image image;
    HPDF_UINT i;

    Data_Get_Struct(obj, HPDF_Dict_Rec, image);

    HPDF_PTRACE(("hpdf_encoder_get_unicode image=%p\n", image));

    i = HPDF_Image_GetBitsPerComponent(image);

    return INT2NUM(i);
}

#get_color_spaceObject



1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
# File 'ext/hpdf.c', line 1282

static VALUE
hpdf_image_get_color_space (VALUE obj)
{
    const char* ret;
    HPDF_Image image;

    Data_Get_Struct(obj, HPDF_Dict_Rec, image);

    HPDF_PTRACE(("hpdf_image_get_color_space image=%p\n", image));

    ret = HPDF_Image_GetColorSpace(image);

    return rb_str_new2(ret);
}

#get_heightObject



1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
# File 'ext/hpdf.c', line 1252

static VALUE
hpdf_image_get_height (VALUE obj)
{
    HPDF_Image image;
    HPDF_UINT i;

    Data_Get_Struct(obj, HPDF_Dict_Rec, image);

    HPDF_PTRACE(("hpdf_image_get_height image=%p\n", image));

    i = HPDF_Image_GetHeight(image);

    return INT2NUM(i);
}

#get_sizeObject



1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
# File 'ext/hpdf.c', line 1211

static VALUE
hpdf_image_get_size (VALUE obj)
{
    HPDF_Image image;
    HPDF_Point p;
    VALUE ret;
    VALUE x;
    VALUE y;

    Data_Get_Struct(obj, HPDF_Dict_Rec, image);

    HPDF_PTRACE(("hpdf_image_get_size image=%p\n", image));

    p = HPDF_Image_GetSize(image);

    ret = rb_ary_new();
    x = rb_float_new(p.x);
    y = rb_float_new(p.y);
    rb_ary_push(ret, x);
    rb_ary_push(ret, y);

    return ret;
}

#get_widthObject



1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
# File 'ext/hpdf.c', line 1236

static VALUE
hpdf_image_get_width (VALUE obj)
{
    HPDF_Image image;
    HPDF_UINT i;

    Data_Get_Struct(obj, HPDF_Dict_Rec, image);

    HPDF_PTRACE(("hpdf_image_get_width image=%p\n", image));

    i = HPDF_Image_GetWidth(image);

    return INT2NUM(i);
}

#set_color_maskObject



1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
# File 'ext/hpdf.c', line 1297

static VALUE
hpdf_image_set_color_mask (VALUE obj, VALUE rmin, VALUE rmax, VALUE gmin, VALUE gmax, VALUE bmin, VALUE bmax)
{
    HPDF_Image image;
    HPDF_STATUS ret;
    HPDF_INT i1;
    HPDF_INT i2;
    HPDF_INT i3;
    HPDF_INT i4;
    HPDF_INT i5;
    HPDF_INT i6;

    Data_Get_Struct(obj, HPDF_Dict_Rec, image);
    i1 = NUM2INT(rmin);
    i2 = NUM2INT(rmax);
    i3 = NUM2INT(gmin);
    i4 = NUM2INT(gmax);
    i5 = NUM2INT(bmin);
    i6 = NUM2INT(bmax);

    HPDF_PTRACE(("hpdf_image_set_color_mask image=%p\n", image));

    ret = HPDF_Image_SetColorMask(image, i1, i2, i3, i4, i5, i6);

    return INT2NUM(ret);
}

#set_mask_imageObject



1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
# File 'ext/hpdf.c', line 1324

static VALUE
hpdf_image_set_mask_image (VALUE obj, VALUE mask_image)
{
    HPDF_Image image1;
    HPDF_Image image2;
    HPDF_STATUS ret;

    if (HPDF_StrCmp(rb_obj_classname(mask_image), "HPDFImage") != 0)
        rb_raise(rb_eHPDFError, "invalid argument(1).");

    Data_Get_Struct(obj, HPDF_Dict_Rec, image1);
    Data_Get_Struct(mask_image, HPDF_Dict_Rec, image2);

    HPDF_PTRACE(("hpdf_image_set_mask_image image=%p\n", image1));

    ret = HPDF_Image_SetMaskImage(image1, image2);

    return INT2NUM(ret);
}