Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, July 30, 2007 2:03:13 AM(UTC)

manju  
manju

Groups: Registered
Posts: 49


Hi,

Is there any way to insert a image in a shape instead of just setting a fore color and backcolor of that shape as shown in leadtools 15 RasterImagePro/SpecialEffects example,check the below code snippet in that i have set the img i.e the Bitmap object to image i want to display as a background of shape but with this code i am getting only transperent shape with red background.

_processor.Draw3dShape(
rasterImageViewer1.Image.CreateGdiPlusGraphics().Graphics,
SpecialEffectsShape.Pentagon,
rc,
Color.Red,
img,
rc,
SpecialEffectsBackStyle.Translucent,
Color.Transparent,
SpecialEffectsFillStyle.Transparent,
Color.Red,
SpecialEffectsBorderStyle.Solid,
2,
Color.Green,
Color.Yellow,
SpecialEffectsInnerStyle.Raised,
2,
Color.Turquoise,
Color.Snow,
SpecialEffectsOuterStyle.Inset,
2,
5,
5,
Color.Black,
null);

so how should i set a image to a shape ,if possible give me sample code for that.

Thanks
Manju
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, July 31, 2007 9:54:38 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


Most likely, you are not creating the Image (img in your snippet) properly or you are using the wrong kind of style.  Try using the SpecialEffectBackStyle.TiledImage instead of Translucent.  Below is a sample that I modified slightly from the help file and it worked for me:


RasterCodecs.Startup();
codecs = new RasterCodecs();
rasterImageViewer1.Image = codecs.Load(@"C:\Program Files\LEAD Technologies, Inc\LEADTOOLS 15\Images\IMAGE1.CMP");

SpecialEffectsProcessor processor = new SpecialEffectsProcessor();
Image image = Image.FromFile(@"C:\Program Files\LEAD Technologies, Inc\LEADTOOLS 15\Images\Ulay1.bmp");
Rectangle imageRect = new Rectangle(0, 0, image.Width, image.Height);
Graphics g = rasterImageViewer1.Image.CreateGdiPlusGraphics().Graphics;
Rectangle destRect = new Rectangle(0, 0, rasterImageViewer1.Image.Width, rasterImageViewer1.Image.Height);

processor.Draw3dShape(g,
                     SpecialEffectsShape.Star4, /* star shape */
                     destRect,  /* destination rectangle */
                     Color.Blue, /* background color, blue */
                     image, /* use this to place an image in the background */
                     imageRect, /* display background rectangle */
                     SpecialEffectsBackStyle.TiledImage,  /* style flags for 3D shape */
                     Color.Red, /* foreground color, red */
                     SpecialEffectsFillStyle.Transparent, /* foreground style */
                     Color.Red, /* border color, red */
                     SpecialEffectsBorderStyle.Solid, /* border style */
                     5, /* border width */
                     Color.White, /* inner band highlight color, white */
                     Color.Gray, /* inner band shadow color */
                     SpecialEffectsInnerStyle.Inset, /* inner band style */
                     3, /* inner band width */
                     Color.Red, /* outer band highlight color, RED */
                     Color.Gray, /* outer band shadow color */
                     SpecialEffectsOuterStyle.Inset,/* outer band style */
                     3, /* outer band width */
                     2, /* horizontal shadow position */
                     2, /* vertical shadow position */
                     Color.Black, /* shadow color, black */
                     null);    /* no region handle */
rasterImageViewer1.Invalidate();
image.Dispose();
RasterCodecs.Shutdown();



 
#3 Posted : Tuesday, July 31, 2007 8:51:21 PM(UTC)

manju  
manju

Groups: Registered
Posts: 49


Hi,

Thanks for early reply it works fine but I dont want to set tiled image I want only single image in shapes background so how should i do it using leadtools 15 and c# .net.Please reply soon.


Thanks
Manju
 
#4 Posted : Thursday, August 2, 2007 11:07:07 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


Unfortunately, there aren't any flags such as "StretchedImage", but you could work around the issue by resizing the System.Drawing.Image object you use as the background.  If you make the image size the same size as or larger than the bounding rectangle of the shape then this should work.
 
#5 Posted : Thursday, August 2, 2007 8:20:57 PM(UTC)

manju  
manju

Groups: Registered
Posts: 49


Hi,

Thanks it works fine,should i able to move that shape and also want rotate points and gripper to that shape,is it possible?
Please reply soon.


Thanks
Manju
 
#6 Posted : Monday, August 6, 2007 5:37:16 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


Draw3dShape doesn't have any parameters that would allow you to rotate the shapes when drawing them.  Any mouse-driven movement would need to be done with regular GDI and Windows programming to draw the handles, outlines (if wanted), and tracking the coordinates of the mouse event.  Check out MSDN for that kind of documentation.  All you should need to do on the LEADTOOLS side for moving is change the destination rectangle.

As far as the rotation goes, the only way I could see this working would be to have a blank temporary RasterImage that you draw the shape on rotate it, then select the region that is NOT the background color and then combine that onto the image in your viewer.  However, you will also need a backup image of your viewer's image since combining is actually altering the bitmap data while Draw3dShape is not.  It could work, but it will obviously take up much more processing time and memory.

If you want to be able to draw, move, and rotate objects around on the viewer, I'd suggest using the Annotations from the Document Imaging and higher toolkits.  They won't look exactly the same as the 3d Shapes, but you could make a custom annotation that could be close.  The automated annotations can take care of all of the moving and rotating for you, but if you wanted to use non-automated annotaions, the low level annotations demo that ships with the toolkit shows how to implement the moving and rotating grippers.
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.208 seconds.