mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Added 'angle' property for choice fields
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@315 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -165,6 +165,7 @@ ChoiceStyle::ChoiceStyle(const ChoiceFieldP& field)
|
||||
, colors_card_list(false)
|
||||
, combine(COMBINE_NORMAL)
|
||||
, alignment(ALIGN_STRETCH)
|
||||
, angle(0)
|
||||
, thumbnails(nullptr)
|
||||
, thumbnail_age(1) // thumbnails were made before the beginning of time
|
||||
, invalidated_images(false)
|
||||
@@ -231,6 +232,7 @@ IMPLEMENT_REFLECTION(ChoiceStyle) {
|
||||
REFLECT_N("mask",mask_filename);
|
||||
REFLECT(combine);
|
||||
REFLECT(alignment);
|
||||
REFLECT(angle);
|
||||
REFLECT(colors_card_list);
|
||||
REFLECT(font);
|
||||
REFLECT(choice_images);
|
||||
|
||||
@@ -131,6 +131,7 @@ class ChoiceStyle : public Style {
|
||||
ImageCombine combine; ///< Combining mode for drawing the images
|
||||
Alignment alignment; ///< Alignment of images
|
||||
Image mask; ///< The actual mask image
|
||||
int angle; ///< Angle by which the images are rotated
|
||||
wxImageList* thumbnails; ///< Thumbnails for the choices
|
||||
Age thumbnail_age; ///< Age the thumbnails were generated
|
||||
bool invalidated_images; ///< Have the images been invalidated?
|
||||
|
||||
@@ -83,13 +83,10 @@ struct Rotate270 {
|
||||
// ----------------------------------------------------------------------------- : Interface
|
||||
|
||||
Image rotate_image(const Image& image, int angle) {
|
||||
if (angle == 90) {
|
||||
return rotate_image_impl<Rotate90>(image);
|
||||
} else if (angle == 180){
|
||||
return rotate_image_impl<Rotate180>(image);
|
||||
} else if (angle == 270){
|
||||
return rotate_image_impl<Rotate270>(image);
|
||||
} else{
|
||||
return image;
|
||||
switch (angle % 360) {
|
||||
case 90: return rotate_image_impl<Rotate90> (image);
|
||||
case 180: return rotate_image_impl<Rotate180>(image);
|
||||
case 270: return rotate_image_impl<Rotate270>(image);
|
||||
default: return image;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,8 @@ void ChoiceValueViewer::draw(RotatedDC& dc) {
|
||||
// draw
|
||||
dc.DrawImage(i->image,
|
||||
align_in_rect(style().alignment, RealSize(i->image.GetWidth(), i->image.GetHeight()), style().getRect()),
|
||||
i->combine == COMBINE_NORMAL ? style().combine : i->combine
|
||||
i->combine == COMBINE_NORMAL ? style().combine : i->combine,
|
||||
style().angle
|
||||
);
|
||||
margin = dc.trInvS(i->image.GetWidth()) + 1;
|
||||
}
|
||||
|
||||
@@ -151,8 +151,8 @@ void RotatedDC::DrawBitmap(const Bitmap& bitmap, const RealPoint& pos) {
|
||||
DrawImage(bitmap.ConvertToImage(), pos);
|
||||
}
|
||||
}
|
||||
void RotatedDC::DrawImage (const Image& image, const RealPoint& pos, ImageCombine combine) {
|
||||
Image rotated = rotate_image(image, angle);
|
||||
void RotatedDC::DrawImage (const Image& image, const RealPoint& pos, ImageCombine combine, int angle) {
|
||||
Image rotated = rotate_image(image, angle + this->angle);
|
||||
wxRect r = trNoNegNoZoom(RealRect(pos, RealSize(image.GetWidth(), image.GetHeight())));
|
||||
draw_combine_image(dc, r.x, r.y, rotated, combine);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ class RotatedDC : public Rotation {
|
||||
/// Draw abitmap, it must already be zoomed!
|
||||
void DrawBitmap(const Bitmap& bitmap, const RealPoint& pos);
|
||||
/// Draw an image using the given combining mode, the image must already be zoomed!
|
||||
void DrawImage (const Image& image, const RealPoint& pos, ImageCombine combine = COMBINE_NORMAL);
|
||||
void DrawImage (const Image& image, const RealPoint& pos, ImageCombine combine = COMBINE_NORMAL, int angle = 0);
|
||||
void DrawLine (const RealPoint& p1, const RealPoint& p2);
|
||||
void DrawRectangle(const RealRect& r);
|
||||
void DrawRoundedRectangle(const RealRect& r, double radius);
|
||||
|
||||
Reference in New Issue
Block a user