06-10-2010 01:28 PM
Hi
I am using a GIF image for drawing the loading bar
The image is a black & white gif image i.e its black image with white animation on it. but problem is when i tried to load the image during the encodedImage its having corruption when the fading effect is shown. I have tried the the implementation with animation thread. Also I tried by drawing the image in a class which extends BitMapField. still the problem persists. Any idea on such an issue
Solved! Go to Solution.
06-10-2010 01:47 PM
Can you describe the problem in detail you see when you use the gif Animation from the Knowledgebase again. Does it look like the image is not being updated correctly?
I have had problems using that with certain gifs and have reworked to suit. This seems to depend on the type of gif. In other words, the standard code works for some gifs, my changed code works for others. I presume if you had an animation editor you could look at the various gifs and figure out the difference and probably the reason.
06-10-2010 01:53 PM
yes
when i use the implementation given in the knowledge base the image is not coming properly it looks like corrupted. for the same code other gifs were working properly.
I have also tried changing the extension to bin .If u have any workaround can u share it . Is there any standard encoding formats for these images which will work in blackberry
06-10-2010 04:59 PM
This is the code I had to use for some gifs:
Standard paint:
protected void paint(Graphics graphics)
{
//Call super.paint. This will draw the first background
//frame and handle any required focus drawing.
super.paint(graphics);
//Don't redraw the background if this is the first frame.
if (_currentFrame != 0)
{
//Draw the animation frame.
graphics.drawImage(_image.getFrameLeft(_currentFra me), _image.getFrameTop(_currentFrame),
_image.getFrameWidth(_currentFrame), _image.getFrameHeight(_currentFrame), _image, _currentFrame, 0, 0);
}
}
The paint I used:
protected void paint(Graphics graphics)
{
for ( int i = 0; i <= _currentFrame; i ++ ) {
graphics.drawImage(_image.getFrameLeft(i),
_image.getFrameTop(i),
_image.getFrameWidth(i),
_image.getFrameHeight(i),
_image,
i,
0, 0);
}
}
06-13-2012 07:07 AM
I have tried the solution given at
to rotate the GIF image in progress dialog. But it'll gives an effect like the rotation of image get stopped for few milliseconds whenever the painting of the last frame of an image get completed
Your solution has solved above mention issue. But it seems that this might have some performance issue because graphics.drawImage() will be called n! times. Is there any way to rotate the GIF image by calling graphics.drawImage for just n times (n = total number of frames in GIF image)?