Rotation can now zoom in x and y directions separatly; text can be scaled stretched/compressed horizontally.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@520 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-07-07 16:19:17 +00:00
parent 1646aebc88
commit 9f567a512e
14 changed files with 137 additions and 85 deletions
+1 -1
View File
@@ -134,7 +134,7 @@ void TextViewer::drawSeparators(RotatedDC& dc) {
bool TextViewer::prepare(RotatedDC& dc, const String& text, TextStyle& style, Context& ctx) {
if (lines.empty()) {
// not prepared yet
Rotater r(dc, style.getRotation());
Rotater r(dc, style.getRotationNoStretch());
prepareElements(text, style, ctx);
prepareLines(dc, text, style, ctx);
return true;
+2 -2
View File
@@ -35,8 +35,8 @@ void ChoiceValueViewer::draw(RotatedDC& dc) {
} else if(style().render_style & RENDER_TEXT) {
// also drawing text, use original size
} else {
img_options.width = (int) dc.trS(style().width);
img_options.height = (int) dc.trS(style().height);
img_options.width = (int) dc.trX(style().width);
img_options.height = (int) dc.trY(style().height);
img_options.preserve_aspect = style().alignment == ALIGN_STRETCH ? ASPECT_STRETCH : ASPECT_FIT;
}
Image image = img.generate(img_options, true);
+1 -1
View File
@@ -93,7 +93,7 @@ void ColorValueViewer::onStyleChange(bool already_prepared) {
void ColorValueViewer::loadMask(const Rotation& rot) const {
if (style().mask_filename().empty()) return; // no mask
int w = (int) rot.trS(style().width), h = (int) rot.trS(style().height);
int w = (int) rot.trX(style().width), h = (int) rot.trY(style().height);
if (alpha_mask && alpha_mask->size == wxSize(w,h)) return; // mask loaded and right size
// (re) load the mask
Image image;
+3 -3
View File
@@ -22,7 +22,7 @@ void ImageValueViewer::draw(RotatedDC& dc) {
InputStreamP image_file = getSet().openIn(value().filename);
Image image;
if (image.LoadFile(*image_file)) {
image.Rescale((int)dc.trS(style().width), (int)dc.trS(style().height));
image.Rescale((int)dc.trX(style().width), (int)dc.trY(style().height));
// apply mask to image
loadMask(dc);
if (alpha_mask) alpha_mask->setAlpha(image);
@@ -34,7 +34,7 @@ void ImageValueViewer::draw(RotatedDC& dc) {
}
// if there is no image, generate a placeholder
if (!bitmap.Ok()) {
UInt w = (UInt)dc.trS(style().width), h = (UInt)dc.trS(style().height);
UInt w = (UInt)dc.trX(style().width), h = (UInt)dc.trY(style().height);
loadMask(dc);
if (style().default_image.isReady()) {
// we have a script to use for the default image
@@ -85,7 +85,7 @@ void ImageValueViewer::onStyleChange(bool already_prepared) {
void ImageValueViewer::loadMask(const Rotation& rot) const {
if (style().mask_filename().empty()) return; // no mask
int w = (int) rot.trS(style().width), h = (int) rot.trS(style().height);
int w = (int) rot.trX(style().width), h = (int) rot.trY(style().height);
if (alpha_mask && alpha_mask->size == wxSize(w,h)) return; // mask loaded and right size
// (re) load the mask
Image image;
+2 -2
View File
@@ -56,8 +56,8 @@ void MultipleChoiceValueViewer::draw(RotatedDC& dc) {
} else if(style().render_style & RENDER_TEXT) {
// also drawing text, use original size
} else {
img_options.width = (int) dc.trS(style().width);
img_options.height = (int) dc.trS(style().height);
img_options.width = (int) dc.trX(style().width);
img_options.height = (int) dc.trY(style().height);
img_options.preserve_aspect = style().alignment == ALIGN_STRETCH ? ASPECT_STRETCH : ASPECT_FIT;
}
Image image = img.generate(img_options, true);