Page 1 of 1

RotateImage changed black

PostPosted: July 14th, 2006, 12:25 am
by Saangyoon
Hello,
Thanks for your TRotateImage(V1.52).
TRotateImage is useful to me.

but, I found trouble which image changed black sometimes.
(When both Editing Mode and Runtime mode)


I need to know how to solve this problem, Please.

Thanks

(Delphi 7 Enterprise/ OS: MS-WindowsXPsp2)

when angle was changed 0 deg, it was changed the original state.
but after rotating, image changed black color....


:oops:

PostPosted: August 4th, 2006, 1:23 pm
by Kambiz
Did you check it out with different values of Transparent property? The component uses different methods to draw transparent and opaque images.

Same problem

PostPosted: November 12th, 2006, 5:56 pm
by jjoss
I have the same problem. After some time image became a black rotating rectangle. I've tried it with transparency true/false. It comes black in both cases.

PostPosted: November 13th, 2006, 9:04 am
by Kambiz
I'll try to resolve the problem.

transparent

PostPosted: November 13th, 2006, 9:23 am
by jjoss
I have some more information. It seems to happen when I used gif with transparency. Even when I set Transparent property to False. Image is attached (arrow.gif). Yesterday evening I tried to convert the image to jpeg and haven't seen the problem for an half an hour run. While with gif it appeared in 5-10 minutes of run. So I assume this happens only when an image has transparency. Maybe pallette is broken.
And one more thing that could help. Image becomes not purely black. I saw some dark-grey shadows of an arrow contour. It seems that image bits are there, but something happens with colors.

PostPosted: November 13th, 2006, 2:45 pm
by Johnny_Bit
Hmm... maybe for advanced graphics support (like transparent gif, pngs, or others) we should consider using GraphicEx or something like that, maybe that would help. Extreme way around this is write own handlers for graphic files.

Any news?

PostPosted: January 18th, 2007, 8:48 pm
by jjoss
Kambiz wrote:I'll try to resolve the problem.

Have you managed to solve the problem. I've tried different ways, saved my picture in jpg, bmp, gif, with different palettes, with and without transparancy. But I can't get rid of this black rectangle!

PostPosted: January 19th, 2007, 12:14 am
by Kambiz
I think that I could resolve the issue. Please download the update and let me know about the result.

As a hint, in Delphi 7 with XP Themes active, if you put RotateImage (or other transparent control) on a panel, set the panel's ParentBackground property to False.

Range check error

PostPosted: January 20th, 2007, 5:55 pm
by jjoss
Now I get a range check error on line 245 of RotImg.pas
Which is correct way to update the component? I just updated all files from the .zip in my borland/lib folder and deleted .dcu files.

PostPosted: January 20th, 2007, 7:00 pm
by Johnny_Bit
Oh! Man, I wouldn't do it that way, better way around is to have components placed into separate folders build independently and so on. That way you won't run into trouble. now from my experience either you blew the installation or Kambiz messed some thing's up. Because latter is less possible I say check again.

PostPosted: January 20th, 2007, 10:28 pm
by Kambiz
Johnny_Bit is absolutely right.

In the other hand, range check is set off inside DELPHIAREA.INC. Therefore, if you was installed and built the component correctly, you should not get a range ckeck error at all.

Nope :(

PostPosted: January 21st, 2007, 9:40 am
by jjoss
Kambiz, unfortunately, I see the same problem. Now I'm absolutely sure that I have version 1.53. But the problem still exists.
I have rather complicated multithreaded app which works with serial port. As for form design, RotateImage is placed on a panel, which is placed on a page control, which is placed on a panel on the main form. All panels have ParentBackground = false and I don't use XP style. Delphi 7. WinXP has all current updates.
Currently I've made a workaround with your ImageWork. So this is not very urgent for me.
Instead of
Code: Select all
ImageAngle.Angle := 360-Angle;
I use
Code: Select all
ImageWork.Transform.Rotation := 360-Angle;
ImageWork.ApplyTransform(ImageAngleSource.Picture.Graphic);
ImageAngle.Picture.Assign(ImageWork.Output);

It works fine.
By the way, is that correct? I worry about correct usage to avoid mem leaks.
And another related question. Is there an easy way to avoid image flickering?

PS
Possibly, I could send you my app, but I'm not sure I can extract only the code related to RotateImage.

PostPosted: January 21st, 2007, 2:23 pm
by Kambiz
Your code to use ImageWork is correct. Of course, recently I've made some improvements in the ImageWork package, that is not released on the website. Remember if you upgraded to the new release of ImageWork, you must adapt your code.

Regarding to flickering, put your image control (TImage or TRotateImage) on a panel, the on OnCreate of your form set the panel's DoubleBuffered property to True.

Let's back to RotateImage issue. Did you test your image with RotateImage demo? If you tell me how to regenerate the problem using the demo program, I find a way to fix it. However, I still believe thetre's something wrong in your code, because I do not see any problem in the demo. I do suggest to:

  1. Close Delphi 7
  2. Delete all RotateImage files (be sure no dcu is left hidden somwhere)
  3. Download RotateImage again
  4. Extract the zip file in directroy "MyLib" under Delphi7 directroy
  5. Run Delphi 7
  6. Select "Component/Install Component" from the Delphi's menu bar
  7. Go to "Into new package" tab
  8. For "unit file name" field, click browse and select "RotImg.pas" and "RotImgReg.pas" from "MyLib" directory
  9. Append ";$(DELPHI)\MyLib" to "Search path" field.
  10. Enter "MyPackage.dpk" for "Package file name"
  11. Enter "My Miscellaneous Components" as "Package description"
  12. Click "OK" button and confirm the next dialog.
Later, you can open "MyPackage.dpk" and add other components to the package and re-build it.

Seems to be fine now!

PostPosted: January 22nd, 2007, 8:34 am
by jjoss
Kambiz, thanks a lot!
I've tried it yesterday evening and haven't seen the black rectangle. I'll try some more, but hope that this bug is gone. Strange that component was not updated on my first attempt. I removed all RotImg*.* files.
Again, thanks for your responce and advices!