mirror of
https://github.com/lovell/sharp.git
synced 2026-02-05 06:06:18 +01:00
Refactor C++ code
Split features into their own file Style is becoming less C, more C++
This commit is contained in:
46
src/common.h
Executable file
46
src/common.h
Executable file
@@ -0,0 +1,46 @@
|
||||
#ifndef SHARP_COMMON_H
|
||||
#define SHARP_COMMON_H
|
||||
|
||||
typedef enum {
|
||||
UNKNOWN,
|
||||
JPEG,
|
||||
PNG,
|
||||
WEBP,
|
||||
TIFF,
|
||||
MAGICK
|
||||
} ImageType;
|
||||
|
||||
// Filename extension checkers
|
||||
bool is_jpeg(std::string const &str);
|
||||
bool is_png(std::string const &str);
|
||||
bool is_webp(std::string const &str);
|
||||
bool is_tiff(std::string const &str);
|
||||
|
||||
// How many tasks are in the queue?
|
||||
extern volatile int counter_queue;
|
||||
|
||||
// How many tasks are being processed?
|
||||
extern volatile int counter_process;
|
||||
|
||||
/*
|
||||
Initialise a VipsImage from a buffer. Supports JPEG, PNG and WebP.
|
||||
Returns the ImageType detected, if any.
|
||||
*/
|
||||
ImageType
|
||||
sharp_init_image_from_buffer(VipsImage **image, void *buffer, size_t const length, VipsAccess const access);
|
||||
|
||||
/*
|
||||
Initialise a VipsImage from a file.
|
||||
Returns the ImageType detected, if any.
|
||||
*/
|
||||
ImageType
|
||||
sharp_init_image_from_file(VipsImage **image, char const *file, VipsAccess const access);
|
||||
|
||||
/*
|
||||
Does this image have an alpha channel?
|
||||
Uses colour space interpretation with number of channels to guess this.
|
||||
*/
|
||||
bool
|
||||
sharp_image_has_alpha(VipsImage *image);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user