fast overlay display

Discussions about image processing and document imaging.
Post Reply
Didier
Posts: 5
Joined: Tue Jun 05, 2007 10:20 am

fast overlay display

Post by Didier » Tue Jun 05, 2007 10:57 am

Hello,
i am reactiving this subject
[Link to the old forum deleted]

because i didnt have any feedback.

When we do have a scene, or lets say a background zoomable .jpg picture, and we want to add dynamically element on this map (icons, or small jpg), do we have to redraw the whole scene+objects, or is there a way of recomputing only the changes ?

problem is that when backround picture is big, redisplaying the whole stuff leads to clipping,

Thanks

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Post by Loïc » Tue Jun 05, 2007 11:48 am

Hi,

If I understand what you want to do is to dispay a large image file with the gdviewer object and to display over it other smallest pictures/images ?


You can do that easily:

- Catch the Displayed() event of the GdViewer object.
- Use a cGdPicture object to draw image on HDC: DisplayImageOnHDC() method

vb6 sample code:

Code: Select all

Dim oGdPicture As New GdpicturePro.cGdPicture
Dim nIcoHandle As Long


Private Sub Command1_Click()
oGdViewer.DisplayFromFile (Text2.Text)
End Sub

Private Sub Form_Load()
  oGdViewer.SetLicenceNumber ("0012345678910111213141516") 'Demo code version
  nIcoHandle = oGdPicture.CreateImageFromFile("icon.ico")
End Sub

Private Sub oGdViewer_Displayed()
  Call oGdPicture.SetNativeImage(nIcoHandle)
  Call oGdPicture.DisplayImageOnHDC(oGdViewer.hDC, 1, 1, 100, 100)
End Sub

You can download this demo project from here:
https://www.gdpicture.com/ressources/support/overlay.zip


Best regards,

Loïc Carrère

Didier
Posts: 5
Joined: Tue Jun 05, 2007 10:20 am

Post by Didier » Tue Jun 05, 2007 2:10 pm

hi Loic thanks for replying,

if i do the OnHDC, will the icon be zoomed in zoomed out as well ?!


Didier

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Post by Loïc » Tue Jun 05, 2007 2:44 pm

Hi,
if i do the OnHDC, will the icon be zoomed in zoomed out as well ?!

I don't understand the question :?

Loïc

Didier
Posts: 5
Joined: Tue Jun 05, 2007 10:20 am

Post by Didier » Tue Jun 05, 2007 3:09 pm

i mean, if i display an ico using the DisplayImageOnHDC(),
then zoom in the whole scene using the mouse, will the ico be zoomed in as well ?

actually maybe if i capture the ZoomChanged event and call gdObject.Resize() to match the new zoom it will do it ?

i need to place lot of object on the map and move them around, i need them to be zoomable (to follow the main map scale)

Didier
Posts: 5
Joined: Tue Jun 05, 2007 10:20 am

Post by Didier » Tue Jun 05, 2007 7:29 pm

actually, how can i remove the gdobject from the viewver once it has beeen placed using DisplayOnHDC() ??

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Post by Loïc » Wed Jun 06, 2007 3:55 pm

actually, how can i remove the gdobject from the viewver once it has beeen placed using DisplayOnHDC() ??

You have just to call the Refresh() method of the gdviewer control and don't call thes lines:

Code: Select all

Call oGdPicture.SetNativeImage(nIcoHandle) 
 Call oGdPicture.DisplayImageOnHDC(oGdViewer.hDC, 1, 1, 100, 100) 
You can do something like that:

Code: Select all

Dim bWantDisplayItems  As Boolean 'Public Var

bWantDisplayItems = False
Call oGdViewer.Refresh()
bWantDisplayItems = True


Private Sub oGdViewer_Displayed() 
  If bWantDisplayItems Then
     Call oGdPicture.SetNativeImage(nIcoHandle) 
     Call oGdPicture.DisplayImageOnHDC(oGdViewer.hDC, 1, 1, 100, 100) 
  End If
End Sub 

Didier
Posts: 5
Joined: Tue Jun 05, 2007 10:20 am

Post by Didier » Wed Jun 06, 2007 5:27 pm

sorry i am a bit lost.

what the refresh does ??! in the doc there is no explanation,
what is the diff between refresh redraw ?

if i do refresh will it be faster than redraw?

oneuser
Posts: 10
Joined: Wed May 23, 2007 11:12 am

Post by oneuser » Thu Jun 07, 2007 2:18 pm

Hi,

Sorry, you are right.

You have to call the Redraw() method and not the Refresh().

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest