mirror of
https://github.com/matrix-construct/construct
synced 2024-06-02 10:08:56 +02:00
ircd: Move magick support to core lib. (#109)
This commit is contained in:
parent
9925fc919d
commit
f5dd9debb6
|
@ -22,10 +22,17 @@ namespace ircd::magick
|
|||
struct scale;
|
||||
struct thumbnail;
|
||||
struct thumbcrop;
|
||||
struct init;
|
||||
|
||||
extern const info::versions version_api, version_abi;
|
||||
}
|
||||
|
||||
struct ircd::magick::init
|
||||
{
|
||||
init();
|
||||
~init() noexcept;
|
||||
};
|
||||
|
||||
/// Composite thumbnailer to resize close to the requested dimension but
|
||||
/// preserving original aspect ratio; then crop to requested dimension.
|
||||
struct ircd::magick::thumbcrop
|
||||
|
|
|
@ -76,6 +76,7 @@ libircd_la_LDFLAGS = \
|
|||
@CRYPTO_LDFLAGS@ \
|
||||
@SODIUM_LDFLAGS@ \
|
||||
@MAGIC_LDFLAGS@ \
|
||||
@IMAGEMAGICK_LDFLAGS@ \
|
||||
@SNAPPY_LDFLAGS@ \
|
||||
@LZ4_LDFLAGS@ \
|
||||
@Z_LDFLAGS@ \
|
||||
|
@ -92,6 +93,7 @@ libircd_la_LIBADD = \
|
|||
@CRYPTO_LIBS@ \
|
||||
@SODIUM_LIBS@ \
|
||||
@MAGIC_LIBS@ \
|
||||
@IMAGEMAGICK_LIBS@ \
|
||||
@SNAPPY_LIBS@ \
|
||||
@LZ4_LIBS@ \
|
||||
@Z_LIBS@ \
|
||||
|
@ -174,6 +176,9 @@ endif
|
|||
if PBC
|
||||
libircd_la_SOURCES += pbc.cc
|
||||
endif
|
||||
if IMAGEMAGICK
|
||||
libircd_la_SOURCES += magick.cc
|
||||
endif
|
||||
libircd_la_SOURCES += openssl.cc
|
||||
libircd_la_SOURCES += rfc1459.cc
|
||||
libircd_la_SOURCES += rfc3986.cc
|
||||
|
@ -242,6 +247,9 @@ prof.lo: AM_CPPFLAGS := @BOOST_CPPFLAGS@ ${AM_CPPFLAGS}
|
|||
if MAGIC
|
||||
magic.lo: AM_CPPFLAGS := @MAGIC_CPPFLAGS@ ${AM_CPPFLAGS}
|
||||
endif
|
||||
if IMAGEMAGICK
|
||||
magick.lo: AM_CPPFLAGS := @IMAGEMAGICK_CPPFLAGS@ ${AM_CPPFLAGS}
|
||||
endif IMAGEMAGICK
|
||||
mods.lo: AM_CPPFLAGS := ${ASIO_UNIT_CPPFLAGS} ${AM_CPPFLAGS}
|
||||
net.lo: AM_CPPFLAGS := ${ASIO_UNIT_CPPFLAGS} ${AM_CPPFLAGS}
|
||||
net_addrs.lo: AM_CPPFLAGS := ${ASIO_UNIT_CPPFLAGS} ${AM_CPPFLAGS}
|
||||
|
|
|
@ -296,6 +296,7 @@ noexcept try
|
|||
fs::init _fs_; // Local filesystem
|
||||
magic::init _magic_; // libmagic
|
||||
ctx::ole::init _ole_; // Thread OffLoad Engine
|
||||
magick::init _magick_; // ImageMagick
|
||||
openssl::init _ossl_; // openssl crypto
|
||||
net::init _net_; // Networking
|
||||
db::init _db_; // RocksDB
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Matrix Construct
|
||||
// The Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2019 Jason Volk <jason@zemos.net>
|
||||
// Copyright (C) The Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2020 Jason Volk <jason@zemos.net>
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -30,9 +30,6 @@ namespace ircd::magick
|
|||
template<class R, class F, class... A> static R callex(F&&, A&&...);
|
||||
template<class F, class... A> static void callpf(F&&, A&&...);
|
||||
|
||||
static void init();
|
||||
static void fini();
|
||||
|
||||
extern bool call_ready;
|
||||
extern ctx::dock call_dock;
|
||||
extern ctx::mutex call_mutex;
|
||||
|
@ -58,14 +55,6 @@ struct ircd::magick::transform
|
|||
transform(const const_buffer &, const output &, const transformer &);
|
||||
};
|
||||
|
||||
ircd::mapi::header
|
||||
IRCD_MODULE
|
||||
{
|
||||
"GraphicsMagick Library support for media manipulation",
|
||||
ircd::magick::init,
|
||||
ircd::magick::fini
|
||||
};
|
||||
|
||||
decltype(ircd::magick::log)
|
||||
ircd::magick::log
|
||||
{
|
||||
|
@ -211,8 +200,7 @@ InitializeMagickSignalHandlers(void)
|
|||
// init
|
||||
//
|
||||
|
||||
void
|
||||
ircd::magick::init()
|
||||
ircd::magick::init::init()
|
||||
{
|
||||
log::info
|
||||
{
|
||||
|
@ -260,8 +248,8 @@ ircd::magick::init()
|
|||
};
|
||||
}
|
||||
|
||||
void
|
||||
ircd::magick::fini()
|
||||
ircd::magick::init::~init()
|
||||
noexcept
|
||||
{
|
||||
log::debug
|
||||
{
|
||||
|
@ -281,7 +269,6 @@ ircd::magick::fini()
|
|||
// thumbcrop
|
||||
//
|
||||
|
||||
IRCD_MODULE_EXPORT
|
||||
ircd::magick::thumbcrop::thumbcrop(const const_buffer &in,
|
||||
const dimensions &req,
|
||||
const result_closure &out)
|
||||
|
@ -295,11 +282,9 @@ ircd::magick::thumbcrop::thumbcrop(const const_buffer &in,
|
|||
std::get<const Image *>(image)
|
||||
};
|
||||
|
||||
const auto &req_x(req.first);
|
||||
const auto &req_y(req.second);
|
||||
const auto &img_x(img_p->columns);
|
||||
const auto &img_y(img_p->rows);
|
||||
|
||||
const auto &[req_x, req_y] {req};
|
||||
const bool aspect
|
||||
{
|
||||
req_x * img_y < req_y * img_x
|
||||
|
@ -339,7 +324,6 @@ ircd::magick::thumbcrop::thumbcrop(const const_buffer &in,
|
|||
// thumbnail
|
||||
//
|
||||
|
||||
IRCD_MODULE_EXPORT
|
||||
ircd::magick::thumbnail::thumbnail(const const_buffer &in,
|
||||
const dimensions &dim,
|
||||
const result_closure &out)
|
||||
|
@ -357,7 +341,6 @@ ircd::magick::thumbnail::thumbnail(const const_buffer &in,
|
|||
// scale
|
||||
//
|
||||
|
||||
IRCD_MODULE_EXPORT
|
||||
ircd::magick::scale::scale(const const_buffer &in,
|
||||
const dimensions &dim,
|
||||
const result_closure &out)
|
||||
|
@ -375,7 +358,6 @@ ircd::magick::scale::scale(const const_buffer &in,
|
|||
// shave
|
||||
//
|
||||
|
||||
IRCD_MODULE_EXPORT
|
||||
ircd::magick::shave::shave(const const_buffer &in,
|
||||
const dimensions &dim,
|
||||
const offset &off,
|
||||
|
@ -402,7 +384,6 @@ ircd::magick::shave::shave(const const_buffer &in,
|
|||
// crop
|
||||
//
|
||||
|
||||
IRCD_MODULE_EXPORT
|
||||
ircd::magick::crop::crop(const const_buffer &in,
|
||||
const dimensions &dim,
|
||||
const offset &off,
|
||||
|
@ -429,7 +410,6 @@ ircd::magick::crop::crop(const const_buffer &in,
|
|||
// transform (internal)
|
||||
//
|
||||
|
||||
IRCD_MODULE_EXPORT
|
||||
ircd::magick::transform::transform(const const_buffer &input,
|
||||
const output &output,
|
||||
const transformer &transformer)
|
||||
|
@ -476,7 +456,6 @@ ircd::magick::transform::transform(const const_buffer &input,
|
|||
// display (internal)
|
||||
//
|
||||
|
||||
IRCD_MODULE_EXPORT
|
||||
ircd::magick::display::display(const const_buffer &input)
|
||||
{
|
||||
const custom_ptr<ImageInfo> input_info
|
||||
|
@ -497,7 +476,6 @@ ircd::magick::display::display(const const_buffer &input)
|
|||
};
|
||||
}
|
||||
|
||||
IRCD_MODULE_EXPORT
|
||||
ircd::magick::display::display(const ImageInfo &info,
|
||||
Image &image)
|
||||
{
|
|
@ -68,19 +68,6 @@ module_LTLIBRARIES += llvm.la
|
|||
|
||||
endif LLVM
|
||||
|
||||
#
|
||||
# {Image|Graphics}Magick Support
|
||||
#
|
||||
if IMAGEMAGICK
|
||||
|
||||
magick_la_SOURCES = magick.cc
|
||||
magick_la_CPPFLAGS = $(AM_CPPFLAGS) @IMAGEMAGICK_CPPFLAGS@
|
||||
magick_la_LDFLAGS = $(AM_LDFLAGS) @IMAGEMAGICK_LDFLAGS@
|
||||
magick_la_LIBADD = $(AM_LIBS) @IMAGEMAGICK_LIBS@
|
||||
module_LTLIBRARIES += magick.la
|
||||
|
||||
endif IMAGEMAGICK
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Messages / protocol
|
||||
|
|
Loading…
Reference in a new issue