You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.4 KiB

14 years ago
//
// init.cc
//
// Copyright (c) 2010 LearnBoost <tj@learnboost.com>
//
#include <stdio.h>
14 years ago
#include "Canvas.h"
#include "Image.h"
14 years ago
#include "ImageData.h"
#include "PixelArray.h"
14 years ago
#include "CanvasGradient.h"
#include "CanvasPattern.h"
14 years ago
#include "CanvasRenderingContext2d.h"
extern "C" void
init (Handle<Object> target) {
HandleScope scope;
Canvas::Initialize(target);
Image::Initialize(target);
14 years ago
ImageData::Initialize(target);
PixelArray::Initialize(target);
14 years ago
Context2d::Initialize(target);
Gradient::Initialize(target);
Pattern::Initialize(target);
14 years ago
target->Set(String::New("cairoVersion"), String::New(cairo_version_string()));
#ifdef HAVE_JPEG
#ifndef JPEG_LIB_VERSION_MAJOR
#ifdef JPEG_LIB_VERSION
#define JPEG_LIB_VERSION_MAJOR (JPEG_LIB_VERSION / 10)
#else
#define JPEG_LIB_VERSION_MAJOR 0
#endif
#endif
#ifndef JPEG_LIB_VERSION_MINOR
#ifdef JPEG_LIB_VERSION
#define JPEG_LIB_VERSION_MINOR (JPEG_LIB_VERSION % 10)
#else
#define JPEG_LIB_VERSION_MINOR 0
#endif
#endif
char jpeg_version[10];
if (JPEG_LIB_VERSION_MINOR > 0) {
snprintf(jpeg_version, 10, "%d%c", JPEG_LIB_VERSION_MAJOR, JPEG_LIB_VERSION_MINOR + 'a' - 1);
} else {
snprintf(jpeg_version, 10, "%d", JPEG_LIB_VERSION_MAJOR);
}
target->Set(String::New("jpegVersion"), String::New(jpeg_version));
#endif
#ifdef HAVE_GIF
target->Set(String::New("gifVersion"), String::New(GIF_LIB_VERSION));
#endif
14 years ago
}
NODE_MODULE(canvas,init);