From d1f3144c6550ab8dd852865165fdffc18516d4ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Mon, 8 Jul 2013 17:04:28 +0200
Subject: [PATCH] Image: Improved documentation.

---
 lib/modules/_Image.pmod/Dims.pmod   |  1 +
 lib/modules/_Image.pmod/Fonts.pmod  | 17 +++++++++++------
 lib/modules/_Image.pmod/module.pmod | 12 ++----------
 lib/modules/_Image_PSD.pmod         |  1 +
 lib/modules/_Image_XCF.pmod         | 12 ++++++++++--
 lib/modules/_Image_XPM.pmod         |  7 ++++++-
 6 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/lib/modules/_Image.pmod/Dims.pmod b/lib/modules/_Image.pmod/Dims.pmod
index c84b1b8dbf..d0e4b0d202 100644
--- a/lib/modules/_Image.pmod/Dims.pmod
+++ b/lib/modules/_Image.pmod/Dims.pmod
@@ -1,3 +1,4 @@
+#charset utf-8
 #pike __REAL_VERSION__
 
 //   Imagedimensionreadermodule for Pike.
diff --git a/lib/modules/_Image.pmod/Fonts.pmod b/lib/modules/_Image.pmod/Fonts.pmod
index 41b79509b6..1dfeebff39 100644
--- a/lib/modules/_Image.pmod/Fonts.pmod
+++ b/lib/modules/_Image.pmod/Fonts.pmod
@@ -2,22 +2,26 @@
 
 //! @appears Image.Fonts
 //! Abstracted Font-handling support. Should be used instead of
-//! accessing the FreeType, TTF and Image.Font modules directly.
+//! accessing the @[FreeType], @[TTF] and @[Image.Font] modules directly.
 
 constant ITALIC = 1;
-//! The font is/should be italic
+//! The font is/should be italic.
 
 constant BOLD   = 2;
-//! The font is/should be bold
-
-constant BLACK  = 6; // Also enables BOLD..
+//! The font is/should be bold.
 
+constant BLACK  = 6;
+//! The font is/should be black.
+//!
+//! @note
+//!   This also implies @[BOLD].
 
 constant NO_FAKE  = 256; 
 //! Used in @[open_font]() to specify that no fake bold or italic
 //! should be attempted.
 
 #if constant(Image.FreeType.Face)
+//! FreeType 2.x font.
 class FTFont
 {
   constant driver = "FreeType 2";
@@ -160,6 +164,7 @@ class FTFont
 #endif
 
 #if constant(Image.TTF)
+//! FreeType 1.x font.
 class TTFont
 {
   constant driver = "FreeType 1";
@@ -485,7 +490,7 @@ void set_font_dirs( array(string) directories )
 }
 
 
-void create()
+protected void create()
 {
 #ifdef __NT__
   string root = getenv("SystemRoot");
diff --git a/lib/modules/_Image.pmod/module.pmod b/lib/modules/_Image.pmod/module.pmod
index d18971b315..b5d8aeb9c9 100644
--- a/lib/modules/_Image.pmod/module.pmod
+++ b/lib/modules/_Image.pmod/module.pmod
@@ -1,5 +1,7 @@
 #pike __REAL_VERSION__
 
+//! @appears Image
+
 protected constant fmts = ([
   "image/x-pnm" : "PNM",
   "image/x-webp" : "WebP",
@@ -17,7 +19,6 @@ protected constant fmts = ([
   "application/x-photoshop" : "PSD",
 ]);
 
-//! @belongs Image
 //! Attempts to decode @[data] as image data. The heuristics
 //! has some limited ability to decode macbinary files as well.
 Image.Image decode( string data )
@@ -27,7 +28,6 @@ Image.Image decode( string data )
         return res->image;
 }
 
-//! @belongs Image
 //! Attempts to decode @[data] as image data. The heuristics
 //! has some limited ability to decode macbinary files as well.
 mapping _decode( string data )
@@ -166,7 +166,6 @@ mapping _decode( string data )
   ]);
 }
 
-//! @belongs Image
 //! Attempts to decode @[data] as image layer data. Additional
 //! arguments to the various formats decode_layers method can
 //! be passed through @[opt].
@@ -204,7 +203,6 @@ array(Image.Layer) decode_layers( string data, mapping|void opt )
   return i;
 }
 
-//! @belongs Image
 //! Reads the file @[file] and, if the file is compressed
 //! with gzip or bzip, attempts to decompress it by calling
 //! @tt{gzip@} and @tt{bzip2@} in a @[Process.create_process]
@@ -238,7 +236,6 @@ string read_file(string file)
   return Stdio.read_file( file );
 }
 
-//! @belongs Image
 //! Loads in a file, which need not be an image file. If no
 //! argument is given the data will be taken from stdin. If
 //! a file object is given, it will be read to the end of the
@@ -259,7 +256,6 @@ local string load_file( void|object|string file )
   return data;
 }
 
-//! @belongs Image
 //! Loads a file with @[load_file] and decodes it with @[_decode].
 mapping _load(void|object|string file)
 {
@@ -269,7 +265,6 @@ mapping _load(void|object|string file)
    return _decode( data );
 }
 
-//! @belongs Image
 //! Helper function to load an image layer from a file.
 //! If no filename is given, Stdio.stdin is used.
 //! The loaded file is decoded with _decode.
@@ -282,7 +277,6 @@ Image.Layer load_layer(void|object|string file)
       return Image.Layer( (["image":m->image]) );
 }
 
-//! @belongs Image
 //! Helper function to load all image layers from a file.
 //! If no filename is given, Stdio.stdin is used.
 //! The loaded file is decoded with decode_layers. Extra
@@ -293,7 +287,6 @@ array(Image.Layer) load_layers(void|object|string file, mixed|void opts)
   return decode_layers( load_file( file ), opts );
 }
 
-//! @belongs Image
 //! Helper function to load an image from a file.
 //! If no filename is given, Stdio.stdin is used.
 //! The loaded file is decoded with _decode.
@@ -310,7 +303,6 @@ Image.Image load(void|object|string file)
 //! @decl Image.Layer filled_circle_layer(int xd,int yd,Image.Color.Color color)
 //! @decl Image.Layer filled_circle_layer(int d,int r,int g,int b)
 //! @decl Image.Layer filled_circle_layer(int xd,int yd,int r,int g,int b)
-//! @belongs Image
 //!
 //!	Generates a filled circle of the 
 //!	dimensions xd x yd (or d x d).
diff --git a/lib/modules/_Image_PSD.pmod b/lib/modules/_Image_PSD.pmod
index f56d360d3b..f32cff85d3 100644
--- a/lib/modules/_Image_PSD.pmod
+++ b/lib/modules/_Image_PSD.pmod
@@ -5,6 +5,7 @@
    use to the casual Pike programmer, so it might be a good idea, but
    I'm not sure. /Zino */
 
+//! PhotoShop Document
 //! @appears Image.PSD
 
 //! @ignore
diff --git a/lib/modules/_Image_XCF.pmod b/lib/modules/_Image_XCF.pmod
index e760ac9f64..06c955c03e 100644
--- a/lib/modules/_Image_XCF.pmod
+++ b/lib/modules/_Image_XCF.pmod
@@ -1,5 +1,8 @@
 #pike __REAL_VERSION__
 
+//! eXperimental Computing Facility (aka GIMP native) format.
+//! @appears Image.XCF
+
 inherit Image._XCF;
 
 #define SIGNED(X) if(X>=(1<<31)) X=-((1<<32)-X)
@@ -145,6 +148,7 @@ class LayerMask
   inherit Channel;
 }
 
+//!
 class Layer
 {
   string name;
@@ -207,6 +211,7 @@ class Layer
   }
 }
 
+//!
 class GimpImage
 {
   int width;
@@ -355,13 +360,14 @@ class GimpImage
 }
 
 
-
+//!
 GimpImage __decode( string|mapping what )
 {
   if(stringp(what)) what = ___decode( what );
   return GimpImage(what);
 }
 
+//!
 mapping decode_header( string|mapping|object(GimpImage) data )
 {
   if( !objectp(data) )
@@ -403,6 +409,7 @@ string translate_mode( int mode )
   }
 }
 
+//!
 array decode_layers( string|object|mapping what, mapping|void opts, 
                      int|void concat )
 {
@@ -481,6 +488,7 @@ array decode_layers( string|object|mapping what, mapping|void opts,
   return layers;
 }
 
+//!
 mapping _decode( string|mapping|object(GimpImage) what, mapping|void opts )
 {
   if(!opts) opts = ([]);
@@ -601,7 +609,7 @@ mapping _decode( string|mapping|object(GimpImage) what, mapping|void opts )
   ]);
 }
 
-
+//! @decl Image.Image decode(string bytes, mapping|void options)
 object decode( string what,mapping|void opts )
 {
   return _decode( what,opts )->image;
diff --git a/lib/modules/_Image_XPM.pmod b/lib/modules/_Image_XPM.pmod
index 476f32e941..fa6165ce10 100644
--- a/lib/modules/_Image_XPM.pmod
+++ b/lib/modules/_Image_XPM.pmod
@@ -1,5 +1,8 @@
 #pike __REAL_VERSION__
 
+//! X PixMap
+//! @appears Image.XPM
+
 inherit Image._XPM;
 #if 0
 # define TE( X )  werror("XPM profile: %-20s ... ", (X));
@@ -16,6 +19,7 @@ int old_time,start_time;
 # define TE(X)
 #endif
 
+//! @decl mapping _decode(string bytes, mapping|void options)
 mapping _decode( string what, void|mapping opts )
 {
   array data;
@@ -103,6 +107,7 @@ array ok = ({
 
 array cmap_t;
 
+//! @decl string encode(Image.Image image, mapping|void options)
 string encode( object what, mapping|void options )
 {
   int x,y,q;
@@ -185,7 +190,7 @@ string encode( object what, mapping|void options )
   return res;
 }
 
-
+//! @decl Image.Image decode(string bytes)
 object decode( string what )
 {
   return _decode(what)->image;
-- 
GitLab