mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
Card data in images (minimum viable)
* remove wxEmptyString * improve style tab carousel * create web request window * add drop target and drop source
This commit is contained in:
+59
-51
@@ -24,7 +24,7 @@ GeneratedImageP GeneratedImage::toImage() const {
|
||||
return const_cast<GeneratedImage*>(this)->intrusive_from_this();
|
||||
}
|
||||
|
||||
Image GeneratedImage::generateConform(const Options& options) const {
|
||||
Image GeneratedImage::generateConform(const Options& options) {
|
||||
return conform_image(generate(options),options);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ Image conform_image(const Image& img, const GeneratedImage::Options& options) {
|
||||
|
||||
// ----------------------------------------------------------------------------- : BlankImage
|
||||
|
||||
Image BlankImage::generate(const Options& opt) const {
|
||||
Image BlankImage::generate(const Options& opt) {
|
||||
int w = max(1, opt.width >= 0 ? opt.width : opt.height);
|
||||
int h = max(1, opt.height >= 0 ? opt.height : opt.width);
|
||||
Image img(w, h);
|
||||
@@ -97,7 +97,7 @@ bool BlankImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : LinearBlendImage
|
||||
|
||||
Image LinearBlendImage::generate(const Options& opt) const {
|
||||
Image LinearBlendImage::generate(const Options& opt) {
|
||||
Image img = image1->generate(opt);
|
||||
linear_blend(img, image2->generate(opt), x1, y1, x2, y2);
|
||||
return img;
|
||||
@@ -115,7 +115,7 @@ bool LinearBlendImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : MaskedBlendImage
|
||||
|
||||
Image MaskedBlendImage::generate(const Options& opt) const {
|
||||
Image MaskedBlendImage::generate(const Options& opt) {
|
||||
Image img = light->generate(opt);
|
||||
mask_blend(img, dark->generate(opt), mask->generate(opt));
|
||||
return img;
|
||||
@@ -132,7 +132,7 @@ bool MaskedBlendImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : CombineBlendImage
|
||||
|
||||
Image CombineBlendImage::generate(const Options& opt) const {
|
||||
Image CombineBlendImage::generate(const Options& opt) {
|
||||
Image img = image1->generate(opt);
|
||||
combine_image(img, image2->generate(opt), image_combine);
|
||||
return img;
|
||||
@@ -149,7 +149,7 @@ bool CombineBlendImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : SetMaskImage
|
||||
|
||||
Image SetMaskImage::generate(const Options& opt) const {
|
||||
Image SetMaskImage::generate(const Options& opt) {
|
||||
Image img = image->generate(opt);
|
||||
set_alpha(img, mask->generate(opt));
|
||||
return img;
|
||||
@@ -160,7 +160,7 @@ bool SetMaskImage::operator == (const GeneratedImage& that) const {
|
||||
&& *mask == *that2->mask;
|
||||
}
|
||||
|
||||
Image SetAlphaImage::generate(const Options& opt) const {
|
||||
Image SetAlphaImage::generate(const Options& opt) {
|
||||
Image img = image->generate(opt);
|
||||
set_alpha(img, alpha);
|
||||
return img;
|
||||
@@ -173,7 +173,7 @@ bool SetAlphaImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : SetCombineImage
|
||||
|
||||
Image SetCombineImage::generate(const Options& opt) const {
|
||||
Image SetCombineImage::generate(const Options& opt) {
|
||||
return image->generate(opt);
|
||||
}
|
||||
ImageCombine SetCombineImage::combine() const {
|
||||
@@ -187,7 +187,7 @@ bool SetCombineImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : SaturateImage
|
||||
|
||||
Image SaturateImage::generate(const Options& opt) const {
|
||||
Image SaturateImage::generate(const Options& opt) {
|
||||
Image img = image->generate(opt);
|
||||
saturate(img, amount);
|
||||
return img;
|
||||
@@ -200,7 +200,7 @@ bool SaturateImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : InvertImage
|
||||
|
||||
Image InvertImage::generate(const Options& opt) const {
|
||||
Image InvertImage::generate(const Options& opt) {
|
||||
Image img = image->generate(opt);
|
||||
invert(img);
|
||||
return img;
|
||||
@@ -212,7 +212,7 @@ bool InvertImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : RecolorImage
|
||||
|
||||
Image RecolorImage::generate(const Options& opt) const {
|
||||
Image RecolorImage::generate(const Options& opt) {
|
||||
Image img = image->generate(opt);
|
||||
recolor(img, color);
|
||||
return img;
|
||||
@@ -223,7 +223,7 @@ bool RecolorImage::operator == (const GeneratedImage& that) const {
|
||||
&& color == that2->color;
|
||||
}
|
||||
|
||||
Image RecolorImage2::generate(const Options& opt) const {
|
||||
Image RecolorImage2::generate(const Options& opt) {
|
||||
Image img = image->generate(opt);
|
||||
recolor(img, red,green,blue,white);
|
||||
return img;
|
||||
@@ -239,7 +239,7 @@ bool RecolorImage2::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : FlipImage
|
||||
|
||||
Image FlipImageHorizontal::generate(const Options& opt) const {
|
||||
Image FlipImageHorizontal::generate(const Options& opt) {
|
||||
Image img = image->generate(opt);
|
||||
return flip_image_horizontal(img);
|
||||
}
|
||||
@@ -248,7 +248,7 @@ bool FlipImageHorizontal::operator == (const GeneratedImage& that) const {
|
||||
return that2 && *image == *that2->image;
|
||||
}
|
||||
|
||||
Image FlipImageVertical::generate(const Options& opt) const {
|
||||
Image FlipImageVertical::generate(const Options& opt) {
|
||||
Image img = image->generate(opt);
|
||||
return flip_image_vertical(img);
|
||||
}
|
||||
@@ -257,7 +257,7 @@ bool FlipImageVertical::operator == (const GeneratedImage& that) const {
|
||||
return that2 && *image == *that2->image;
|
||||
}
|
||||
|
||||
Image RotateImage::generate(const Options& opt) const {
|
||||
Image RotateImage::generate(const Options& opt) {
|
||||
Image img = image->generate(opt);
|
||||
return rotate_image(img,angle);
|
||||
}
|
||||
@@ -269,7 +269,7 @@ bool RotateImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : EnlargeImage
|
||||
|
||||
Image EnlargeImage::generate(const Options& opt) const {
|
||||
Image EnlargeImage::generate(const Options& opt) {
|
||||
// generate 'sub' image
|
||||
Options sub_opt
|
||||
( int(opt.width * (border_size < 0.5 ? 1 - 2 * border_size : 0))
|
||||
@@ -307,7 +307,7 @@ bool EnlargeImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : ResizeImage
|
||||
|
||||
Image ResizeImage::generate(const Options& opt) const {
|
||||
Image ResizeImage::generate(const Options& opt) {
|
||||
Image img = image->generate(opt);
|
||||
return resample(img, width, height);
|
||||
}
|
||||
@@ -320,7 +320,7 @@ bool ResizeImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : BleedEdgedImage
|
||||
|
||||
Image BleedEdgedImage::generate(const Options& opt) const {
|
||||
Image BleedEdgedImage::generate(const Options& opt) {
|
||||
// create enlarged image
|
||||
Image base_img = base_image->generate(opt);
|
||||
int w = base_img.GetWidth(), h = base_img.GetHeight();
|
||||
@@ -467,7 +467,7 @@ bool BleedEdgedImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : InsertedImage
|
||||
|
||||
Image InsertedImage::generate(const Options& opt) const {
|
||||
Image InsertedImage::generate(const Options& opt) {
|
||||
Image base_img = base_image->generate(opt);
|
||||
Image inserted_img = inserted_image->generate(opt);
|
||||
int base_x = offset_x < 0 ? -offset_x : 0;
|
||||
@@ -507,7 +507,7 @@ bool InsertedImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : CropImage
|
||||
|
||||
Image CropImage::generate(const Options& opt) const {
|
||||
Image CropImage::generate(const Options& opt) {
|
||||
return image->generate(opt).Size(wxSize((int)width, (int)height), wxPoint(-(int)offset_x, -(int)offset_y));
|
||||
}
|
||||
bool CropImage::operator == (const GeneratedImage& that) const {
|
||||
@@ -568,7 +568,7 @@ UInt gaussian_blur(Byte* in, UInt* out, int w, int h, double radius) {
|
||||
return total_x * total_y;
|
||||
}
|
||||
|
||||
Image DropShadowImage::generate(const Options& opt) const {
|
||||
Image DropShadowImage::generate(const Options& opt) {
|
||||
// sub image
|
||||
Image img = image->generate(opt);
|
||||
if (!img.HasAlpha()) {
|
||||
@@ -611,7 +611,7 @@ bool DropShadowImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : PackagedImage
|
||||
|
||||
Image PackagedImage::generate(const Options& opt) const {
|
||||
Image PackagedImage::generate(const Options& opt) {
|
||||
// TODO : use opt.width and opt.height?
|
||||
// open file from package
|
||||
if (!opt.package) throw ScriptError(_("Can only load images in a context where an image is expected"));
|
||||
@@ -631,7 +631,7 @@ bool PackagedImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : BuiltInImage
|
||||
|
||||
Image BuiltInImage::generate(const Options& opt) const {
|
||||
Image BuiltInImage::generate(const Options& opt) {
|
||||
// TODO : use opt.width and opt.height?
|
||||
try {
|
||||
Image img = load_resource_image(name);
|
||||
@@ -646,7 +646,7 @@ bool BuiltInImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : ArbitraryImage
|
||||
|
||||
Image ArbitraryImage::generate(const Options& opt) const {
|
||||
Image ArbitraryImage::generate(const Options& opt) {
|
||||
return image;
|
||||
}
|
||||
bool ArbitraryImage::operator == (const GeneratedImage& that) const {
|
||||
@@ -662,7 +662,7 @@ SymbolToImage::SymbolToImage(bool is_local, const LocalFileName& filename, Age a
|
||||
{}
|
||||
SymbolToImage::~SymbolToImage() {}
|
||||
|
||||
Image SymbolToImage::generate(const Options& opt) const {
|
||||
Image SymbolToImage::generate(const Options& opt) {
|
||||
// TODO : use opt.width and opt.height?
|
||||
Package* package = is_local ? opt.local_package : opt.package;
|
||||
if (!package) throw ScriptError(_("Can only load images in a context where an image is expected"));
|
||||
@@ -698,7 +698,7 @@ ImageValueToImage::ImageValueToImage(const LocalFileName& filename, Age age)
|
||||
{}
|
||||
ImageValueToImage::~ImageValueToImage() {}
|
||||
|
||||
Image ImageValueToImage::generate(const Options& opt) const {
|
||||
Image ImageValueToImage::generate(const Options& opt) {
|
||||
// TODO : use opt.width and opt.height?
|
||||
if (!opt.local_package) throw ScriptError(_("Can only load images in a context where an image is expected"));
|
||||
Image image;
|
||||
@@ -718,44 +718,52 @@ bool ImageValueToImage::operator == (const GeneratedImage& that) const {
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : ExternalImage
|
||||
|
||||
ExternalImage::ExternalImage(const String& filepath)
|
||||
: filepath(filepath), loaded(false)
|
||||
{
|
||||
filepathSanitized = filepath;
|
||||
filepathSanitized.Replace(":", "-");
|
||||
filepathSanitized.Replace("\\", "-");
|
||||
filepathSanitized.Replace("/", "-");
|
||||
}
|
||||
|
||||
Image ExternalImage::generate(const Options& opt) const {
|
||||
wxFileName fname(filepath, wxPATH_UNIX);
|
||||
String filePathString = fname.GetAbsolutePath();
|
||||
|
||||
// has a pre-existing .mse-set file been loaded?
|
||||
if (opt.local_package->needSaveAs()) throw ScriptError(_ERROR_1_("can't import image without set", filePathString));
|
||||
Image ExternalImage::generate(const Options& opt) {
|
||||
// has a pre-existing .mse-set file been loaded?
|
||||
if (opt.local_package->needSaveAs()) throw ScriptError(_ERROR_1_("can't import image without set", filepath));
|
||||
|
||||
// does the file pointed to by filepath exist?
|
||||
if (!fname.FileExists()) throw ScriptError(_ERROR_1_("import not found", filePathString));
|
||||
wxFileName fname(filepath, wxPATH_UNIX);
|
||||
if (!fname.FileExists()) throw ScriptError(_ERROR_1_("import not found", filepath));
|
||||
|
||||
// add the file to the package (or overwrite it if pre-existing)
|
||||
if (!loaded || !opt.local_package->existsIn(filepathSanitized)) {
|
||||
auto outStream = opt.local_package->openOut(filepathSanitized);
|
||||
wxFileInputStream inStream(filepath);
|
||||
if (!inStream.IsOk()) throw ScriptError(_ERROR_1_("can't create file stream", filepath));
|
||||
outStream->Write(inStream);
|
||||
if (!outStream->IsOk()) throw ScriptError(_ERROR_1_("can't write image to set", filepath));
|
||||
outStream->Close();
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
// save the package with the new image
|
||||
opt.local_package->save(false);
|
||||
|
||||
// generate Image
|
||||
String fileExt = fname.GetExt();
|
||||
wxBitmapType bitmapType;
|
||||
if (fileExt == _("png")) bitmapType = wxBITMAP_TYPE_PNG;
|
||||
else if (fileExt == _("jpg") || fileExt == _("jpeg")) bitmapType = wxBITMAP_TYPE_JPEG;
|
||||
else bitmapType = wxBITMAP_TYPE_BMP;
|
||||
|
||||
// does the file exist in the package?
|
||||
String fileNameNoExtension = fname.GetName();
|
||||
if (!opt.local_package->existsIn(fileNameNoExtension)) {
|
||||
auto outStream = opt.local_package->openOut(fileNameNoExtension);
|
||||
wxFileInputStream inStream = wxFileInputStream(filepath.ToStdString());
|
||||
if (!inStream.IsOk()) throw ScriptError(_ERROR_1_("can't create file stream", filePathString));
|
||||
outStream->Write(inStream);
|
||||
if (!outStream->IsOk()) throw ScriptError(_ERROR_1_("can't write image to set", filePathString));
|
||||
outStream->Close();
|
||||
}
|
||||
auto imageInputStream = opt.local_package->openIn(filepathSanitized);
|
||||
Image img(*imageInputStream, bitmapType);
|
||||
|
||||
// save the package with the new image
|
||||
opt.local_package->save(false);
|
||||
|
||||
auto imageInputStream = opt.local_package->openIn(fileNameNoExtension);
|
||||
Image img(*imageInputStream.get(), bitmapType);
|
||||
|
||||
if (!img.IsOk()) throw ScriptError(_ERROR_1_("can't import image", filePathString));
|
||||
if (!img.IsOk()) throw ScriptError(_ERROR_1_("can't import image", filepath));
|
||||
|
||||
return img;
|
||||
}
|
||||
}
|
||||
|
||||
bool ExternalImage::operator == (const GeneratedImage& that) const {
|
||||
const ExternalImage* that2 = dynamic_cast<const ExternalImage*>(&that);
|
||||
|
||||
+35
-33
@@ -44,9 +44,9 @@ public:
|
||||
};
|
||||
|
||||
/// Generate the image, and conform to the options
|
||||
Image generateConform(const Options&) const;
|
||||
Image generateConform(const Options&);
|
||||
/// Generate the image
|
||||
virtual Image generate(const Options&) const = 0;
|
||||
virtual Image generate(const Options&) = 0;
|
||||
/// How must the image be combined with the background?
|
||||
virtual ImageCombine combine() const { return COMBINE_DEFAULT; }
|
||||
/// Equality should mean that every pixel in the generated images is the same if the same options are used
|
||||
@@ -87,7 +87,7 @@ protected:
|
||||
/// An image generator that returns a blank image
|
||||
class BlankImage : public GeneratedImage {
|
||||
public:
|
||||
Image generate(const Options&) const override;
|
||||
Image generate(const Options&) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
bool isBlank() const override { return true; }
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
inline LinearBlendImage(const GeneratedImageP& image1, const GeneratedImageP& image2, double x1, double y1, double x2, double y2)
|
||||
: image1(image1), image2(image2), x1(x1), y1(y1), x2(x2), y2(y2)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
ImageCombine combine() const override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
bool local() const override { return image1->local() && image2->local(); }
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
inline MaskedBlendImage(const GeneratedImageP& light, const GeneratedImageP& dark, const GeneratedImageP& mask)
|
||||
: light(light), dark(dark), mask(mask)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
ImageCombine combine() const override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
bool local() const override { return light->local() && dark->local() && mask->local(); }
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
inline CombineBlendImage(const GeneratedImageP& image1, const GeneratedImageP& image2, ImageCombine image_combine)
|
||||
: image1(image1), image2(image2), image_combine(image_combine)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
ImageCombine combine() const override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
bool local() const override { return image1->local() && image2->local(); }
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
inline SetMaskImage(const GeneratedImageP& image, const GeneratedImageP& mask)
|
||||
: SimpleFilterImage(image), mask(mask)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
private:
|
||||
GeneratedImageP mask;
|
||||
@@ -167,7 +167,7 @@ public:
|
||||
inline SetAlphaImage(const GeneratedImageP& image, double alpha)
|
||||
: SimpleFilterImage(image), alpha(alpha)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
private:
|
||||
double alpha;
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
inline SetCombineImage(const GeneratedImageP& image, ImageCombine image_combine)
|
||||
: SimpleFilterImage(image), image_combine(image_combine)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
ImageCombine combine() const override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
private:
|
||||
@@ -196,7 +196,7 @@ public:
|
||||
inline SaturateImage(const GeneratedImageP& image, double amount)
|
||||
: SimpleFilterImage(image), amount(amount)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
private:
|
||||
double amount;
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
inline InvertImage(const GeneratedImageP& image)
|
||||
: SimpleFilterImage(image)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
};
|
||||
|
||||
@@ -222,7 +222,7 @@ public:
|
||||
inline RecolorImage(const GeneratedImageP& image, Color color)
|
||||
: SimpleFilterImage(image), color(color)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
private:
|
||||
Color color;
|
||||
@@ -233,7 +233,7 @@ public:
|
||||
inline RecolorImage2(const GeneratedImageP& image, Color red, Color green, Color blue, Color white)
|
||||
: SimpleFilterImage(image), red(red), green(green), blue(blue), white(white)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
private:
|
||||
Color red,green,blue,white;
|
||||
@@ -247,7 +247,7 @@ public:
|
||||
inline FlipImageHorizontal(const GeneratedImageP& image)
|
||||
: SimpleFilterImage(image)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
};
|
||||
|
||||
@@ -257,7 +257,7 @@ public:
|
||||
inline FlipImageVertical(const GeneratedImageP& image)
|
||||
: SimpleFilterImage(image)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
};
|
||||
|
||||
@@ -267,7 +267,7 @@ public:
|
||||
inline RotateImage(const GeneratedImageP& image, Radians angle)
|
||||
: SimpleFilterImage(image), angle(angle)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
private:
|
||||
Radians angle;
|
||||
@@ -281,7 +281,7 @@ public:
|
||||
inline EnlargeImage(const GeneratedImageP& image, double border_size)
|
||||
: SimpleFilterImage(image), border_size(fabs(border_size))
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
private:
|
||||
double border_size;
|
||||
@@ -295,7 +295,7 @@ public:
|
||||
inline ResizeImage(const GeneratedImageP& image, int width, int height)
|
||||
: SimpleFilterImage(image), width(max(1, width)), height(max(1, height))
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
private:
|
||||
int width;
|
||||
@@ -310,7 +310,7 @@ public:
|
||||
inline CropImage(const GeneratedImageP& image, double width, double height, double offset_x, double offset_y)
|
||||
: SimpleFilterImage(image), width(width), height(height), offset_x(offset_x), offset_y(offset_y)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
private:
|
||||
double width, height;
|
||||
@@ -325,7 +325,7 @@ public:
|
||||
inline BleedEdgedImage(const GeneratedImageP& base_image, double horizontal_size, double vertical_size, Color background_color)
|
||||
: base_image(base_image), horizontal_size(horizontal_size), vertical_size(vertical_size), background_color(background_color)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
private:
|
||||
GeneratedImageP base_image;
|
||||
@@ -341,7 +341,7 @@ public:
|
||||
inline InsertedImage(const GeneratedImageP& base_image, const GeneratedImageP& inserted_image, int offset_x, int offset_y, Color background_color)
|
||||
: base_image(base_image), inserted_image(inserted_image), offset_x(offset_x), offset_y(offset_y), background_color(background_color)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
ImageCombine combine() const override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
bool local() const override { return base_image->local() && inserted_image->local(); }
|
||||
@@ -360,7 +360,7 @@ public:
|
||||
: SimpleFilterImage(image), offset_x(offset_x), offset_y(offset_y)
|
||||
, shadow_alpha(shadow_alpha), shadow_blur_radius(shadow_blur_radius), shadow_color(shadow_color)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
private:
|
||||
double offset_x, offset_y;
|
||||
@@ -377,7 +377,7 @@ public:
|
||||
inline PackagedImage(const String& filename)
|
||||
: filename(filename)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
private:
|
||||
String filename;
|
||||
@@ -391,7 +391,7 @@ public:
|
||||
inline BuiltInImage(const String& name)
|
||||
: name(name)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
private:
|
||||
String name;
|
||||
@@ -404,7 +404,7 @@ public:
|
||||
inline ArbitraryImage(const Image image)
|
||||
: image(image)
|
||||
{}
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
private:
|
||||
Image image;
|
||||
@@ -417,7 +417,7 @@ class SymbolToImage : public GeneratedImage {
|
||||
public:
|
||||
SymbolToImage(bool is_local, const LocalFileName& filename, Age age, const SymbolVariationP& variation);
|
||||
~SymbolToImage();
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
bool local() const override { return is_local; }
|
||||
|
||||
@@ -439,7 +439,7 @@ class ImageValueToImage : public GeneratedImage {
|
||||
public:
|
||||
ImageValueToImage(const LocalFileName& filename, Age age);
|
||||
~ImageValueToImage();
|
||||
Image generate(const Options& opt) const override;
|
||||
Image generate(const Options& opt) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
bool local() const override { return true; }
|
||||
private:
|
||||
@@ -453,11 +453,13 @@ private:
|
||||
/// Load an image from the filesystem
|
||||
class ExternalImage : public GeneratedImage {
|
||||
public:
|
||||
ExternalImage(const String& filepath) : filepath(filepath) {};
|
||||
Image generate(const Options&) const override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
inline String toString() { return filepath; }
|
||||
inline String toCode() const override { return _("<image>"); }
|
||||
ExternalImage(const String& filepath);
|
||||
Image generate(const Options&) override;
|
||||
bool operator == (const GeneratedImage& that) const override;
|
||||
inline String toString() { return filepath; }
|
||||
inline String toCode() const override { return _("<image>"); }
|
||||
private:
|
||||
String filepath;
|
||||
String filepath;
|
||||
String filepathSanitized;
|
||||
bool loaded; ///< Make sure we at least load the image from outside the package once, as it may have been updated externally
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user