## RotateImage changed black

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

### RotateImage changed black

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....

Saangyoon
Member

Posts: 1
Joined: July 14th, 2006, 12:09 am
Location: the South Korea

Did you check it out with different values of Transparent property? The component uses different methods to draw transparent and opaque images.
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

### Same problem

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.
jjoss
Active Member

Posts: 6
Joined: November 12th, 2006, 5:53 pm

I'll try to resolve the problem.
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

### transparent

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.
Attachments
arrow.gif (1.49 KiB) Viewed 7071 times
jjoss
Active Member

Posts: 6
Joined: November 12th, 2006, 5:53 pm

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.
Johnny_Bit
VIP Member

Posts: 455
Joined: June 15th, 2003, 9:56 am

### Any news?

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!
jjoss
Active Member

Posts: 6
Joined: November 12th, 2006, 5:53 pm

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.
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

### Range check error

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.
jjoss
Active Member

Posts: 6
Joined: November 12th, 2006, 5:53 pm

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.
Johnny_Bit
VIP Member

Posts: 455
Joined: June 15th, 2003, 9:56 am

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.
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

### Nope :(

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.
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.
jjoss
Active Member

Posts: 6
Joined: November 12th, 2006, 5:53 pm

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)
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.
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

### Seems to be fine now!

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!
jjoss
Active Member

Posts: 6
Joined: November 12th, 2006, 5:53 pm