Rank: Advanced Member
Groups: Member, Administration, Moderator Joined: 7/28/2003(UTC) Posts: 1,659
Thanks: 5 times Was thanked: 76 time(s) in 74 post(s)
|
I have been asked several time about quality meter algorithm, in order to understand how it works. Here is Java code for it: Code: public static ArrayList init(
Color topColor,
Color middleColor,
Color bottomColor,
ArrayList qualityMeterFormats,
int imageWidth,
int imageHeight)
{
ArrayList result = new ArrayList();
for (int i = 0; i < qualityMeterFormats.size(); i++)
{
QualityMeterFormat qualityMeterFormat = (QualityMeterFormat)qualityMeterFormats.get(i);
int formatWidth = qualityMeterFormat._width;
int formatHeight = qualityMeterFormat._height;
if (formatWidth < formatHeight)
{
int thirdGlass = formatWidth;
formatWidth = formatHeight;
formatHeight = thirdGlass;
}
if (imageWidth < imageHeight)
{
int thirdGlass = imageWidth;
imageWidth = imageHeight;
imageHeight = thirdGlass;
}
Color color;
if ( imageWidth >= formatWidth
&& imageHeight >= formatHeight)
{
color = bottomColor;
}
else
if ( Math.round((double)imageWidth * qualityMeterFormat._maxRatio) >= formatWidth
&& Math.round((double)imageHeight * qualityMeterFormat._maxRatio) >= formatHeight)
{
color = middleColor;
}
else
{
color = topColor;
}
result.add(color);
}
return result;
}
Edited by user Wednesday, December 19, 2007 3:41:57 AM(UTC)
| Reason: Not specified |
Best regards, Fedor Skvortsov
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.