mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
Symbol resizing using aspect ratio;
TODO: copy code for rarity box to other styles git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@622 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -14,14 +14,14 @@ DECLARE_TYPEOF_COLLECTION(SymbolPartP);
|
||||
|
||||
// ----------------------------------------------------------------------------- : Simple rendering
|
||||
|
||||
Image render_symbol(const SymbolP& symbol, double border_radius, int width, int height, bool editing_hints) {
|
||||
Image render_symbol(const SymbolP& symbol, double border_radius, int width, int height, bool editing_hints, bool allow_smaller) {
|
||||
SymbolViewer viewer(symbol, editing_hints, width, border_radius);
|
||||
// limit width/height ratio to aspect ratio of symbol
|
||||
double ar = symbol->aspectRatio();
|
||||
double par = (double)width/height;
|
||||
if (par > ar && ar > 1) {
|
||||
if (par > ar && (ar > 1 || (allow_smaller && height < width))) {
|
||||
width = height * ar;
|
||||
} else if (par < ar && ar < 1) {
|
||||
} else if (par < ar && (ar < 1 || (allow_smaller && width < height))) {
|
||||
height = width / ar;
|
||||
}
|
||||
if (width > height) {
|
||||
|
||||
Reference in New Issue
Block a user