String Rotation

Saj

Active Member
Licensed User
Is it possible to rotate a string on the device using the ImageLixEx library? I've had a look the help but it didn't quite click.
 

Saj

Active Member
Licensed User
Sorry for being a pain, but I can't find the DrawString sub in any of the examples included in ImageLibEx2.2.zip?
 

mjcoon

Well-Known Member
Licensed User
Thanks agraham for answering my question about loading bitmaps. I hope that my renewed interest in graphics excuses using your mention of ImageLibExDemo.sbp triggering me to have a play with it (maybe not for the 1st time).

Playfully, I tried multiple rotations by 45 degrees (since that was the default that appeared) to see if the image steadily degraded as I expected it to do. Probably it did, but my PC also slowed down alarmingly (I was running under the PC IDE). And eventually I got OOM as per attached pop-up.

(After a while I got a virtual memory warning too, but I have been getting those sporadically lately.)

So maybe this demo source is not a good example of how to avoid memory leaks per the explanation of memory use in the ImageLibEx Help file.

Regards, Mike.
 

Attachments

  • rotate-OOM.JPG
    rotate-OOM.JPG
    14.9 KB · Views: 229

agraham

Expert
Licensed User
Longtime User
So maybe this demo source is not a good example of how to avoid memory leaks per the explanation of memory use in the ImageLibEx Help file.
That's not the reason for this observed behaviour. From the help for Rotate -
Rotating a bitmap increases its' size by an amount necessary to accomodate the complete rotated image and the blank space created is filled with the fillcolor specified.
The image gets too big after multiple rotates.
 

mjcoon

Well-Known Member
Licensed User
That's not the reason for this observed behaviour.
The image gets too big after multiple rotates.

Ah, I understand the principle. And no doubt the increase will be geometric (appropriately enough!). But I'm amazed that it was so quickly crippling for my PC. I should do some instrumentation...

Mike.
 

Saj

Active Member
Licensed User
When rotating a string using a RotatedFont object, the string seems to progressively move away from being aligned with the centre of rotation as the angle increases. See attached JPG - black dot is the centre. Any suggestions for getting around this as i'd like the string to still be aligned regardless of the angle?
 

Attachments

  • StringRotation2.jpg
    StringRotation2.jpg
    13.2 KB · Views: 211

mjcoon

Well-Known Member
Licensed User
Ah, I understand the principle. And no doubt the increase will be geometric (appropriately enough!). But I'm amazed that it was so quickly crippling for my PC. I should do some instrumentation...

Although I have not done any instrumentation, it occured to me that I should not have to. If the increase in size of a single bitmap is causing the problem it should be very apparent. This is because the original image will steadily shrink in the centre of the display as if it were being over-zoomed. It will then be obvious how much the number of pixels has been increased and therefore what the memory overhead is becoming. But the shrinkage I observed was not that great. So I still do not understand why a Win-XP PC should have had a problem.

So maybe instrumentation is still needed...

Mike.
 

agraham

Expert
Licensed User
Longtime User
This is because the original image will steadily shrink in the centre of the display as if it were being over-zoomed.
No it won't. The mode of the Image control is cCenterImage. If you don't believe me put a Msgbox in showing the Bitmap Width and Height after each rotation.
 
Top