Exemple #1
0
    image_gray8 create_bitmap(box2d<T> box)
    {
        if (!box.valid())
        {
            return image_gray8(0, 0);
        }

        try
        {
            return image_gray8(box.width(), box.height());
        }
        catch (std::runtime_error const & e)
        {
            // TODO: Scale down in this case.
            MAPNIK_LOG_ERROR(grid_vertex_adapter) << "grid vertex adapter: Cannot allocate underlaying bitmap. Bbox: "
                << box.to_string() << "; " << e.what();
            return image_gray8(0, 0);
        }
    }
Exemple #2
0
MAPNIK_DECL image_any create_image_any(int width,
                                       int height,
                                       image_dtype type,
                                       bool initialize,
                                       bool premultiplied,
                                       bool painted)
{
    switch (type)
    {
    case image_dtype_gray8:
        return image_any(std::move(image_gray8(width, height, initialize, premultiplied, painted)));
    case image_dtype_gray8s:
        return image_any(std::move(image_gray8s(width, height, initialize, premultiplied, painted)));
    case image_dtype_gray16:
        return image_any(std::move(image_gray16(width, height, initialize, premultiplied, painted)));
    case image_dtype_gray16s:
        return image_any(std::move(image_gray16s(width, height, initialize, premultiplied, painted)));
    case image_dtype_gray32:
        return image_any(std::move(image_gray32(width, height, initialize, premultiplied, painted)));
    case image_dtype_gray32s:
        return image_any(std::move(image_gray32s(width, height, initialize, premultiplied, painted)));
    case image_dtype_gray32f:
        return image_any(std::move(image_gray32f(width, height, initialize, premultiplied, painted)));
    case image_dtype_gray64:
        return image_any(std::move(image_gray64(width, height, initialize, premultiplied, painted)));
    case image_dtype_gray64s:
        return image_any(std::move(image_gray64s(width, height, initialize, premultiplied, painted)));
    case image_dtype_gray64f:
        return image_any(std::move(image_gray64f(width, height, initialize, premultiplied, painted)));
    case image_dtype_null:
        return image_any(std::move(image_null()));
    case image_dtype_rgba8:
    case IMAGE_DTYPE_MAX:
    default:
        return image_any(std::move(image_rgba8(width, height, initialize, premultiplied, painted)));
    }
}