Sha256: 9a8400b836b96ab696e0e0b252930b80331948e0f5aba1867d095baa1d795301

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

#include "psd_native_ext.h"

void Init_psd_native() {
  VALUE PSDNative = rb_define_module("PSDNative");
  VALUE ImageMode = rb_define_module_under(PSDNative, "ImageMode");

  // RGB Processing
  VALUE ImageMode_RGB = rb_define_module_under(ImageMode, "RGB");
  rb_define_private_method(ImageMode_RGB, "combine_rgb_channel", psd_native_combine_rgb_channel, 0);

  // RLE decoding
  VALUE ImageFormat = rb_define_module_under(PSDNative, "ImageFormat");
  VALUE RLE = rb_define_module_under(ImageFormat, "RLE");
  rb_define_private_method(RLE, "decode_rle_channel", psd_native_decode_rle_channel, 0);

  psd_logger("info", "PSD native mixins enabled!");
}

VALUE psd_class() {
  return rb_const_get(rb_cObject, rb_intern("PSD"));
}

void psd_logger(char* level, char* message) {
  rb_funcall(rb_funcall(psd_class(), rb_intern("logger"), 0), rb_intern(level), 1, rb_str_new2(message));
}

VALUE psd_file(VALUE self) {
  return rb_iv_get(self, "@file");
}

int psd_file_tell(VALUE self) {
  return FIX2INT(rb_funcall(psd_file(self), rb_intern("tell"), 0));
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
psd_native-0.2.0 ext/psd_native/psd_native_ext.c
psd_native-0.1.0 ext/psd_native/psd_native_ext.c