![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/lavocat.quebec/private_html/node_modules/canvas/src/backend/ |
#include "Backend.h"
#include <string>
#include <napi.h>
Backend::Backend(std::string name, Napi::CallbackInfo& info) : name(name), env(info.Env()) {
int width = 0;
int height = 0;
if (info[0].IsNumber()) width = info[0].As<Napi::Number>().Int32Value();
if (info[1].IsNumber()) height = info[1].As<Napi::Number>().Int32Value();
this->width = width;
this->height = height;
}
void Backend::setCanvas(Canvas* _canvas)
{
this->canvas = _canvas;
}
std::string Backend::getName()
{
return name;
}
int Backend::getWidth()
{
return this->width;
}
void Backend::setWidth(int width_)
{
this->destroySurface();
this->width = width_;
}
int Backend::getHeight()
{
return this->height;
}
void Backend::setHeight(int height_)
{
this->destroySurface();
this->height = height_;
}
bool Backend::isSurfaceValid() {
bool isValid = true;
cairo_status_t status = cairo_surface_status(ensureSurface());
if (status != CAIRO_STATUS_SUCCESS) {
error = cairo_status_to_string(status);
isValid = false;
}
return isValid;
}
BackendOperationNotAvailable::BackendOperationNotAvailable(Backend* backend,
std::string operation_name)
: operation_name(operation_name)
{
msg = "operation " + operation_name +
" not supported by backend " + backend->getName();
};
BackendOperationNotAvailable::~BackendOperationNotAvailable() throw() {};
const char* BackendOperationNotAvailable::what() const throw()
{
return msg.c_str();
};