mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 05:36:59 -04:00
Change tabs to two spaces.
This commit is contained in:
+91
-91
@@ -26,46 +26,46 @@ class CachedScriptableMask;
|
||||
*/
|
||||
class ScriptableImage {
|
||||
public:
|
||||
inline ScriptableImage() {}
|
||||
inline ScriptableImage(const String& script) : script(script) {}
|
||||
inline ScriptableImage(const GeneratedImageP& gen) : value(gen) {}
|
||||
|
||||
/// Is there a scripted image set?
|
||||
inline bool isScripted() const { return script; }
|
||||
/// Is there an image generator available?
|
||||
inline bool isReady() const { return value; }
|
||||
/// Is there an image set?
|
||||
inline bool isSet() const { return script || value; }
|
||||
|
||||
/// Generate an image.
|
||||
Image generate(const GeneratedImage::Options& options) const;
|
||||
/// How should images be combined with the background?
|
||||
ImageCombine combine() const;
|
||||
|
||||
/// Update the script, returns true if the value has changed
|
||||
bool update(Context& ctx);
|
||||
|
||||
inline void initDependencies(Context& ctx, const Dependency& dep) const {
|
||||
script.initDependencies(ctx, dep);
|
||||
}
|
||||
|
||||
/// Can this be safely generated from another thread?
|
||||
inline bool threadSafe() const { return !value || value->threadSafe(); }
|
||||
/// Is this image specific to the set (the local_package)?
|
||||
inline bool local() const { return value && value->local(); }
|
||||
/// Is this image blank?
|
||||
inline bool isBlank() const { return !value || value->isBlank(); }
|
||||
|
||||
/// Get access to the script, be careful
|
||||
inline Script& getMutableScript() { return script.getMutableScript(); }
|
||||
/// Get access to the script, always returns a valid script
|
||||
ScriptP getValidScriptP();
|
||||
|
||||
inline ScriptableImage() {}
|
||||
inline ScriptableImage(const String& script) : script(script) {}
|
||||
inline ScriptableImage(const GeneratedImageP& gen) : value(gen) {}
|
||||
|
||||
/// Is there a scripted image set?
|
||||
inline bool isScripted() const { return script; }
|
||||
/// Is there an image generator available?
|
||||
inline bool isReady() const { return value; }
|
||||
/// Is there an image set?
|
||||
inline bool isSet() const { return script || value; }
|
||||
|
||||
/// Generate an image.
|
||||
Image generate(const GeneratedImage::Options& options) const;
|
||||
/// How should images be combined with the background?
|
||||
ImageCombine combine() const;
|
||||
|
||||
/// Update the script, returns true if the value has changed
|
||||
bool update(Context& ctx);
|
||||
|
||||
inline void initDependencies(Context& ctx, const Dependency& dep) const {
|
||||
script.initDependencies(ctx, dep);
|
||||
}
|
||||
|
||||
/// Can this be safely generated from another thread?
|
||||
inline bool threadSafe() const { return !value || value->threadSafe(); }
|
||||
/// Is this image specific to the set (the local_package)?
|
||||
inline bool local() const { return value && value->local(); }
|
||||
/// Is this image blank?
|
||||
inline bool isBlank() const { return !value || value->isBlank(); }
|
||||
|
||||
/// Get access to the script, be careful
|
||||
inline Script& getMutableScript() { return script.getMutableScript(); }
|
||||
/// Get access to the script, always returns a valid script
|
||||
ScriptP getValidScriptP();
|
||||
|
||||
protected:
|
||||
OptionalScript script; ///< The script, not really optional
|
||||
GeneratedImageP value; ///< The image generator
|
||||
|
||||
DECLARE_REFLECTION();
|
||||
OptionalScript script; ///< The script, not really optional
|
||||
GeneratedImageP value; ///< The image generator
|
||||
|
||||
DECLARE_REFLECTION();
|
||||
};
|
||||
|
||||
/// Missing for now
|
||||
@@ -79,33 +79,33 @@ GeneratedImageP image_from_script(const ScriptValueP& value);
|
||||
/// A version of ScriptableImage that does caching
|
||||
class CachedScriptableImage : public ScriptableImage {
|
||||
public:
|
||||
inline CachedScriptableImage() {}
|
||||
inline CachedScriptableImage(const String& script) : ScriptableImage(script) {}
|
||||
inline CachedScriptableImage(const GeneratedImageP& gen) : ScriptableImage(gen) {}
|
||||
|
||||
/// Generate an image, using caching if possible.
|
||||
/** *combine should be set to the combine value of the style.
|
||||
* It will be overwritten if the image specifies a non-default combine.
|
||||
* After this call, either:
|
||||
* - combine <= COMBINE_NORMAL && bitmap->Ok()
|
||||
* - or combine > COMBINE_NORMAL && image->Ok()
|
||||
* Optionally, an alpha mask is applied to the image.
|
||||
*/
|
||||
void generateCached(const GeneratedImage::Options& img_options,
|
||||
CachedScriptableMask* mask,
|
||||
ImageCombine* combine, wxBitmap* bitmap, wxImage* image, RealSize* size);
|
||||
|
||||
/// Update the script, returns true if the value has changed
|
||||
bool update(Context& ctx);
|
||||
|
||||
/// Clears the cache
|
||||
void clearCache();
|
||||
|
||||
inline CachedScriptableImage() {}
|
||||
inline CachedScriptableImage(const String& script) : ScriptableImage(script) {}
|
||||
inline CachedScriptableImage(const GeneratedImageP& gen) : ScriptableImage(gen) {}
|
||||
|
||||
/// Generate an image, using caching if possible.
|
||||
/** *combine should be set to the combine value of the style.
|
||||
* It will be overwritten if the image specifies a non-default combine.
|
||||
* After this call, either:
|
||||
* - combine <= COMBINE_NORMAL && bitmap->Ok()
|
||||
* - or combine > COMBINE_NORMAL && image->Ok()
|
||||
* Optionally, an alpha mask is applied to the image.
|
||||
*/
|
||||
void generateCached(const GeneratedImage::Options& img_options,
|
||||
CachedScriptableMask* mask,
|
||||
ImageCombine* combine, wxBitmap* bitmap, wxImage* image, RealSize* size);
|
||||
|
||||
/// Update the script, returns true if the value has changed
|
||||
bool update(Context& ctx);
|
||||
|
||||
/// Clears the cache
|
||||
void clearCache();
|
||||
|
||||
private:
|
||||
Image cached_i; ///< The cached image
|
||||
Bitmap cached_b; ///< *or* the cached bitmap
|
||||
RealSize cached_size; ///< The size of the image before rotating
|
||||
Radians cached_angle;
|
||||
Image cached_i; ///< The cached image
|
||||
Bitmap cached_b; ///< *or* the cached bitmap
|
||||
RealSize cached_size; ///< The size of the image before rotating
|
||||
Radians cached_angle;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : CachedScriptableMask
|
||||
@@ -113,33 +113,33 @@ class CachedScriptableImage : public ScriptableImage {
|
||||
/// A version of ScriptableImage that caches an AlphaMask
|
||||
class CachedScriptableMask {
|
||||
public:
|
||||
|
||||
/// Update the script, returns true if the value has changed
|
||||
bool update(Context& ctx);
|
||||
|
||||
inline void initDependencies(Context& ctx, const Dependency& dep) const {
|
||||
script.initDependencies(ctx, dep);
|
||||
}
|
||||
|
||||
/// Get the alpha mask; with the given options
|
||||
/** if img_options.width == 0 and the mask is already loaded, just returns it.
|
||||
* Returns a reference, so calling again might change earlier results.
|
||||
*/
|
||||
const AlphaMask& get(const GeneratedImage::Options& img_options);
|
||||
|
||||
/// Get a mask that is not cached
|
||||
void getNoCache(const GeneratedImage::Options& img_options, AlphaMask& mask) const;
|
||||
|
||||
/// Get the mask directly from the cache, without updating
|
||||
/** Should only be used after get() was called before, otherwise an old mask might be returned */
|
||||
inline const AlphaMask& getFromCache() const { return mask; }
|
||||
|
||||
|
||||
/// Update the script, returns true if the value has changed
|
||||
bool update(Context& ctx);
|
||||
|
||||
inline void initDependencies(Context& ctx, const Dependency& dep) const {
|
||||
script.initDependencies(ctx, dep);
|
||||
}
|
||||
|
||||
/// Get the alpha mask; with the given options
|
||||
/** if img_options.width == 0 and the mask is already loaded, just returns it.
|
||||
* Returns a reference, so calling again might change earlier results.
|
||||
*/
|
||||
const AlphaMask& get(const GeneratedImage::Options& img_options);
|
||||
|
||||
/// Get a mask that is not cached
|
||||
void getNoCache(const GeneratedImage::Options& img_options, AlphaMask& mask) const;
|
||||
|
||||
/// Get the mask directly from the cache, without updating
|
||||
/** Should only be used after get() was called before, otherwise an old mask might be returned */
|
||||
inline const AlphaMask& getFromCache() const { return mask; }
|
||||
|
||||
private:
|
||||
ScriptableImage script;
|
||||
AlphaMask mask;
|
||||
friend class Reader;
|
||||
friend class Writer;
|
||||
friend class GetDefaultMember;
|
||||
ScriptableImage script;
|
||||
AlphaMask mask;
|
||||
friend class Reader;
|
||||
friend class Writer;
|
||||
friend class GetDefaultMember;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
|
||||
Reference in New Issue
Block a user