summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/lib/Emotion.h
diff options
context:
space:
mode:
authorRafael Antognolli <antognolli@gmail.com>2011-08-03 20:58:56 +0000
committerRafael Antognolli <antognolli@gmail.com>2011-08-03 20:58:56 +0000
commit42dabe5fe547313128f5fbd5ab9162615b15e855 (patch)
tree1c982bc4307d6a5c5497cbbd81ed1030f5076ea2 /legacy/emotion/src/lib/Emotion.h
parent7e095c6b707e31adc6ec617dd2aad7a8d89fbcd2 (diff)
emotion/ratio - Explain how to use emotion_object_ratio_get().
SVN revision: 62068
Diffstat (limited to '')
-rw-r--r--legacy/emotion/src/lib/Emotion.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/legacy/emotion/src/lib/Emotion.h b/legacy/emotion/src/lib/Emotion.h
index 198f26a599..cfe27b7f6c 100644
--- a/legacy/emotion/src/lib/Emotion.h
+++ b/legacy/emotion/src/lib/Emotion.h
@@ -552,6 +552,66 @@ EAPI Eina_Bool emotion_object_audio_handled_get (const Evas_Object *obj);
552 * so the aspect won't be changed (by wrongly resizing the object). Or to crop 552 * so the aspect won't be changed (by wrongly resizing the object). Or to crop
553 * the video correctly, if necessary. 553 * the video correctly, if necessary.
554 * 554 *
555 * The described behavior can be applied like following. Consider a given
556 * emotion object that we want to position inside an area, which we will
557 * represent by @c w and @c h. Since we want to position this object either
558 * stretching, or filling the entire area but overflowing the video, or just
559 * adjust the video to fit inside the area without keeping the aspect ratio, we
560 * must compare the video aspect ratio with the area aspect ratio:
561 * @code
562 * int w = 200, h = 300; // an arbitrary value which represents the area where
563 * // the video would be placed
564 * int vw, vh;
565 * double r, vr = emotion_object_ratio_get(obj);
566 * r = (double)w / h;
567 * @endcode
568 *
569 * Now, if we want to make the video fit inside the area, the following code
570 * would do it:
571 * @code
572 * if (vr > r) // the video is wider than the area
573 * {
574 * vw = w;
575 * vh = w / vr;
576 * }
577 * else // the video is taller than the area
578 * {
579 * vh = h;
580 * vw = h * vr;
581 * }
582 * evas_object_resize(obj, vw, vh);
583 * @endcode
584 *
585 * And for keeping the aspect ratio but making the video fill the entire area,
586 * overflowing the content which can't fit inside it, we would do:
587 * @code
588 * if (vr > r) // the video is wider than the area
589 * {
590 * vh = h;
591 * vw = h * vr;
592 * }
593 * else // the video is taller than the area
594 * {
595 * vw = w;
596 * vh = w / vr;
597 * }
598 * evas_object_resize(obj, vw, vh);
599 * @endcode
600 *
601 * Finally, by just resizing the video to the video area, we would have the
602 * video stretched:
603 * @code
604 * vw = w;
605 * vh = h;
606 * evas_object_resize(obj, vw, vh);
607 * @endcode
608 *
609 * The following diagram exemplifies what would happen to the video,
610 * respectively, in each case:
611 *
612 * @image html emotion_ratio.png
613 * @image latex emotion_ratio.eps width=\textwidth
614 *
555 * @note This function returns the aspect ratio that the video @b should be, but 615 * @note This function returns the aspect ratio that the video @b should be, but
556 * sometimes the reported size from emotion_object_size_get() represents a 616 * sometimes the reported size from emotion_object_size_get() represents a
557 * different aspect ratio. You can safely resize the video to respect the aspect 617 * different aspect ratio. You can safely resize the video to respect the aspect