gdk_pixbuf_get_interp_pixel (guchar * src, gdouble ox, gdouble oy, guchar ch, RsvgIRect boundarys,
                             guint rowstride)
{
    double xmod, ymod;
    double dist1, dist2, dist3, dist4;
    double c, c1, c2, c3, c4;

    xmod = fmod (ox, 1.0);
    ymod = fmod (oy, 1.0);

    dist1 = (1 - xmod) * (1 - ymod);
    dist2 = (xmod) * (1 - ymod);
    dist3 = (xmod) * (ymod);
    dist4 = (1 - xmod) * (ymod);

    if (floor (ox) <= boundarys.x0 || floor (ox) >= boundarys.x1 ||
        floor (oy) <= boundarys.y0 || floor (oy) >= boundarys.y1)
        c1 = 0;
    else
        c1 = src[(guint) floor (oy) * rowstride + (guint) floor (ox) * 4 + ch];

    if (ceil (ox) <= boundarys.x0 || ceil (ox) >= boundarys.x1 ||
        floor (oy) <= boundarys.y0 || floor (oy) >= boundarys.y1)
        c2 = 0;
    else
        c2 = src[(guint) floor (oy) * rowstride + (guint) ceil (ox) * 4 + ch];

    if (ceil (ox) <= boundarys.x0 || ceil (ox) >= boundarys.x1 ||
        ceil (oy) <= boundarys.y0 || ceil (oy) >= boundarys.y1)
        c3 = 0;
    else
        c3 = src[(guint) ceil (oy) * rowstride + (guint) ceil (ox) * 4 + ch];

    if (floor (ox) <= boundarys.x0 || floor (ox) >= boundarys.x1 ||
        ceil (oy) <= boundarys.y0 || ceil (oy) >= boundarys.y1)
        c4 = 0;
    else
        c4 = src[(guint) ceil (oy) * rowstride + (guint) floor (ox) * 4 + ch];

    c = (c1 * dist1 + c2 * dist2 + c3 * dist3 + c4 * dist4) / (dist1 + dist2 + dist3 + dist4);

    return (guchar) c;
}
gdk_pixbuf_get_interp_pixel (guchar * src, gdouble ox, gdouble oy, guchar ch, RsvgIRect boundarys,
                             guint rowstride)
{
    double xmod, ymod;
    double dist1, dist2, dist3, dist4;
    double c, c1, c2, c3, c4;

    xmod = fmod (ox, 1.0);
    ymod = fmod (oy, 1.0);

    dist1 = (1 - xmod) * (1 - ymod);
    dist2 = (xmod) * (1 - ymod);
    dist3 = (xmod) * (ymod);
    dist4 = (1 - xmod) * (ymod);

    if (floor (ox) <= boundarys.x0 || floor (ox) >= boundarys.x1 ||
        floor (oy) <= boundarys.y0 || floor (oy) >= boundarys.y1)
        c1 = 0;
    else
        c1 = src[(guint) floor (oy) * rowstride + (guint) floor (ox) * 4 + ch];

    if (ceil (ox) <= boundarys.x0 || ceil (ox) >= boundarys.x1 ||
        floor (oy) <= boundarys.y0 || floor (oy) >= boundarys.y1)
        c2 = 0;
    else
        c2 = src[(guint) floor (oy) * rowstride + (guint) ceil (ox) * 4 + ch];

    if (ceil (ox) <= boundarys.x0 || ceil (ox) >= boundarys.x1 ||
        ceil (oy) <= boundarys.y0 || ceil (oy) >= boundarys.y1)
        c3 = 0;
    else
        c3 = src[(guint) ceil (oy) * rowstride + (guint) ceil (ox) * 4 + ch];

    if (floor (ox) <= boundarys.x0 || floor (ox) >= boundarys.x1 ||
        ceil (oy) <= boundarys.y0 || ceil (oy) >= boundarys.y1)
        c4 = 0;
    else
        c4 = src[(guint) ceil (oy) * rowstride + (guint) floor (ox) * 4 + ch];

    c = (c1 * dist1 + c2 * dist2 + c3 * dist3 + c4 * dist4) / (dist1 + dist2 + dist3 + dist4);

    return (guchar) c;
}