open png/jpg image with memory buffer

This commit is contained in:
Jinhao
2016-01-27 01:14:28 +08:00
parent 5a960ed88c
commit 3c8ee33ae8
8 changed files with 278 additions and 152 deletions

View File

@@ -28,7 +28,7 @@ namespace paint
public:
class image_impl_interface;
image();
image() noexcept;
image(const image&);
image(image&&);
explicit image(const ::std::string& file);
@@ -41,13 +41,13 @@ namespace paint
bool open(const ::std::wstring& file);
/// Opens an icon from a specified buffer
bool open_icon(const void* data, std::size_t bytes);
bool empty() const;
bool open(const void* data, std::size_t bytes);
bool empty() const noexcept;
operator unspecified_bool_t() const;
void close();
void close() noexcept;
bool alpha() const;
nana::size size() const;
bool alpha() const noexcept;
nana::size size() const noexcept;
void paste(graphics& dst, const point& p_dst) const;
void paste(const nana::rectangle& r_src, graphics& dst, const point& p_dst) const;///< Paste the area of picture specified by r_src into the destination graphics specified by dst at position p_dst.
void stretch(const nana::rectangle& r_src, graphics& dst, const nana::rectangle& r_dst) const;///<Paste the picture into the dst, stretching or compressing the picture to fit the given area.

View File

@@ -13,10 +13,12 @@
#ifndef NANA_PAT_CLONEABLE_HPP
#define NANA_PAT_CLONEABLE_HPP
#include <nana/c++defines.hpp>
#include <cstddef>
#include <type_traits>
#include <memory>
namespace nana{ namespace pat{
namespace detail
@@ -99,9 +101,9 @@ namespace nana{ namespace pat{
: public std::enable_if<(!std::is_base_of<cloneable, typename std::remove_reference<U>::type>::value) && std::is_base_of<base_t, typename std::remove_reference<U>::type>::value, int>
{};
public:
cloneable() = default;
cloneable() noexcept = default;
cloneable(std::nullptr_t){}
cloneable(std::nullptr_t) noexcept{}
template<typename T, typename member_enabled<T>::type* = nullptr>
cloneable(T&& t)
@@ -166,22 +168,22 @@ namespace nana{ namespace pat{
return *fast_ptr_;
}
const_base_ref operator*() const
const_base_ref operator*() const noexcept
{
return *fast_ptr_;
}
base_t * operator->()
base_t * operator->() noexcept
{
return fast_ptr_;
}
const_base_ptr operator->() const
const_base_ptr operator->() const noexcept
{
return fast_ptr_;
}
base_t * get() const
base_t * get() const noexcept
{
return fast_ptr_;
}
@@ -192,7 +194,7 @@ namespace nana{ namespace pat{
cwrapper_.reset();
}
operator operator_bool_t() const volatile
operator operator_bool_t() const volatile noexcept
{
return (fast_ptr_ ? &inner_bool::true_stand : nullptr);
}

View File

@@ -1,6 +1,6 @@
/*
* A Thread Pool Implementation
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at