Hi,
I have downloaded the Juce-look-and-feel-examples (skinTest program):
and have replaced the image file with my JKnobMan image file for
the slider.
[attachment=2]Original.png[/attachment]
(Screenshot inside XnView)
Left side 3 of 101 knobs and right the original Test Knob from
JKnobMan. One frame size is 50x50. The first image and the test knob
looks like the same. I have zoomed in. But when I start the skinTest
program the image looks like not the same:
[attachment=0]skinTest01.PNG[/attachment]
Left the knob from the program with modules version 2.0.21,
center (blue arrow) the test knob from JKnobMan
and right the knob with the current modules version 2.0.25.
(I have resized in the Jucer the slider to 51x51 and no textbox.)
The ring left looks like thicker and between the ring and the knob is
the color darker (the shadow below too). The right side needs no comment,
something is wrong.
For this program I have used the stable release of Juce v2.0 from
Sourceforge (modules version 2.0.21), MS Visual Studio 2010 Express and
MS Windows 7.
The important code snippet:
[code]void LookAndFeelCustom::drawRotarySlider(Graphics &g,
int x,
int y,
int width,
int height,
float /sliderPosProportional/,
float /rotaryStartAngle/,
float /rotaryEndAngle/,
Slider &slider)
{
/* This is the binary image data that uses very little CPU when rotating */
Image image = ImageCache::getFromMemory(BinaryData::NI_Razor_Knob_png,
BinaryData::NI_Razor_Knob_pngSize);
int imageWidth = image.getWidth();
int imageHeight = image.getHeight();
/* Value between 0 and 1 for current amount of rotation */
const double fractRotation = (slider.getValue() - slider.getMinimum()) / (slider.getMaximum() - slider.getMinimum());
/* Number of frames for vertical film strip */
const int frames = imageHeight / imageWidth;
/* Current index from 0 --> nFrames - 1 */
const int frameIndex = (int) ceil(fractRotation * ((double) frames - 1.0));
const float radius = jmin(width / 2.0f,
height / 2.0f);
const float xCentre = x + width * 0.5f;
const float yCentre = y + height * 0.5f;
const int destX = (int) (xCentre - radius/* - 1.0f*/);
const int destY = (int) (yCentre - radius/* - 1.0f*/);
const int destWidth = 2 * (int) radius;
const int destHeight = 2 * (int) radius;
const int srcX = 0;
const int srcY = frameIndex * imageWidth;
const int srcWidth = imageWidth;
const int srcHeight = imageWidth;
DBG(("LookAndFeelCustom::drawRotarySlider destX:") + String(destX) +
(", destY: ") + String(destY) +
(", destWidth: ") + String(destWidth) +
(", destHeight: ") + String(destHeight)
)
DBG(("LookAndFeelCustom::drawRotarySlider srcX:") + String(srcX) +
(", srcY: ") + String(srcY) +
(", srcWidth: ") + String(srcWidth) +
(", srcHeight: ") + String(srcHeight)
)
//g.setOpacity(1.0f);
g.fillAll(Colour((uint8) 0, (uint8) 0, (uint8) 0, (uint8) 0));
AffineTransform affineTransform = AffineTransform::scale(1.0, 1.0);
g.drawImageTransformed(image.getClippedImage(Rectangle<int>(srcX, srcY, srcWidth, srcHeight)),
affineTransform,
false
);
/*g.drawImage(image,
destX,
destY,
destWidth,
destHeight,
srcX,
srcY,
srcWidth,
srcHeight
);*/
}
[/code]
The next try was to set the âfillAlphaChannelWithCurrentBrushâ to true:
[attachment=1]fillAlphaChannelWithCurrentBrush.png[/attachment]
The shape looks like good but between the ring and the knob the color is darker.
(Right the test knob)
Please, can somebody help me?
Have I consider something?
Is it a bug?
Thanks,
Thomas