improve blending error messages

This commit is contained in:
GenevensiS
2026-05-07 11:34:15 +02:00
parent 9b51ca0537
commit d4efc5b973
15 changed files with 46 additions and 23 deletions
+3 -1
View File
@@ -1132,7 +1132,9 @@ error:
# image stuff
coordinates for blending overlap: 坐标混合重叠
#TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
#TODO: Localize
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
#TODO: Localize
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
+3 -1
View File
@@ -1130,7 +1130,9 @@ error:
# image stuff
coordinates for blending overlap: 坐標混合重疊
#TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
#TODO: Localize
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
#TODO: Localize
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
+3 -1
View File
@@ -1156,7 +1156,9 @@ error:
#TODO: Localize
coordinates for blending overlap: Coordinates for blending overlap. Space them out.
#TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
#TODO: Localize
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
#TODO: Localize
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
+2 -1
View File
@@ -1048,7 +1048,8 @@ error:
# image stuff
coordinates for blending overlap: Die Koordinaten für die Überblendung überlappen sich.
blending different sizes: Die für die Überblendung verwendeten Bilder müssen in der Funktion '%s' die gleiche Größe haben.
blending different sizes: Die für die Überblendung verwendeten Bilder müssen in der Funktion '%s' die gleiche Größe haben. (Eines ist %s, das andere ist %s)
blending different mask: Bild und Maske, die zum Überblenden verwendet werden, müssen in der Funktion '%s' die gleiche Größe haben. (Bild ist %s, Maske ist %s)
negative image width: Bild mit Breite Null oder negativer Breite, erstellt in der Funktion '%s'
negative image height: Bild mit Höhe Null oder negativer Höhe, erstellt in der Funktion '%s'
can't load image: Bild konnte nicht geladen werden. Stelle sicher, dass das tatsächliche Format des Bildes mit der gespeicherten Dateiendung übereinstimmt.
+2 -1
View File
@@ -1049,7 +1049,8 @@ error:
# image stuff
coordinates for blending overlap: Coordinates for blending overlap. Space them out.
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
negative image width: Image with zero or negative width created in function '%s'
negative image height: Image with zero or negative height created in function '%s'
can't load image: Failed to load image. Ensure the image's actual format matches its saved extension.
+3 -1
View File
@@ -1133,7 +1133,9 @@ error:
# image stuff
coordinates for blending overlap: Coordenadas para la mezcla (blending) solapada
#TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
#TODO: Localize
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
#TODO: Localize
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
+2 -1
View File
@@ -1048,7 +1048,8 @@ error:
# image stuff
coordinates for blending overlap: Les coordonnées pour le mélange sont superposées. Espacez-les.
blending different sizes: Les images utilisées pour le mélange doivent avoir la même taille dans la fonction '%s'.
blending different sizes: Les images utilisées pour le mélange doivent avoir la même taille dans la fonction '%s'. (L'une est %s, l'autre est %s)
blending different mask: L'image et le masque utilisés pour le mélange doivent avoir la même taille dans la fonction '%s'. (L'image est %s, le masque est %s)
negative image width: Image de largeur nulle ou négative créée par la fonction '%s'
negative image height: Image de hauteur nulle ou négative créée par la fonction '%s'
can't load image: Échec du chargement de l'image. Assurez-vous que le format réel de l'image corresponde à son extension enregistrée.
+2 -1
View File
@@ -1048,7 +1048,8 @@ error:
# image stuff
coordinates for blending overlap: Le coordinate per la fusione si sovrappongono.
blending different sizes: Le immagini utilizzate per la fusione devono avere le stesse dimensioni nella funzione '%s'.
blending different sizes: Le immagini utilizzate per la fusione devono avere le stesse dimensioni nella funzione '%s'. (Una è %s, l'altra è %s)
blending different mask: L'immagine e la maschera utilizzate per la fusione devono avere le stesse dimensioni nella funzione '%s'. (L'immagine è %s, la maschera è %s)
negative image width: Immagine con larghezza zero o negativa creata nella funzione '%s'.
negative image height: Immagine con altezza zero o negativa creata nella funzione '%s'.
can't load image: Impossibile caricare l'immagine. Assicurarsi che il formato effettivo dell'immagine corrisponda all'estensione salvata.
+3 -1
View File
@@ -1133,7 +1133,9 @@ error:
# image stuff
coordinates for blending overlap: オーバーラップを混ぜることのための座標
#TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
#TODO: Localize
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
#TODO: Localize
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
+3 -1
View File
@@ -1139,7 +1139,9 @@ error:
# image stuff
coordinates for blending overlap: 블렌딩 오버랩을 위한 좌표
#TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
#TODO: Localize
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
#TODO: Localize
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
+3 -1
View File
@@ -1189,7 +1189,9 @@ error:
# image stuff
coordinates for blending overlap: Współrzędne scalania (blending) nachodzą na siebie
#TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
#TODO: Localize
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
#TODO: Localize
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
+2 -1
View File
@@ -1049,7 +1049,8 @@ error:
# image stuff
coordinates for blending overlap: As coordenadas para a mistura se sobrepõem.
blending different sizes: As imagens usadas para mesclagem devem ter o mesmo tamanho na função '%s'.
blending different sizes: As imagens usadas para mesclagem devem ter o mesmo tamanho na função '%s'. (Uma é %s, a outra é %s)
blending different mask: A imagem e a máscara usadas para mesclagem devem ter o mesmo tamanho na função '%s' (Imagem é %s, máscara é %s)
negative image width: Imagem com largura zero ou negativa criada na função '%s'
negative image height: Imagem com altura zero ou negativa criada na função '%s'
can't load image: Falha ao carregar a imagem. Verifique se o formato real da imagem corresponde à extensão salva.
+3 -1
View File
@@ -1184,7 +1184,9 @@ error:
#TODO: Localize
coordinates for blending overlap: Coordinates for blending overlap. Space them out.
#TODO: Localize
blending different sizes: Images used for blending must have the same size in function '%s'
blending different sizes: Images used for blending must have the same size in function '%s' (one is %s, the other is %s)
#TODO: Localize
blending different mask: Image and mask used for blending must have the same size in function '%s' (image is %s, mask is %s)
#TODO: Localize
negative image width: Image with zero or negative width created in function '%s'
#TODO: Localize
+8 -7
View File
@@ -19,7 +19,7 @@ template <typename T> inline T sqr(T x) { return x * x; }
void linear_blend(Image& img1, const Image& img2, double x1,double y1, double x2,double y2) {
int width = img1.GetWidth(), height = img1.GetHeight();
if (img2.GetWidth() != width || img2.GetHeight() != height) {
throw Error(_ERROR_1_("blending different sizes", "linear_blend"));
throw Error(_ERROR_3_("blending different sizes", "linear_blend", String()<<width<<_("x")<<height, String()<<img2.GetWidth()<<_("x")<<img2.GetHeight()));
}
const int fixed = 1<<16; // fixed point multiplier
@@ -82,10 +82,10 @@ void linear_blend(Image& img1, const Image& img2, double x1,double y1, double x2
void mask_blend(Image& img1, const Image& img2, const Image& mask) {
int width = img1.GetWidth(), height = img1.GetHeight();
if (img2.GetWidth() != width || img2.GetHeight() != height) {
throw Error(_("Images used for blending in masked_blend function must have the same size"));
throw Error(_ERROR_3_("blending different sizes", "masked_blend", String()<<width<<_("x")<<height, String()<<img2.GetWidth()<<_("x")<<img2.GetHeight()));
}
if (mask.GetWidth() != width || mask.GetHeight() != height) {
throw Error(_("Mask used for blending in masked_blend function must have the same size as the images"));
throw Error(_ERROR_3_("blending different mask", "masked_blend", String()<<width<<_("x")<<height, String()<<mask.GetWidth()<<_("x")<<mask.GetHeight()));
}
UInt size = width * height;
@@ -124,17 +124,18 @@ void set_alpha(Image& img, const Image& img_alpha) {
}
void set_alpha(Image& img, Byte* al, const wxSize& alpha_size) {
if (img.GetWidth() != alpha_size.GetWidth() || img.GetHeight() != alpha_size.GetHeight()) {
throw Error(_("Image must have same size as mask"));
int width = img.GetWidth(), height = img.GetHeight();
if (width != alpha_size.GetWidth() || height != alpha_size.GetHeight()) {
throw Error(_ERROR_3_("blending different mask", "set_alpha", String()<<width<<_("x")<<height, String()<<alpha_size.GetWidth()<<_("x")<<alpha_size.GetHeight()));
}
if (!img.HasAlpha()) {
// copy
img.InitAlpha();
memcpy(img.GetAlpha(), al, img.GetWidth() * img.GetHeight());
memcpy(img.GetAlpha(), al, width * height);
} else{
// merge
Byte *im = img.GetAlpha();
size_t size = img.GetWidth() * img.GetHeight();
size_t size = width * height;
for (size_t i = 0 ; i < size ; ++i) {
im[i] = (im[i] * al[i]) / 255;
}
+4 -3
View File
@@ -449,13 +449,14 @@ void combine_image_do(Image& a, Image b) {
void combine_image(Image& a, const Image& b, ImageCombine combine) {
// Images must have same size
if (a.GetWidth() != b.GetWidth() || a.GetHeight() != b.GetHeight()) {
throw Error(_ERROR_1_("blending different sizes", "combine_blend"));
int width = a.GetWidth(), height = a.GetHeight();
if (b.GetWidth() != width || b.GetHeight() != height) {
throw Error(_ERROR_3_("blending different sizes", "combine_blend", String()<<width<<_("x")<<height, String()<<b.GetWidth()<<_("x")<<b.GetHeight()));
}
// Copy alpha channel?
if (b.HasAlpha()) {
if (!a.HasAlpha()) a.InitAlpha();
memcpy(a.GetAlpha(), b.GetAlpha(), a.GetWidth() * a.GetHeight());
memcpy(a.GetAlpha(), b.GetAlpha(), width * height);
}
// Combine image data, by dispatching to combineImageDo
switch(combine) {