Esempio n. 1
0
void pdf_place_image(PDF pdf, halfword p)
{
    scaled_whd dim;
    image_dict *idict = idict_array[rule_index(p)];
    dim.wd = width(p);
    dim.ht = height(p);
    dim.dp = depth(p);
    place_img(pdf, idict, dim, rule_transform(p));
}
Esempio n. 2
0
void scan_pdfrefximage(PDF pdf)
{
    /*tex One could scan transform as well. */
    int transform = 0;
    /*tex Begin of experiment. */
    int open = 0;
    /*tex End of experiment. */
    image_dict *idict;
    /*tex This scans |<rule spec>| to |alt_rule|. */
    scaled_whd alt_rule, dim;
    alt_rule = scan_alt_rule();
    /*tex Begin of experiment. */
    if (scan_keyword("keepopen")) {
        open = 1;
    }
    /*tex End of experiment. */
    scan_int();
    check_obj_type(pdf, obj_type_ximage, cur_val);
    tail_append(new_rule(image_rule));
    idict = idict_array[obj_data_ptr(pdf, cur_val)];
    /*tex Begin of experiment, */
    if (open) {
        /*tex So we keep the original value when no close is given. */
        idict->keepopen = 1;
    }
    /*tex End of experiment. */
    if (img_state(idict) == DICT_NEW) {
        normal_warning("image","don't rely on the image data to be okay");
        width(tail_par) = 0;
        height(tail_par) = 0;
        depth(tail_par) = 0;
    } else {
        if (alt_rule.wd != null_flag || alt_rule.ht != null_flag || alt_rule.dp != null_flag) {
            dim = scale_img(idict, alt_rule, transform);
        } else {
            dim = scale_img(idict, img_dimen(idict), img_transform(idict));
        }
        width(tail_par) = dim.wd;
        height(tail_par) = dim.ht;
        depth(tail_par) = dim.dp;
        rule_transform(tail_par) = transform;
        rule_index(tail_par) = img_index(idict);
    }
}
Esempio n. 3
0
static halfword img_to_node(lua_State * L, image * a)
{
    image_dict *ad;
    halfword n = null;
    if (a == NULL) {
        luaL_error(L, "img.tonode needs a valid image");
    } else {
        ad = img_dict(a);
        if (a == NULL) {
            luaL_error(L, "img.tonode image has no dictionary");
        } else if (img_objnum(ad) == 0) {
            luaL_error(L, "img.tonode got image without object number");
        } else {
            n = new_rule(image_rule);
            rule_index(n) = img_index(ad);
            width(n) = img_width(a);
            height(n) = img_height(a);
            depth(n) = img_depth(a);
            rule_transform(n) = img_transform(a);
        }
    }
    return n;
}