Move image_data.hpp to image.hpp and renamed most everything from image_data to image alone. This might lead to the need to clean up some variables that are currently named image through out the code at some time, but I think in the long term is much better as image is a better name for the base class.
This commit is contained in:
parent
e353225772
commit
51172c8fdf
43 changed files with 122 additions and 122 deletions
|
@ -2,7 +2,7 @@
|
|||
#define __MAPNIK_COMPARE_IMAGES_HPP__
|
||||
|
||||
#include <mapnik/graphics.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/image_reader.hpp>
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#pragma GCC diagnostic pop
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_view.hpp>
|
||||
#include <mapnik/image_view_any.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#define MAPNIK_AGG_PATTERN_SOURCE_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/util/noncopyable.hpp>
|
||||
|
||||
// agg
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include <mapnik/request.hpp>
|
||||
#include <mapnik/symbolizer_enumerations.hpp>
|
||||
#include <mapnik/renderer_common.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_any.hpp>
|
||||
// stl
|
||||
#include <memory>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/color.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_any.hpp>
|
||||
#include <mapnik/image_compositing.hpp>
|
||||
#include <mapnik/font_engine_freetype.hpp>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define MAPNIK_CAIRO_IMAGE_UTIL_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/cairo/cairo_context.hpp> // for cairo_surface_ptr
|
||||
|
||||
// stl
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/box2d.hpp>
|
||||
#include <mapnik/grid/grid_view.hpp>
|
||||
#include <mapnik/global.hpp>
|
||||
|
@ -50,7 +50,7 @@ class MAPNIK_DECL hit_grid
|
|||
{
|
||||
public:
|
||||
using value_type = T;
|
||||
using data_type = mapnik::image_data<value_type>;
|
||||
using data_type = mapnik::image<value_type>;
|
||||
using lookup_type = std::string;
|
||||
// mapping between pixel id and key
|
||||
using feature_key_type = std::map<value_type, lookup_type>;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#ifndef MAPNIK_GRID_VIEW_HPP
|
||||
#define MAPNIK_GRID_VIEW_HPP
|
||||
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/box2d.hpp>
|
||||
#include <mapnik/global.hpp>
|
||||
#include <mapnik/value.hpp>
|
||||
|
@ -196,7 +196,7 @@ private:
|
|||
feature_type const& features_;
|
||||
};
|
||||
|
||||
using grid_view = hit_grid_view<mapnik::image_data<mapnik::value_integer> >;
|
||||
using grid_view = hit_grid_view<mapnik::image<mapnik::value_integer> >;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -116,13 +116,13 @@ struct image_dimensions
|
|||
}
|
||||
|
||||
template <typename T, std::size_t max_size = 65535>
|
||||
class image_data
|
||||
class image
|
||||
{
|
||||
public:
|
||||
using pixel_type = T;
|
||||
static constexpr std::size_t pixel_size = sizeof(pixel_type);
|
||||
|
||||
image_data(int width, int height, bool initialize = true, bool premultiplied = false, bool painted = false)
|
||||
image(int width, int height, bool initialize = true, bool premultiplied = false, bool painted = false)
|
||||
: dimensions_(width, height),
|
||||
buffer_(dimensions_.width() * dimensions_.height() * pixel_size),
|
||||
pData_(reinterpret_cast<pixel_type*>(buffer_.data())),
|
||||
|
@ -132,7 +132,7 @@ public:
|
|||
if (pData_ && initialize) std::fill(pData_, pData_ + dimensions_.width() * dimensions_.height(), 0);
|
||||
}
|
||||
|
||||
image_data(image_data<pixel_type> const& rhs)
|
||||
image(image<pixel_type> const& rhs)
|
||||
: dimensions_(rhs.dimensions_),
|
||||
buffer_(rhs.buffer_),
|
||||
pData_(reinterpret_cast<pixel_type*>(buffer_.data())),
|
||||
|
@ -140,7 +140,7 @@ public:
|
|||
painted_(rhs.painted_)
|
||||
{}
|
||||
|
||||
image_data(image_data<pixel_type> && rhs) noexcept
|
||||
image(image<pixel_type> && rhs) noexcept
|
||||
: dimensions_(std::move(rhs.dimensions_)),
|
||||
buffer_(std::move(rhs.buffer_)),
|
||||
pData_(reinterpret_cast<pixel_type*>(buffer_.data())),
|
||||
|
@ -151,13 +151,13 @@ public:
|
|||
rhs.pData_ = nullptr;
|
||||
}
|
||||
|
||||
image_data<pixel_type>& operator=(image_data<pixel_type> rhs)
|
||||
image<pixel_type>& operator=(image<pixel_type> rhs)
|
||||
{
|
||||
swap(rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void swap(image_data<pixel_type> & rhs)
|
||||
void swap(image<pixel_type> & rhs)
|
||||
{
|
||||
std::swap(dimensions_, rhs.dimensions_);
|
||||
std::swap(buffer_, rhs.buffer_);
|
||||
|
@ -277,10 +277,10 @@ private:
|
|||
bool painted_;
|
||||
};
|
||||
|
||||
using image_rgba8 = image_data<std::uint32_t>;
|
||||
using image_gray8 = image_data<std::uint8_t> ;
|
||||
using image_gray16 = image_data<std::int16_t>;
|
||||
using image_gray32f = image_data<float>;
|
||||
using image_rgba8 = image<std::uint32_t>;
|
||||
using image_gray8 = image<std::uint8_t> ;
|
||||
using image_gray16 = image<std::int16_t>;
|
||||
using image_gray32f = image<float>;
|
||||
|
||||
enum image_dtype : std::uint8_t
|
||||
{
|
|
@ -23,7 +23,7 @@
|
|||
#ifndef MAPNIK_IMAGE_DATA_ANY_HPP
|
||||
#define MAPNIK_IMAGE_DATA_ANY_HPP
|
||||
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/util/variant.hpp>
|
||||
|
||||
namespace mapnik {
|
||||
|
@ -40,18 +40,18 @@ struct image_null
|
|||
bool painted() const { return false; }
|
||||
bool get_premultiplied() const { return false; }
|
||||
void set_premultiplied(bool) const {}
|
||||
void set(pixel_type const&) { throw std::runtime_error("Can not set values for null image_data"); }
|
||||
void set(pixel_type const&) { throw std::runtime_error("Can not set values for null image"); }
|
||||
pixel_type& operator() (std::size_t, std::size_t)
|
||||
{
|
||||
throw std::runtime_error("Can not set or get values for null image_data");
|
||||
throw std::runtime_error("Can not set or get values for null image");
|
||||
}
|
||||
pixel_type const& operator() (std::size_t, std::size_t) const
|
||||
{
|
||||
throw std::runtime_error("Can not set or get values for null image_data");
|
||||
throw std::runtime_error("Can not set or get values for null image");
|
||||
}
|
||||
};
|
||||
|
||||
using image_data_base = util::variant<image_null,
|
||||
using image_base = util::variant<image_null,
|
||||
image_rgba8,
|
||||
image_gray8,
|
||||
image_gray16,
|
||||
|
@ -141,7 +141,7 @@ struct get_any_row_size_visitor
|
|||
};
|
||||
} // namespace detail
|
||||
|
||||
struct image_any : image_data_base
|
||||
struct image_any : image_base
|
||||
{
|
||||
image_any() = default;
|
||||
|
||||
|
@ -151,11 +151,11 @@ struct image_any : image_data_base
|
|||
bool initialize = true,
|
||||
bool premultiplied = false,
|
||||
bool painted = false)
|
||||
: image_data_base(std::move(create_image_any(width, height, type, initialize, premultiplied, painted))) {}
|
||||
: image_base(std::move(create_image_any(width, height, type, initialize, premultiplied, painted))) {}
|
||||
|
||||
template <typename T>
|
||||
image_any(T && data) noexcept
|
||||
: image_data_base(std::move(data)) {}
|
||||
: image_base(std::move(data)) {}
|
||||
|
||||
unsigned char const* getBytes() const
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#define MAPNIK_IMAGE_COMPOSITING_HPP
|
||||
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
|
||||
// boost
|
||||
#include <boost/optional.hpp>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
|
||||
// stl
|
||||
#include <iosfwd>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_any.hpp>
|
||||
#include <mapnik/image_view.hpp>
|
||||
#include <mapnik/image_view_any.hpp>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#define MAPNIK_MARKER_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/svg/svg_storage.hpp>
|
||||
#include <mapnik/svg/svg_path_attributes.hpp>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_view.hpp>
|
||||
|
||||
/* miniz.c porting issues:
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <mapnik/octree.hpp>
|
||||
#include <mapnik/hextree.hpp>
|
||||
#include <mapnik/miniz_png.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
|
||||
// zlib
|
||||
#include <zlib.h> // for Z_DEFAULT_COMPRESSION
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/color.hpp>
|
||||
#include <mapnik/enumeration.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
// boost
|
||||
#include <boost/optional.hpp>
|
||||
// boost
|
||||
|
|
|
@ -45,10 +45,10 @@ namespace mapnik {
|
|||
namespace detail {
|
||||
|
||||
template <typename F>
|
||||
struct image_data_dispatcher
|
||||
struct image_dispatcher
|
||||
{
|
||||
using composite_function = F;
|
||||
image_data_dispatcher(int start_x, int start_y,
|
||||
image_dispatcher(int start_x, int start_y,
|
||||
int width, int height,
|
||||
double scale_x, double scale_y,
|
||||
scaling_method_e method, double filter_factor,
|
||||
|
@ -80,8 +80,8 @@ struct image_data_dispatcher
|
|||
template <typename T>
|
||||
void operator() (T const& data_in) const
|
||||
{
|
||||
using image_data_type = T;
|
||||
image_data_type data_out(width_, height_);
|
||||
using image_type = T;
|
||||
image_type data_out(width_, height_);
|
||||
scale_image_agg(data_out, data_in, method_, scale_x_, scale_y_, 0.0, 0.0, filter_factor_);
|
||||
image_rgba8 dst(width_, height_);
|
||||
raster_colorizer_ptr colorizer = get<raster_colorizer_ptr>(sym_, keys::colorizer);
|
||||
|
@ -107,10 +107,10 @@ private:
|
|||
};
|
||||
|
||||
template <typename F>
|
||||
struct image_data_warp_dispatcher
|
||||
struct image_warp_dispatcher
|
||||
{
|
||||
using composite_function = F;
|
||||
image_data_warp_dispatcher(proj_transform const& prj_trans,
|
||||
image_warp_dispatcher(proj_transform const& prj_trans,
|
||||
int start_x, int start_y, int width, int height,
|
||||
box2d<double> const& target_ext, box2d<double> const& source_ext,
|
||||
double offset_x, double offset_y, unsigned mesh_size, scaling_method_e scaling_method,
|
||||
|
@ -147,8 +147,8 @@ struct image_data_warp_dispatcher
|
|||
template <typename T>
|
||||
void operator() (T const& data_in) const
|
||||
{
|
||||
using image_data_type = T;
|
||||
image_data_type data_out(width_, height_);
|
||||
using image_type = T;
|
||||
image_type data_out(width_, height_);
|
||||
if (nodata_) data_out.set(*nodata_);
|
||||
warp_image(data_out, data_in, prj_trans_, target_ext_, source_ext_, offset_x_, offset_y_, mesh_size_, scaling_method_, filter_factor_);
|
||||
image_rgba8 dst(width_, height_);
|
||||
|
@ -220,7 +220,7 @@ void render_raster_symbolizer(raster_symbolizer const& sym,
|
|||
double offset_x = ext.minx() - start_x;
|
||||
double offset_y = ext.miny() - start_y;
|
||||
unsigned mesh_size = static_cast<unsigned>(get<value_integer>(sym,keys::mesh_size,feature, common.vars_, 16));
|
||||
detail::image_data_warp_dispatcher<F> dispatcher(prj_trans, start_x, start_y, raster_width, raster_height,
|
||||
detail::image_warp_dispatcher<F> dispatcher(prj_trans, start_x, start_y, raster_width, raster_height,
|
||||
target_ext, source->ext_, offset_x, offset_y, mesh_size,
|
||||
scaling_method, source->get_filter_factor(),
|
||||
opacity, comp_op, sym, feature, composite, source->nodata());
|
||||
|
@ -243,7 +243,7 @@ void render_raster_symbolizer(raster_symbolizer const& sym,
|
|||
}
|
||||
else
|
||||
{
|
||||
detail::image_data_dispatcher<F> dispatcher(start_x, start_y, raster_width, raster_height,
|
||||
detail::image_dispatcher<F> dispatcher(start_x, start_y, raster_width, raster_height,
|
||||
image_ratio_x, image_ratio_y,
|
||||
scaling_method, source->get_filter_factor(),
|
||||
opacity, comp_op, sym, feature, composite, source->nodata());
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#ifndef MAPNIK_RENDER_PATTERN_HPP
|
||||
#define MAPNIK_RENDER_PATTERN_HPP
|
||||
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <memory>
|
||||
|
||||
// fwd decl
|
||||
|
|
|
@ -387,7 +387,7 @@ void save_as_tiff(T1 & file, T2 const& image, tiff_config & config)
|
|||
TIFFSetField(output, TIFFTAG_TILELENGTH, tile_height);
|
||||
TIFFSetField(output, TIFFTAG_TILEDEPTH, 1);
|
||||
std::size_t tile_size = tile_width * tile_height;
|
||||
std::unique_ptr<pixel_type[]> image_data_out (new pixel_type[tile_size]);
|
||||
std::unique_ptr<pixel_type[]> image_out (new pixel_type[tile_size]);
|
||||
int end_y = (height / tile_height + 1) * tile_height;
|
||||
int end_x = (width / tile_width + 1) * tile_width;
|
||||
end_y = std::min(end_y, height);
|
||||
|
@ -400,14 +400,14 @@ void save_as_tiff(T1 & file, T2 const& image, tiff_config & config)
|
|||
for (int x = 0; x < end_x; x += tile_width)
|
||||
{
|
||||
// Prefill the entire array with zeros.
|
||||
std::fill(image_data_out.get(), image_data_out.get() + tile_size, 0);
|
||||
std::fill(image_out.get(), image_out.get() + tile_size, 0);
|
||||
int tx1 = std::min(width, x + tile_width);
|
||||
int row = y;
|
||||
for (int ty = 0; ty < ty1; ++ty, ++row)
|
||||
{
|
||||
std::copy(image.getRow(row, x), image.getRow(row, tx1), image_data_out.get() + ty * tile_width);
|
||||
std::copy(image.getRow(row, x), image.getRow(row, tx1), image_out.get() + ty * tile_width);
|
||||
}
|
||||
if (TIFFWriteEncodedTile(output, TIFFComputeTile(output, x, y, 0, 0), image_data_out.get(), tile_size * sizeof(pixel_type)) == -1)
|
||||
if (TIFFWriteEncodedTile(output, TIFFComputeTile(output, x, y, 0, 0), image_out.get(), tile_size * sizeof(pixel_type)) == -1)
|
||||
{
|
||||
throw ImageWriterException("Could not write TIFF - TIFF Tile Write failed");
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#define MAPNIK_WEBP_IO_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/util/conversions.hpp>
|
||||
|
||||
// webp
|
||||
|
@ -73,14 +73,14 @@ std::string webp_encoding_error(WebPEncodingError error)
|
|||
}
|
||||
|
||||
template <typename T2>
|
||||
inline int import_image_data(T2 const& image,
|
||||
inline int import_image(T2 const& im_in,
|
||||
WebPPicture & pic,
|
||||
bool alpha)
|
||||
{
|
||||
image_data<typename T2::pixel_type> const& data = image.data();
|
||||
int stride = sizeof(typename T2::pixel_type) * image.width();
|
||||
if (data.width() == image.width() &&
|
||||
data.height() == image.height())
|
||||
image<typename T2::pixel_type> const& data = im_in.data();
|
||||
int stride = sizeof(typename T2::pixel_type) * im_in.width();
|
||||
if (data.width() == im_in.width() &&
|
||||
data.height() == im_in.height())
|
||||
{
|
||||
if (alpha)
|
||||
{
|
||||
|
@ -98,10 +98,10 @@ inline int import_image_data(T2 const& image,
|
|||
else
|
||||
{
|
||||
// need to copy: https://github.com/mapnik/mapnik/issues/2024
|
||||
image_rgba8 im(image.width(),image.height());
|
||||
for (unsigned y = 0; y < image.height(); ++y)
|
||||
image_rgba8 im(im_in.width(),im_in.height());
|
||||
for (unsigned y = 0; y < im_in.height(); ++y)
|
||||
{
|
||||
typename T2::pixel_type const * row_from = image.getRow(y);
|
||||
typename T2::pixel_type const * row_from = im_in.getRow(y);
|
||||
image_rgba8::pixel_type * row_to = im.getRow(y);
|
||||
std::copy(row_from, row_from + stride, row_to);
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ inline int import_image_data(T2 const& image,
|
|||
}
|
||||
|
||||
template <>
|
||||
inline int import_image_data(image_rgba8 const& im,
|
||||
inline int import_image(image_rgba8 const& im,
|
||||
WebPPicture & pic,
|
||||
bool alpha)
|
||||
{
|
||||
|
@ -187,10 +187,10 @@ void save_as_webp(T1& file,
|
|||
{
|
||||
// different approach for lossy since ImportYUVAFromRGBA is needed
|
||||
// to prepare WebPPicture and working with view pixels is not viable
|
||||
ok = import_image_data(image,pic,alpha);
|
||||
ok = import_image(image,pic,alpha);
|
||||
}
|
||||
#else
|
||||
ok = import_image_data(image,pic,alpha);
|
||||
ok = import_image(image,pic,alpha);
|
||||
#endif
|
||||
if (!ok)
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <mapnik/make_unique.hpp>
|
||||
#include <mapnik/global.hpp>
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/raster.hpp>
|
||||
#include <mapnik/view_transform.hpp>
|
||||
#include <mapnik/feature.hpp>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <mapnik/feature_factory.hpp>
|
||||
#include <mapnik/view_transform.hpp>
|
||||
#include <mapnik/raster.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/util/conversions.hpp>
|
||||
#include <mapnik/util/trim.hpp>
|
||||
#include <mapnik/global.hpp> // for int2net
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/view_transform.hpp>
|
||||
#include <mapnik/raster.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/util/conversions.hpp>
|
||||
#include <mapnik/util/trim.hpp>
|
||||
#include <mapnik/box2d.hpp> // for box2d
|
||||
|
@ -279,7 +279,7 @@ mapnik::raster_ptr read_grayscale_band(mapnik::box2d<double> const& bbox,
|
|||
|
||||
int val;
|
||||
uint8_t * data = image.getBytes();
|
||||
int ps = 4; // sizeof(image_data::pixel_type)
|
||||
int ps = 4; // sizeof(image::pixel_type)
|
||||
int off;
|
||||
val = reader(); // nodata value, need to read anyway
|
||||
for (int y=0; y<height; ++y) {
|
||||
|
@ -352,9 +352,9 @@ mapnik::raster_ptr pgraster_wkb_reader::read_grayscale(mapnik::box2d<double> con
|
|||
mapnik::raster_ptr pgraster_wkb_reader::read_rgba(mapnik::box2d<double> const& bbox,
|
||||
uint16_t width, uint16_t height)
|
||||
{
|
||||
mapnik::image_rgba8 image(width, height, true, true);
|
||||
mapnik::image_rgba8 im(width, height, true, true);
|
||||
// Start with plain white (ABGR or RGBA depending on endiannes)
|
||||
image.set(0xffffffff);
|
||||
im.set(0xffffffff);
|
||||
|
||||
uint8_t nodataval;
|
||||
for (int bn=0; bn<numBands_; ++bn) {
|
||||
|
@ -387,8 +387,8 @@ mapnik::raster_ptr pgraster_wkb_reader::read_rgba(mapnik::box2d<double> const& b
|
|||
<< " nodataval " << tmp << " != band 0 nodataval " << nodataval;
|
||||
}
|
||||
|
||||
int ps = 4; // sizeof(image_data::pixel_type)
|
||||
uint8_t * image_data = image.getBytes();
|
||||
int ps = 4; // sizeof(image::pixel_type)
|
||||
uint8_t * image_data = im.getBytes();
|
||||
for (int y=0; y<height_; ++y) {
|
||||
for (int x=0; x<width_; ++x) {
|
||||
uint8_t val = read_uint8(&ptr_);
|
||||
|
@ -400,7 +400,7 @@ mapnik::raster_ptr pgraster_wkb_reader::read_rgba(mapnik::box2d<double> const& b
|
|||
}
|
||||
}
|
||||
}
|
||||
mapnik::raster_ptr raster = std::make_shared<mapnik::raster>(bbox, image, 1.0);
|
||||
mapnik::raster_ptr raster = std::make_shared<mapnik::raster>(bbox, im, 1.0);
|
||||
raster->set_nodata(0xffffffff);
|
||||
return raster;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/raster.hpp>
|
||||
#include <mapnik/view_transform.hpp>
|
||||
#include <mapnik/image_reader.hpp>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/query.hpp>
|
||||
#include <mapnik/raster.hpp>
|
||||
|
@ -116,8 +116,8 @@ feature_ptr rasterlite_featureset::get_feature(mapnik::query const& q)
|
|||
{
|
||||
mapnik::image_rgba8 image(width,height);
|
||||
unsigned char* raster_data = static_cast<unsigned char*>(raster);
|
||||
unsigned char* image_data = image.getBytes();
|
||||
std::memcpy(image_data, raster_data, size);
|
||||
unsigned char* image = image.getBytes();
|
||||
std::memcpy(image, raster_data, size);
|
||||
feature->set_raster(std::make_shared<mapnik::raster>(intersect, std::move(image), 1.0));
|
||||
MAPNIK_LOG_DEBUG(rasterlite) << "rasterlite_featureset: Done";
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <mapnik/agg_rasterizer.hpp>
|
||||
#include <mapnik/symbolizer.hpp>
|
||||
#include <mapnik/symbolizer_keys.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/vertex.hpp>
|
||||
#include <mapnik/renderer_common.hpp>
|
||||
#include <mapnik/proj_transform.hpp>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <mapnik/agg_rasterizer.hpp>
|
||||
#include <mapnik/agg_render_marker.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/util/variant.hpp>
|
||||
#include <mapnik/text/renderer.hpp>
|
||||
#include <mapnik/geom_util.hpp>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <mapnik/symbolizer.hpp>
|
||||
#include <mapnik/raster_colorizer.hpp>
|
||||
#include <mapnik/agg_rasterizer.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/raster.hpp>
|
||||
#include <mapnik/box2d.hpp>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/image_compositing.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_any.hpp>
|
||||
|
||||
// boost
|
||||
|
@ -129,8 +129,8 @@ namespace detail {
|
|||
template <typename T>
|
||||
struct rendering_buffer
|
||||
{
|
||||
using image_data_type = T;
|
||||
using pixel_type = typename image_data_type::pixel_type;
|
||||
using image_type = T;
|
||||
using pixel_type = typename image_type::pixel_type;
|
||||
using row_data = agg::const_row_info<uint8_t>;
|
||||
|
||||
rendering_buffer(T const& data)
|
||||
|
@ -143,7 +143,7 @@ struct rendering_buffer
|
|||
uint8_t const* row_ptr(int, int y, unsigned) {return row_ptr(y);}
|
||||
uint8_t const* row_ptr(int y) const { return reinterpret_cast<uint8_t const*>(data_.getRow(y)); }
|
||||
row_data row (int y) const { return row_data(0, data_.width() - 1, row_ptr(y)); }
|
||||
image_data_type const& data_;
|
||||
image_type const& data_;
|
||||
};
|
||||
|
||||
} // end detail ns
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
// mapnik
|
||||
#include <mapnik/image_convert.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_any.hpp>
|
||||
|
||||
namespace mapnik
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_scaling.hpp>
|
||||
#include <mapnik/image_scaling_traits.hpp>
|
||||
// does not handle alpha correctly
|
||||
|
@ -107,12 +107,12 @@ void scale_image_agg(T & target, T const& source, scaling_method_e scaling_metho
|
|||
// http://old.nabble.com/Re:--AGG--Basic-image-transformations-p1110665.html
|
||||
// "Yes, you need to use premultiplied images only. Only in this case the simple weighted averaging works correctly in the image fitering."
|
||||
// http://permalink.gmane.org/gmane.comp.graphics.agg/3443
|
||||
using image_data_type = T;
|
||||
using pixel_type = typename image_data_type::pixel_type;
|
||||
using pixfmt_pre = typename detail::agg_scaling_traits<image_data_type>::pixfmt_pre;
|
||||
using color_type = typename detail::agg_scaling_traits<image_data_type>::color_type;
|
||||
using img_src_type = typename detail::agg_scaling_traits<image_data_type>::img_src_type;
|
||||
using interpolator_type = typename detail::agg_scaling_traits<image_data_type>::interpolator_type;
|
||||
using image_type = T;
|
||||
using pixel_type = typename image_type::pixel_type;
|
||||
using pixfmt_pre = typename detail::agg_scaling_traits<image_type>::pixfmt_pre;
|
||||
using color_type = typename detail::agg_scaling_traits<image_type>::color_type;
|
||||
using img_src_type = typename detail::agg_scaling_traits<image_type>::img_src_type;
|
||||
using interpolator_type = typename detail::agg_scaling_traits<image_type>::interpolator_type;
|
||||
using renderer_base_pre = agg::renderer_base<pixfmt_pre>;
|
||||
constexpr std::size_t pixel_size = sizeof(pixel_type);
|
||||
|
||||
|
@ -150,13 +150,13 @@ void scale_image_agg(T & target, T const& source, scaling_method_e scaling_metho
|
|||
|
||||
if (scaling_method == SCALING_NEAR)
|
||||
{
|
||||
using span_gen_type = typename detail::agg_scaling_traits<image_data_type>::span_image_filter;
|
||||
using span_gen_type = typename detail::agg_scaling_traits<image_type>::span_image_filter;
|
||||
span_gen_type sg(img_src, interpolator);
|
||||
agg::render_scanlines_aa(ras, sl, rb_dst_pre, sa, sg);
|
||||
}
|
||||
else
|
||||
{
|
||||
using span_gen_type = typename detail::agg_scaling_traits<image_data_type>::span_image_resample_affine;
|
||||
using span_gen_type = typename detail::agg_scaling_traits<image_type>::span_image_resample_affine;
|
||||
agg::image_filter_lut filter;
|
||||
detail::set_scaling_method(filter, scaling_method, filter_factor);
|
||||
span_gen_type sg(img_src, interpolator, filter);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <mapnik/image_util_png.hpp>
|
||||
#include <mapnik/image_util_tiff.hpp>
|
||||
#include <mapnik/image_util_webp.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_any.hpp>
|
||||
#include <mapnik/image_view_any.hpp>
|
||||
#include <mapnik/image_view.hpp>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/image_util_jpeg.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_any.hpp>
|
||||
#include <mapnik/image_view.hpp>
|
||||
#include <mapnik/util/conversions.hpp>
|
||||
|
|
|
@ -34,7 +34,7 @@ extern "C"
|
|||
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/image_util_png.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_any.hpp>
|
||||
#include <mapnik/image_view.hpp>
|
||||
#include <mapnik/util/conversions.hpp>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/image_util_tiff.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_view.hpp>
|
||||
#include <mapnik/util/conversions.hpp>
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/image_util_webp.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_any.hpp>
|
||||
#include <mapnik/image_view.hpp>
|
||||
#include <mapnik/util/conversions.hpp>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
// mapnik
|
||||
#include <mapnik/palette.hpp>
|
||||
#include <mapnik/miniz_png.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_view.hpp>
|
||||
|
||||
// miniz
|
||||
|
|
|
@ -127,8 +127,8 @@ void raster_colorizer::colorize(image_rgba8 & out, T const& in,
|
|||
boost::optional<double> const& nodata,
|
||||
feature_impl const& f) const
|
||||
{
|
||||
using image_data_type = T;
|
||||
using pixel_type = typename image_data_type::pixel_type;
|
||||
using image_type = T;
|
||||
using pixel_type = typename image_type::pixel_type;
|
||||
// TODO: assuming in/out have the same width/height for now
|
||||
std::uint32_t * out_data = out.getData();
|
||||
pixel_type const* in_data = in.getData();
|
||||
|
|
|
@ -397,12 +397,12 @@ template <typename T>
|
|||
template <typename ImageData>
|
||||
image_any tiff_reader<T>::read_any_gray(unsigned x0, unsigned y0, unsigned width, unsigned height)
|
||||
{
|
||||
using image_data_type = ImageData;
|
||||
using pixel_type = typename image_data_type::pixel_type;
|
||||
using image_type = ImageData;
|
||||
using pixel_type = typename image_type::pixel_type;
|
||||
if (read_method_ == tiled)
|
||||
{
|
||||
image_data_type data(width,height);
|
||||
read_tiled<image_data_type>(x0, y0, data);
|
||||
image_type data(width,height);
|
||||
read_tiled<image_type>(x0, y0, data);
|
||||
return image_any(std::move(data));
|
||||
}
|
||||
else
|
||||
|
@ -410,7 +410,7 @@ image_any tiff_reader<T>::read_any_gray(unsigned x0, unsigned y0, unsigned width
|
|||
TIFF* tif = open(stream_);
|
||||
if (tif)
|
||||
{
|
||||
image_data_type data(width, height);
|
||||
image_type data(width, height);
|
||||
std::size_t block_size = rows_per_strip_ > 0 ? rows_per_strip_ : tile_height_ ;
|
||||
std::ptrdiff_t start_y = y0 - y0 % block_size;
|
||||
std::ptrdiff_t end_y = std::min(y0 + height, static_cast<unsigned>(height_));
|
||||
|
@ -454,8 +454,8 @@ struct rgb8_to_rgba8
|
|||
template <typename T>
|
||||
struct tiff_reader_traits
|
||||
{
|
||||
using image_data_type = T;
|
||||
using pixel_type = typename image_data_type::pixel_type;
|
||||
using image_type = T;
|
||||
using pixel_type = typename image_type::pixel_type;
|
||||
static bool read_tile(TIFF * tif, unsigned x, unsigned y, pixel_type* buf, std::size_t tile_width, std::size_t tile_height)
|
||||
{
|
||||
return (TIFFReadEncodedTile(tif, TIFFComputeTile(tif, x,y,0,0), buf, tile_width * tile_height * sizeof(pixel_type)) != -1);
|
||||
|
|
26
src/warp.cpp
26
src/warp.cpp
|
@ -23,7 +23,7 @@
|
|||
// mapnik
|
||||
#include <mapnik/warp.hpp>
|
||||
#include <mapnik/config.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_scaling_traits.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/box2d.hpp>
|
||||
|
@ -53,12 +53,12 @@ MAPNIK_DECL void warp_image (T & target, T const& source, proj_transform const&
|
|||
box2d<double> const& target_ext, box2d<double> const& source_ext,
|
||||
double offset_x, double offset_y, unsigned mesh_size, scaling_method_e scaling_method, double filter_factor)
|
||||
{
|
||||
using image_data_type = T;
|
||||
using pixel_type = typename image_data_type::pixel_type;
|
||||
using pixfmt_pre = typename detail::agg_scaling_traits<image_data_type>::pixfmt_pre;
|
||||
using color_type = typename detail::agg_scaling_traits<image_data_type>::color_type;
|
||||
using image_type = T;
|
||||
using pixel_type = typename image_type::pixel_type;
|
||||
using pixfmt_pre = typename detail::agg_scaling_traits<image_type>::pixfmt_pre;
|
||||
using color_type = typename detail::agg_scaling_traits<image_type>::color_type;
|
||||
using renderer_base = agg::renderer_base<pixfmt_pre>;
|
||||
using interpolator_type = typename detail::agg_scaling_traits<image_data_type>::interpolator_type;
|
||||
using interpolator_type = typename detail::agg_scaling_traits<image_type>::interpolator_type;
|
||||
|
||||
constexpr std::size_t pixel_size = sizeof(pixel_type);
|
||||
|
||||
|
@ -70,8 +70,8 @@ MAPNIK_DECL void warp_image (T & target, T const& source, proj_transform const&
|
|||
std::size_t mesh_nx = std::ceil(source.width()/double(mesh_size) + 1);
|
||||
std::size_t mesh_ny = std::ceil(source.height()/double(mesh_size) + 1);
|
||||
|
||||
image_data<double> xs(mesh_nx, mesh_ny);
|
||||
image_data<double> ys(mesh_nx, mesh_ny);
|
||||
image<double> xs(mesh_nx, mesh_ny);
|
||||
image<double> ys(mesh_nx, mesh_ny);
|
||||
|
||||
// Precalculate reprojected mesh
|
||||
for(std::size_t j = 0; j < mesh_ny; ++j)
|
||||
|
@ -138,13 +138,13 @@ MAPNIK_DECL void warp_image (T & target, T const& source, proj_transform const&
|
|||
interpolator_type interpolator(tr);
|
||||
if (scaling_method == SCALING_NEAR)
|
||||
{
|
||||
using span_gen_type = typename detail::agg_scaling_traits<image_data_type>::span_image_filter;
|
||||
using span_gen_type = typename detail::agg_scaling_traits<image_type>::span_image_filter;
|
||||
span_gen_type sg(ia, interpolator);
|
||||
agg::render_scanlines_bin(rasterizer, scanline, rb, sa, sg);
|
||||
}
|
||||
else
|
||||
{
|
||||
using span_gen_type = typename detail::agg_scaling_traits<image_data_type>::span_image_resample_affine;
|
||||
using span_gen_type = typename detail::agg_scaling_traits<image_type>::span_image_resample_affine;
|
||||
agg::image_filter_lut filter;
|
||||
detail::set_scaling_method(filter, scaling_method, filter_factor);
|
||||
span_gen_type sg(ia, interpolator, filter);
|
||||
|
@ -177,11 +177,11 @@ struct warp_image_visitor
|
|||
template <typename T>
|
||||
void operator() (T const& source)
|
||||
{
|
||||
using image_data_type = T;
|
||||
using image_type = T;
|
||||
//source and target image data types must match
|
||||
if (target_raster_.data_.template is<image_data_type>())
|
||||
if (target_raster_.data_.template is<image_type>())
|
||||
{
|
||||
image_data_type & target = util::get<image_data_type>(target_raster_.data_);
|
||||
image_type & target = util::get<image_type>(target_raster_.data_);
|
||||
warp_image (target, source, prj_trans_, target_raster_.ext_, source_ext_,
|
||||
offset_x_, offset_y_, mesh_size_, scaling_method_, filter_factor_);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <iostream>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_reader.hpp>
|
||||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/util/fs.hpp>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <mapnik/image_util.hpp>
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
#include <mapnik/font_engine_freetype.hpp>
|
||||
#include <mapnik/image_data.hpp>
|
||||
#include <mapnik/image.hpp>
|
||||
#include <mapnik/image_reader.hpp>
|
||||
#include <mapnik/scale_denominator.hpp>
|
||||
#include <mapnik/feature_style_processor.hpp>
|
||||
|
|
Loading…
Reference in a new issue