Rank: Advanced Member
Groups: Guest
Joined: 12/17/2007(UTC) Posts: 49
|
Hi, we have a BitmapViewer control on which we load pictures. After this, we add some Vobjects like rectangle, line, polyline, text as you can see in file attached. We would like to print the pictures and the Vobjects as we see it in attached file. If for example there was a method like '.Brand()', then the Vobjects would be branded on the native picture and we could have 1 picture with 'branded' or 'drawn' Vobjects on picture. How we can do this? cpav attached the following image(s):
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 1/31/2005(UTC) Posts: 458
Was thanked: 5 time(s) in 5 post(s)
|
Hello,
Please take look at the RenderWorkspace(...) method of the VObjectsRubberband - it renders all images on the transparend background. And you can blend the output of this method with the original image to get VObjects drawn.
Another way is to iterate all necessary VObjects and call IVObject.Draw(...) method of each of them. This requires additional code to be written but it will be a bit quicker. So if you are not satisfied with the RenderWorkspace(...) method, you can use this way. Feel free to post a line here if you have any additional questions.
|
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 12/17/2007(UTC) Posts: 49
|
Hi Alex,
well i tried the RenderWorkspace method and the Vobject image is too big, much bigger than the image in BitmapViewer.
Anyway, i think is better to try 2nd method. But can you please give me a sample code in vb .net about for example how to add a rectangle(50,50,100,100) with color red and a also a line with color yellow? Well, if i can have code for those 2, i have something to work on for the rest ones.... When i say sample code, suppose the image is already loaded in BitmapViewer control, and i know all required details for each Vobject i want to draw them on the BitmapViewer.Bitmap.
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 8/3/2003(UTC) Posts: 1,070
Thanks: 1 times Was thanked: 12 time(s) in 12 post(s)
|
Hello,
What resolution do you pass into RenderWorkspace method? It should be the same value as the resolution of the image loaded into BitmapViewer. |
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 12/17/2007(UTC) Posts: 49
|
Hi Dmitry, well you have been right about this i had this code initially Code: Dim newBitmap As Aurigma.GraphicsMill.Bitmap
newBitmap = VObjectsRubberband1.RenderWorkspace(_
BitmapViewer1.Bitmap.HorizontalResolution)
newBitmap.Save("C:\1.tif")
The file saved had 334 MB !!!! So i added a line and now i have this code(notice the Resize) and i get correct resolution and size: Code: Dim newBitmap As Aurigma.GraphicsMill.Bitmap
newBitmap = VObjectsRubberband1.RenderWorkspace( _
BitmapViewer1.Bitmap.HorizontalResolution)
newBitmap.Transforms.Resize(BitmapViewer1.Bitmap.Width, _
BitmapViewer1.Bitmap.Height)
newBitmap.Save("C:\1.tif")
I do not know, if i have to do something different in RenderWorkSpace method, if u have better idea(to avoid resize for performance)...please provide, but for the moment saved file has everything correct. Now i need to blend the image(initial file) and the Vobject-created file so i have a bitmap with 'branded annotation' ON the image, ready to be printed. Can you please send that code for blend? "And you can blend the output of this method with the original image to get VObjects drawn." How to do this with code?
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 8/3/2003(UTC) Posts: 1,070
Thanks: 1 times Was thanked: 12 time(s) in 12 post(s)
|
Hello, You can pass 96.0 (monitor resolution) as resolution parameter into RenderWorkspace method. It should allow you to avoid resize operation. Quote:Now i need to blend the image(initial file) and the Vobject-created file so i have a bitmap with 'branded annotation' ON the image, ready to be printed. Can you please send that code for blend?
Please, read Overlaying Images as reference for your task. Edited by user Wednesday, October 29, 2008 3:13:20 AM(UTC)
| Reason: Not specified |
|
|
|
|
Forum Jump
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.