Inserting image file in Dislin widget

218 views
Skip to first unread message

Hitesh

unread,
Apr 4, 2013, 11:30:42 PM4/4/13
to dislin...@googlegroups.com
I am a newbie. Can anyone tell me how to insert image file in Dislin widget with an example?
 
Perhaps INCFIL is used, but I am not getting the result.
 
Thanks.
 
 

Helmut Michels

unread,
Apr 5, 2013, 4:33:29 AM4/5/13
to dislin...@googlegroups.com

Hi,

below is a small modification of the Dislin example map_c.c, that includes an image file in a
draw widget instead of plotting a map. The image is scaled to the Dislin plot page. Note that
you can include PNG, GIF, BMP and TIFF files with the routine INCFIL. The example is written
in C, but it should be easy to convert it to Fortran, or any other language.

Best regards,

Helmut

---------
#include <stdio.h>
#include "dislin.h"

static int id_draw;
void myplot (int id);

int main()
{ int ip, ip1, ip2, id_but, id_quit, id_lab;

  ip = wgini ("hori");
  swgwth (-15);
  ip1 = wgbas (ip, "vert");
  swgwth (-50);
  ip2 = wgbas (ip, "vert");

  swgdrw ((float) (2100./2970.));
  id_but  = wgpbut (ip1, "Plot");
  swgcbk (id_but, myplot);

  id_quit = wgquit (ip1);
  id_lab  = wglab (ip2, "DISLIN Draw Widget:");
  id_draw = wgdraw (ip2);
  wgfin ();
  return 0;


void myplot (int id)
{
  setxid (id_draw, "widget");
  metafl ("cons");
  disini ();
 
  filopt ("on", "scale");
  incfil ("dislin.png");         /* here you can use your own image file */
  disfin ();
}
-----

Hitesh

unread,
Apr 6, 2013, 12:06:28 AM4/6/13
to dislin...@googlegroups.com
Thanks dude!! :-)
Reply all
Reply to author
Forward
0 new messages