From 3ca5e4dca9a16d2d0409fd6713a1279fa037b038 Mon Sep 17 00:00:00 2001 From: ser1zw Date: Sat, 18 Jan 2014 19:46:59 +0900 Subject: [PATCH] update some document for GUI --- ext/opencv/gui.cpp | 14 ++++---- ext/opencv/mouseevent.cpp | 2 -- ext/opencv/window.cpp | 71 ++++++++++++++++++++++----------------- 3 files changed, 47 insertions(+), 40 deletions(-) diff --git a/ext/opencv/gui.cpp b/ext/opencv/gui.cpp index 7816a41..bff86f5 100644 --- a/ext/opencv/gui.cpp +++ b/ext/opencv/gui.cpp @@ -10,9 +10,6 @@ #include "gui.h" /* * Document-module: OpenCV::GUI - * - * OpenCV simple GUI interface. Provides Window, Trackbar. - * This GUI work on GTK or Microsoft Windows native GUI. */ __NAMESPACE_BEGIN_OPENCV __NAMESPACE_BEGIN_GUI @@ -26,12 +23,13 @@ rb_module_GUI() } /* - * call-seq: - * wait_key([delay]) -> int or nil + * Waits for a pressed key. * - * Waits for a pressed key each GUI wedget. - * Return the code of the pressed key or nil if no key were pressed until the specified timeout has elapsed. - * delay should be Fixnum. Wait delay millisecond. + * @overload wait_key(delay = 0) + * @param delay [Integer] Delay in milliseconds. 0 is the special value that means "forever". + * @return [Number] The code of the pressed key or nil if no key was pressed + * before the specified time had elapsed. + * @opencv_func cvWaitKey */ VALUE rb_wait_key(int argc, VALUE *argv, VALUE self) diff --git a/ext/opencv/mouseevent.cpp b/ext/opencv/mouseevent.cpp index 22b2214..4b40936 100644 --- a/ext/opencv/mouseevent.cpp +++ b/ext/opencv/mouseevent.cpp @@ -12,8 +12,6 @@ * Document-module: OpenCV::GUI::MouseEvent * * MouseEvent object. - * have - * see OpenCV::GUI::Window#set_mouse_callback. */ __NAMESPACE_BEGIN_OPENCV __NAMESPACE_BEGIN_GUI diff --git a/ext/opencv/window.cpp b/ext/opencv/window.cpp index 1193686..8018b31 100644 --- a/ext/opencv/window.cpp +++ b/ext/opencv/window.cpp @@ -56,11 +56,13 @@ window_free(void *ptr) } /* - * call-seq: - * new(name[, flags]) + * Creates a window. * - * Create new window named name. - * If flags is CV_WINDOW_AUTOSIZE (default), window size automatically resize when image given. + * @overload new(name, flags = CV_WINDOW_AUTOSIZE) + * @param name [String] Name of the window in the window caption that may be used as a window identifier. + * @param flags [Integer] Flags of the window. The supported flags are: + * * CVWINDOW_AUTOSIZE - If this is set, the window size is automatically adjusted + * to fit the displayed image, and you cannot change the window size manually. */ VALUE rb_initialize(int argc, VALUE *argv, VALUE self) @@ -139,11 +141,14 @@ rb_destroy_all(VALUE klass) } /* - * call-seq: - * resize(size) - * resize(width, height) + * Resizes window to the specified size. * - * Set window size. + * @overload resize(size) + * @param size [CvSize] The new window size. + * @overload resize(width, height) + * @param width [Integer] The new window width. + * @param height [Integer] The new window height. + * @opencv_func cvResizeWindow */ VALUE rb_resize(int argc, VALUE *argv, VALUE self) @@ -175,11 +180,14 @@ rb_resize(int argc, VALUE *argv, VALUE self) } /* - * call-seq: - * move(point) - * move(x, y) + * Moves window to the specified position. * - * Set window position. + * @overload move(point) + * @param point [CvPoint] The new coordinate of the window. + * @overload move(x, y) + * @param x [Integer] The new x-coordinate of the window. + * @param y [Integer] The new y-coordinate of the window. + * @opencv_func cvMoveWindow */ VALUE rb_move(int argc, VALUE *argv, VALUE self) @@ -211,11 +219,11 @@ rb_move(int argc, VALUE *argv, VALUE self) } /* - * call-seq: - * show_image(image) + * Displays an image in the specified window. * - * Show the image. If the window was created with flags = CV_WINDOW_AUTOSIZE then the image is shown - * with its original size, otherwize the image is scaled to fit the window. + * @overload show_image(image) + * @param image [CvMat] Image to be shown. + * @opencv_func cvShowImage */ VALUE rb_show_image(VALUE self, VALUE img) @@ -238,13 +246,19 @@ trackbar_callback(int value, void* block) } /* - * call-seq: - * set_trackbar(trackbar) - * set_trackbar(name,maxval[,val],&block) - * set_trackbar(name,maxval[,val]){|value| ... } + * Creates or sets a trackbar and attaches it to the specified window. * - * Create Trackbar on this window. Return new Trackbar. - * see Trackbar.new + * @overload set_trackbar(trackbar) + * @param trackbar [TrackBar] The trackbar to set. + * + * @overload set_trackbar(name, count, value = nil) { |value| ... } + * @param name [String] Name of the created trackbar. + * @param count [Integer] Maximal position of the slider. The minimal position is always 0. + * @param value [Integer] Optional value to an integer variable whose value reflects the position of the slider. + * Upon creation, the slider position is defined by this variable. + * @yield [value] Function to be called every time the slider changes position. + * @yieldparam value [Integer] The trackbar position. + * @opencv_func cv::createTrackbar */ VALUE rb_set_trackbar(int argc, VALUE *argv, VALUE self) @@ -279,16 +293,13 @@ on_mouse(int event, int x, int y, int flags, void* param) } /* - * call-seq: - * set_mouse_callback(&block) - * set_mouse_callback {|mouse_event| ... } + * Sets mouse handler for the specified window. * - * Set mouse callback. - * When the mouse is operated on the window, block will be called. - * Return Proc object. - * block given mouse event object, see GUI::Window::MouseEvent + * @overload set_mouse_callback { |mouse_event| ... } + * @yield [mouse_event] Mouse callback. + * @yieldparam mouse_event [MouseEvent] Mouse event * - * e.g. display mouse event on console. + * @example display mouse event on console * window = OpenCV::GUI::Window.new "sample window" * image = OpenCV::IplImage::load "sample.png" * window.show(image)