ext/pdfium_ext/image.cc in pdfium-0.0.1 vs ext/pdfium_ext/image.cc in pdfium-0.0.2

- old
+ new

@@ -7,13 +7,13 @@ ///////////////////////////////////////////////////////////////////////// /* * Document-class: PDFium::Image * * A Image can represent either a Page that - * has been rendered to a Image via Page#as_image + * has been rendered to a Image via {PDFium::Page#as_image} * - * Or an embedded image on a Page, obtained via Page#images + * Or an embedded image on a {PDFium::Page}, obtained via {PDFium::Page#images} */ static void image_gc_free(ImageWrapper *img) { @@ -213,14 +213,18 @@ rb_iv_set(instance, "@file_type", INT2FIX(FIF_BMP)); return instance; } /* - * call-seq: - * save( file ) -> Boolean - * - * Save image to a file + call-seq: + save( file ) + + Save image to a file + + @param file [String, Pathname] path to file to save image to + @return [Boolean] indicating success or failure + */ VALUE image_save(VALUE self, VALUE rb_file){ // figure out the desired format from the file extension const char* file = StringValuePtr(rb_file); @@ -240,13 +244,14 @@ return success ? Qtrue : Qfalse; } /* call-seq: - data(:format) -> Binary String + data(:format) - Returns the binary data for the image in the specified format. + @param format [symbol] any file extension recogized by FreeImage. + @return String containing binary data for the image in the specified format. Used in conjuction with Document.from_memory this can render be used to render a PDF's pages completely in memory. === Example rendering a PDF to AWS without hitting disk @@ -299,20 +304,19 @@ xfree(buffer); return ret; } -VALUE +void define_image_class(){ - VALUE RB_PDFium = RB::PDFium(); + VALUE PDFium = RB::PDFium(); + VALUE RB_Image = rb_define_class_under(PDFium, "Image", rb_cObject); - - VALUE RB_Image = rb_define_class_under(RB_PDFium, "Image", rb_cObject); rb_define_alloc_func(RB_Image, image_allocate); rb_define_private_method (RB_Image, "initialize", RUBY_METHOD_FUNC(image_initialize), -1); - /* Returns the bouding box of the image as a PDFium::BoundingBox */ + /* Returns the bouding box of the image as a {PDFium::BoundingBox} */ rb_define_attr( RB_Image, "bounds", 1, 0 ); /* Returns the index of the image on the page. * Note: The index method is only provided as a convience method. * It has no relation to the position of images on the page. @@ -326,7 +330,7 @@ rb_define_attr( RB_Image, "width", 1, 1 ); rb_define_method( RB_Image, "save", RUBY_METHOD_FUNC(image_save), 1); rb_define_method( RB_Image, "data", RUBY_METHOD_FUNC(image_data), 1); rb_define_method( RB_Image, "as_science", RUBY_METHOD_FUNC(image_as_science),0); - return RB_Image; + }