mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 05:36:59 -04:00
New rotation system (see forum thread).
Major changes: - when rotating, the top left corner of the rectangle stays in place. - ValueViewers get a dc that is pre-rotated/translated for them, i.e. (0,0) is the top-left of the viewer (with ValueViewer::getRotation). - moved 'angle' from individual Styles to the Style base class. - any rotation angle is now possible. angle is still an int for now. This warrants a version bump git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@782 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+15
-5
@@ -45,20 +45,30 @@ void sharp_resample_and_clip(const Image& img_in, Image& img_out, wxRect rect, i
|
||||
|
||||
/// Draw text by first drawing it using a larger font and then downsampling it
|
||||
/** optionally rotated by an angle.
|
||||
* rect = rectangle to draw in
|
||||
* pos = the position to draw
|
||||
* rect = rectangle to draw in (a rectangle somewhere around pos)
|
||||
* stretch = amount to stretch in the direction of the text after drawing
|
||||
* (wc,hc) = the corner where drawing should begin, (0,0) for top-left, (1,1) for bottom-right
|
||||
*/
|
||||
void draw_resampled_text(DC& dc, const RealRect& rect, double stretch, int wc, int hc, int angle, const String& text, int blur_radius = 0, int repeat = 1);
|
||||
void draw_resampled_text(DC& dc, const RealPoint& pos, const RealRect& rect, double stretch, int angle, const String& text, int blur_radius = 0, int repeat = 1);
|
||||
|
||||
// scaling factor to use when drawing resampled text
|
||||
extern const int text_scaling;
|
||||
|
||||
// ----------------------------------------------------------------------------- : Image rotation
|
||||
|
||||
/// Is an angle a {0,90,180,270}?
|
||||
inline bool straight(int angle) { return angle % 90 == 0; }
|
||||
|
||||
/// Is an angle sideways (90 or 270 degrees)?
|
||||
// Note: angle & 2 == 0 for angle in {0, 180} and != 0 for angle in {90, 270)
|
||||
inline bool sideways(int angle) { return (angle & 2) != 0; }
|
||||
inline bool sideways(int angle) {
|
||||
int a = (angle + 3600) % 180;
|
||||
return (a > 45 && a < 135);
|
||||
}
|
||||
|
||||
/// Convert radians to degrees
|
||||
inline double rad_to_deg(double rad) { return rad * (180.0 / M_PI); }
|
||||
/// Convert degrees to radians
|
||||
inline double deg_to_rad(double deg) { return deg * (M_PI / 180.0); }
|
||||
|
||||
/// Rotates an image counter clockwise
|
||||
/// angle must be a multiple of 90, i.e. {0,90,180,270}
|
||||
|
||||
Reference in New Issue
Block a user