xforms-development
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XForms] displaying images


From: alessandro basili
Subject: [XForms] displaying images
Date: Sat, 21 Jan 2012 10:33:23 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1

Hi everyone,

I need to show images from an array and I am trying the following:

<begin pseudo-code>
FL_IMAGE *image;

create_form_with_image() {

  int w, h, i, j;

  begin_form(); // fl_bgn_form is used...

  if (!(image = flimage_alloc())) {
    PANIC("Cannot allocate image"); //exit (1) is used...
  }
  image->type = FL_IMAGE_GRAY16;
  image->w    = w = 128;
  image->h    = h = 128;
  if (!(image->gray = fl_get_matrix (w, h, sizeof (uint16)))) {
    PANIC("Cannot allocate matrix"); //exit (1) is used...
  }

  for(i=0; i<128; i++) {
    for(j=0; j<128; j++) {
      image->gray[i][j] = 128*i+j; // some value...
    }
  }

  if ((flimage_display (image, form->window)) {
    INFO("displaying image"); //printf is used...
  }

  end_form(); // fl_end_form is used...
}

//~----

int main () {

  fl_initialize();
  create_form_with_image();

  while(1) fl_do_forms();
}

<end pseudo-code>

Unfortunately, even though apparently I am able to allocate the image
and the matrix, it looks like I'm not able to display the image.
I have the form created, but I have only a gray square of the size I
expect but nothing else.

Am I missing something basic? I guess so...
If anyone has some example I can look at it would be much appreciated.
Cheers,

Al



reply via email to

[Prev in Thread] Current Thread [Next in Thread]