improve image and pixel_buffer

This commit is contained in:
Jinhao
2015-10-17 14:42:07 +08:00
parent 8f59ccfbf6
commit 7f4cc3f6d9
13 changed files with 216 additions and 266 deletions

View File

@@ -78,13 +78,15 @@
#endif
#endif
///////////////////
//Support for PNG
// Comment it to disable the feature of support for PNG.
//#define NANA_ENABLE_PNG
// Define the NANA_ENABLE_PNG to enable the support of PNG.
//
//#define NANA_ENABLE_PNG //!
#if defined(NANA_ENABLE_PNG)
//Comment it to use libpng from operating system.
#define NANA_LIBPNG
#define NANA_LIBPNG //Comment it to use libpng from operating system.
#endif
#endif //NANA_CONFIG_HPP

View File

@@ -28,6 +28,18 @@ namespace detail
{
namespace algorithms
{
///@brief Seek a pixel address by using offset bytes
///@return the specified pixel address
inline pixel_color_t * pixel_at(pixel_color_t * p, std::size_t bytes) //deprecated
{
return reinterpret_cast<pixel_color_t*>(reinterpret_cast<char*>(p) + bytes);
}
inline const pixel_color_t * pixel_at(const pixel_color_t * p, std::size_t bytes)
{
return reinterpret_cast<const pixel_color_t*>(reinterpret_cast<const char*>(p) + bytes);
}
class proximal_interoplation
: public image_process::stretch_interface
{

View File

@@ -1,7 +1,7 @@
/*
* Pixel Buffer Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -18,18 +18,6 @@
namespace nana{ namespace paint
{
///@brief Seek a pixel address by using offset bytes
///@return the specified pixel address
inline pixel_color_t * pixel_at(pixel_color_t * p, std::size_t bytes)
{
return reinterpret_cast<pixel_color_t*>(reinterpret_cast<char*>(p)+bytes);
}
inline const pixel_color_t * pixel_at(const pixel_color_t * p, std::size_t bytes)
{
return reinterpret_cast<const pixel_color_t*>(reinterpret_cast<const char*>(p)+bytes);
}
class pixel_buffer
{
struct pixel_buffer_storage;
@@ -65,6 +53,8 @@ namespace nana{ namespace paint
pixel_color_t * raw_ptr(std::size_t row) const;
pixel_color_t * operator[](std::size_t row) const;
void fill_row(std::size_t row, const unsigned char* buffer, std::size_t bytes, unsigned bits_per_pixel);
void put(const unsigned char* rawbits, std::size_t width, std::size_t height, std::size_t bits_per_pixel, std::size_t bytes_per_line, bool is_negative);
void line(const std::string& name);