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.

52 lines
1.7 KiB

14 years ago
//
// Image.h
//
// Copyright (c) 2010 LearnBoost <tj@learnboost.com>
//
#ifndef __NODE_IMAGE_H__
#define __NODE_IMAGE_H__
14 years ago
#include "Canvas.h"
14 years ago
class Image: public node::ObjectWrap {
public:
14 years ago
char *filename;
int width, height;
14 years ago
Persistent<Function> onload;
Persistent<Function> onerror;
static Persistent<FunctionTemplate> constructor;
14 years ago
static void Initialize(Handle<Object> target);
static Handle<Value> New(const Arguments &args);
static Handle<Value> GetSrc(Local<String> prop, const AccessorInfo &info);
static Handle<Value> GetOnload(Local<String> prop, const AccessorInfo &info);
static Handle<Value> GetOnerror(Local<String> prop, const AccessorInfo &info);
static Handle<Value> GetComplete(Local<String> prop, const AccessorInfo &info);
static Handle<Value> GetWidth(Local<String> prop, const AccessorInfo &info);
static Handle<Value> GetHeight(Local<String> prop, const AccessorInfo &info);
14 years ago
static void SetSrc(Local<String> prop, Local<Value> val, const AccessorInfo &info);
static void SetOnload(Local<String> prop, Local<Value> val, const AccessorInfo &info);
static void SetOnerror(Local<String> prop, Local<Value> val, const AccessorInfo &info);
14 years ago
inline cairo_surface_t *surface(){ return _surface; }
inline uint8_t *data(){ return cairo_image_surface_get_data(_surface); }
inline int stride(){ return cairo_image_surface_get_stride(_surface); }
cairo_status_t loadSurface();
void error(Local<Value>);
void loadSync();
void loaded();
void load();
14 years ago
Image();
enum {
DEFAULT
, LOADING
, COMPLETE
} state;
14 years ago
private:
cairo_surface_t *_surface;
~Image();
};
#endif