Re: image from C routine to be displayed in a frame
From: Bruce Hartweg (bruce-news_at_hartweg.us)
Date: 07/21/04
- Next message: miguel sofer: "Re: [Urgent :-)] How you cancel the effect of upvar?"
- Previous message: George Peter Staplin: "Re: image from C routine to be displayed in a frame"
- In reply to: lucie: "Re: image from C routine to be displayed in a frame"
- Next in thread: lucie: "Re: image from C routine to be displayed in a frame"
- Reply: lucie: "Re: image from C routine to be displayed in a frame"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 21 Jul 2004 01:33:31 GMT
lucie wrote:
> hgiese@ratiosoft.com (Helmut Giese) wrote in message news:<40fc2439.1739851@News.Individual.DE>...
>
>>On 19 Jul 2004 10:13:04 -0700, lucepz@caramail.com (lucie) wrote:
>>
>>
>>>Hi there,
>>>
>>>I'm working on Windows NT and using Tck/tk 8.4.
>>>My problem is the following: I'm trying to display an image processed
>>>in a C procedure in my GUI on Tk. The image has the MIL (Matrow
>>>Imaging Lib) format and the MIL function used to display the buffer
>>>needs a window handle. But I want to display it in a canvas or frame
>>>instead of a window...How to "convert" my frame/canvas into a window ?
>>>Any idea?
>>
>>Hi Lucy,
>>[winfo id <your window>] should be of help here. However, IIRC I
>>needed to do some experimenting, which was the _real_ window I needed.
>>Use [winfo parent ...] and [winfo children ...] to obtain all windows,
>>your app consists of and then play around feeding each of them to your
>>library until you hit the right one.
>>HTH
>>Helmut Giese
>
>
>
> thanks for your help;
> I've tried the solution of Helmut by using [winfo id/winfo
> parent/winfo children] commands that gave me the handle of a canvas in
> which I can now display my MIL image.
> However, I'm trying to display a sequence of MIL images thanks to a
> loop in tk; I give the name of image and my C routine allocated a
> buffer to store the data. I'm using the update command but the images
> don't stop flashing in the canvas. I thought I needed to update
> images: a label I wanted to be displayed on each image required to be
> updated with [update]...
> I'd like my images and their label to be continuously displayed in the
> canvas...
> Does it make sense?
>
yes it makes sense. The problem you are seeing is that you are fighting
the widgets instead of using them. when you just get the window ID and
draw right to it, the canvas has no idea that you have a pretty picture
displayed, and it's own drawing routines will then just clear it and draw
what it thinks should be there.
So the trick is to let the canvas draw it for you. The canvas knows how
to draw images, so let it. All you need to do is create a new image type,
or a new format handler for the existing photo type. In both cases you
just need to implement a few procedures (see links below). I am not
versed in the details of the MIL format, but adding a format handler
for the "photo" type might be slightly easier, but it could be slower
as you would actually be converting you image to the photo type. it would
probably be be a better move to create a new image type entirely.
<http://www.tcl.tk/man/tcl8.4/TkLib/CrtImgType.htm>
<http://www.tcl.tk/man/tcl8.4/TkLib/CrtPhImgFmt.htm>
Good luck,
Bruce
- Next message: miguel sofer: "Re: [Urgent :-)] How you cancel the effect of upvar?"
- Previous message: George Peter Staplin: "Re: image from C routine to be displayed in a frame"
- In reply to: lucie: "Re: image from C routine to be displayed in a frame"
- Next in thread: lucie: "Re: image from C routine to be displayed in a frame"
- Reply: lucie: "Re: image from C routine to be displayed in a frame"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|