From 7709c21b5f6a6fe9f9479d1ed3dab3f4b06a38e8 Mon Sep 17 00:00:00 2001 From: coppro Date: Mon, 16 Jul 2007 18:25:08 +0000 Subject: [PATCH] Fixed installer bugs, added documentation for crop function. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@578 0fc631ac-6414-0410-93d0-97cfa31319b6 --- doc/function/crop.txt | 15 +++++++++++++++ doc/function/index.txt | 1 + src/data/installer.cpp | 4 ++-- src/util/io/package.hpp | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 doc/function/crop.txt diff --git a/doc/function/crop.txt b/doc/function/crop.txt new file mode 100644 index 00000000..cff79709 --- /dev/null +++ b/doc/function/crop.txt @@ -0,0 +1,15 @@ +Function: crop + +--Usage-- +> crop(input: image, height: height_of_new_image, width: width_of_new_image, offset_x: x_position_to_start_crop, offset_y: y_position_to_start_crop) + +Shrink an image by cutting off some of the image, starting at the position denoted by the offsets. The resulting image size is specified in the parameters. + +--Parameters-- +! Parameter Type Description +| @input@ [[type:image]] Image to enlarge +| @height@ [[type:double]] Height of the resulting image +| @width@ [[type:double]] Width of the resulting image +| @offset_x@ [[type:double]] Offset of crop, horizontally +| @offset_y@ [[type:double]] Offset of crop, vertically + diff --git a/doc/function/index.txt b/doc/function/index.txt index e06ee917..693c1fb4 100644 --- a/doc/function/index.txt +++ b/doc/function/index.txt @@ -65,6 +65,7 @@ These functions are built into the program, other [[type:function]]s can be defi | [[fun:set_alpha]] Change the transparency of an image. | [[fun:set_combine]] Chnage how the image should be combined with the background. | [[fun:enlarge]] Enlarge an image by putting a border around it. +| [[fun:crop]] Crop an image, giving only a small subset of it. | [[fun:drop_shadow]] Add a drop shadow to an image. | [[fun:symbol_variation]] Render a variation of a [[type:symbol]]. | [[fun:built_in_image]] Return an image built into the program. diff --git a/src/data/installer.cpp b/src/data/installer.cpp index 351210f7..e9ea9b26 100644 --- a/src/data/installer.cpp +++ b/src/data/installer.cpp @@ -21,7 +21,7 @@ #include DECLARE_TYPEOF_COLLECTION(String); -DECLARE_TYPEOF_COLLECTION(PackageP); +DECLARE_TYPEOF_COLLECTION(PackagedP); DECLARE_TYPEOF_COLLECTION(PackageDependencyP); DECLARE_POINTER_TYPE(wxFileInputStream); DECLARE_POINTER_TYPE(wxZipInputStream); @@ -85,7 +85,7 @@ void Installer::install(bool local) { else { throw PackageError(_("Unrecognized package type: '") + fn + _("'\nwhile trying to install: ") + p); } - Reader reader(openIn(p + _("/") + fn.Mid(4))); + Reader reader(openIn(p + _("/") + pack->typeName())); pack->Packaged::reflect_impl(reader); new_packages.push_back(pack); } diff --git a/src/util/io/package.hpp b/src/util/io/package.hpp index 949f9dc4..2dacff2f 100644 --- a/src/util/io/package.hpp +++ b/src/util/io/package.hpp @@ -226,6 +226,7 @@ class Packaged : public Package { private: bool fully_loaded; ///< Is the package fully loaded? friend struct JustAsPackageProxy; + friend class Installer; }; // ----------------------------------------------------------------------------- : IncludePackage