Re: XForms: Problems drawing into a canvas

From: T.C. Zhao (tc_zhao@yahoo.com)
Date: Wed Feb 02 2000 - 09:55:57 EST

  • Next message: Hugh Gibson: "XForms: call_object_callback difficulties"

    # To subscribers of the xforms list from "T.C. Zhao" <tc_zhao@yahoo.com> :

    You need to set image->modified = 1 if data has changed.
    This was not documented clearly in the documentation.

    --- brandym@sbox.tu-graz.ac.at wrote:
    > # To subscribers of the xforms list from brandym@sbox.tu-graz.ac.at :
    >
    > Hi !
    >
    > I experienced some strange behaviour in xforms 0.89 using
    > flimage_display().
    >
    > I try to display an image which has been capture by a frame grabber
    > using a canvas. Here's my source
    >
    >
    > /*********************************************/
    >
    > FL_IMAGE *myimage;
    > unsigned char *image;
    >
    > // here's some init and
    > // the allocation of image according to
    > // the frame size of the grabber
    >
    >
    > while(stay_in_this_loop)
    > {
    > image=grabimage(); // get a new frame
    >
    > if(!(myimage=flimage_alloc()))
    > exit(-1);
    >
    > myimage->type=FL_IMAGE_GRAY;
    > myimage->w=IMAGE_WIDTH;
    > myimage->h=IMAGE_HEIGHT;
    > flimage_getmem(myimage);
    >
    > for(row=0;row<IMAGE_HEIGHT;row++)
    > for(col=0;col<IMAGE_WIDTH;col++)
    > {
    > myimage->gray[row][col]=(unsigned char)image[row*IMAGE_WIDTH+col];
    > }
    >
    > if(flimage_sdisplay(myimage, FL_ObjWin(canvas))<0)
    > exit(-2);
    >
    > flimage_free(myimage);
    >
    >
    > do_some_gui_things();
    > }
    > /*********************************************************/
    >
    > This way it works once. I then tried to copy a new image from the
    > grabber device into the (unsigned char *) image and wanted it
    > to be displayed again - did NOT work !
    > It seems to me as if a initialised FL_IMAGE structure can be
    > displayed once,
    > but if you do any changes to the gray-level data the changes can't
    > be redisplayed.
    > So what I'm doing no is to allocate/free the FL_IMAGE struct every
    > time
    > a new frame arrives from the grabber.
    > Is there a faster/more efficient way to do this ? What am I doing
    > wrong :(
    >
    > Thank you !
    >
    > Markus
    > _________________________________________________
    > To unsubscribe, send the message "unsubscribe" to
    > xforms-request@bob.usuhs.mil or see
    > http://bob.usuhs.mil/mailserv/xforms.html
    > XForms Home Page: http://world.std.com/~xforms
    > List Archive: http://bob.usuhs.mil/mailserv/list-archives/
    >
    >
    __________________________________________________
    Do You Yahoo!?
    Talk to your friends online with Yahoo! Messenger.
    http://im.yahoo.com
    _________________________________________________
    To unsubscribe, send the message "unsubscribe" to
    xforms-request@bob.usuhs.mil or see
    http://bob.usuhs.mil/mailserv/xforms.html
    XForms Home Page: http://world.std.com/~xforms
    List Archive: http://bob.usuhs.mil/mailserv/list-archives/



    This archive was generated by hypermail 2b29 : Wed Feb 02 2000 - 09:58:23 EST