Sha256: f9a5ef961ca646eb2d0a5c237bbbbb0f33549d30a198aa601ccfd4be910e9373

Contents?: true

Size: 936 Bytes

Versions: 5

Compression:

Stored size: 936 Bytes

Contents

#include "oily_png_ext.h"

void Init_oily_png_ext() {
  VALUE OilyPNG = rb_define_module("OilyPNG");

  // Setup decoding
  VALUE OilyPNG_PNGDecoding = rb_define_module_under(OilyPNG, "PNGDecoding");
  rb_define_method(OilyPNG_PNGDecoding, "decode_png_image_pass", oily_png_decode_png_image_pass, 5);
  
  // Setup encoding
  VALUE OilyPNG_PNGEncoding = rb_define_module_under(OilyPNG, "PNGEncoding");
  rb_define_method(OilyPNG_PNGEncoding, "encode_png_image_pass_to_stream", oily_png_encode_png_image_pass_to_stream, 3);
}

int oily_png_pixel_size(int color_mode) {
  switch (color_mode) {
    case OILY_PNG_COLOR_GRAYSCALE:       return 1;
    case OILY_PNG_COLOR_TRUECOLOR:       return 3;
    case OILY_PNG_COLOR_INDEXED:         return 1;
    case OILY_PNG_COLOR_GRAYSCALE_ALPHA: return 2;
    case OILY_PNG_COLOR_TRUECOLOR_ALPHA: return 4;
    default: rb_raise(rb_eRuntimeError, "Unsupported color mode: %d", color_mode);
  }
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
oily_png-0.1.1 ext/oily_png/oily_png_ext.c
oily_png-0.1.0 ext/oily_png/oily_png_ext.c
oily_png-0.0.8 ext/oily_png/oily_png_ext.c
oily_png-0.0.7 ext/oily_png/oily_png_ext.c
oily_png-0.0.6 ext/oily_png/oily_png_ext.c