libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] libcvd/cvd image.h


From: Edward Rosten
Subject: [libcvd-members] libcvd/cvd image.h
Date: Thu, 16 Nov 2006 19:16:43 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    libcvd
Changes by:     Edward Rosten <edrosten>        06/11/16 19:16:43

Modified files:
        cvd            : image.h 

Log message:
        resize method accepts an optional fill value.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/image.h?cvsroot=libcvd&r1=1.25&r2=1.26

Patches:
Index: image.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/image.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- image.h     28 Sep 2006 00:28:32 -0000      1.25
+++ image.h     16 Nov 2006 19:16:43 -0000      1.26
@@ -744,22 +744,6 @@
                }
 
 
-               ///Create a filled image of a given size
-               ///This function allows a filled image to be constructed from a 
single value.
-               ///This is useful for the following code:
-               /// @code
-               ///     vector<Image<byte> > images(10, 
Image<byte>::CreateNew(ImageRef(100,100), 255));
-               /// @endcode
-               /// See also @ref CreateNew, which is a synonym for make_pair
-               ///@param im The size and fill for the image to be created
-               Image(const std::pair<ImageRef, T>& im)
-               {
-                       Image<T> tmp(im.first);
-                       tmp.fill(im.second);
-                       dup_from(&tmp);
-               }
-
-               
                ///Resize the image (destroying the data). The image is resized 
even if the new size is the same as the old one.
                ///@param size The new size of the image
                void resize(const ImageRef& size)
@@ -768,6 +752,16 @@
                        *this = new_im;
                }
 
+               ///Resize the image (destroying the data). The image is resized 
even if the new size is the same as the old one.
+               //The resized image is filled with val
+               ///@param size The new size of the image
+               ///@param val  The value to fill the image with
+               void resize(const ImageRef& size, const T& val)
+               {
+                       Image<T> new_im(size, val);
+                       *this = new_im;
+               }
+
                ///The destructor removes the image data
                ~Image()
                {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]