C INTERNATIONAL AVS CENTER C (This disclaimer must remain at the top of all files) C C WARRANTY DISCLAIMER C C This module and the files associated with it are distributed free of charge. C It is placed in the public domain and permission is granted for anyone to use, C duplicate, modify, and redistribute it unless otherwise noted. Some modules C may be copyrighted. You agree to abide by the conditions also included in C the AVS Licensing Agreement, version 1.0, located in the main module C directory located at the International AVS Center ftp site and to include C the AVS Licensing Agreement when you distribute any files downloaded from C that site. C C The International AVS Center, MCNC, the AVS Consortium and the individual C submitting the module and files associated with said module provide absolutely C NO WARRANTY OF ANY KIND with respect to this software. The entire risk as to C the quality and performance of this software is with the user. IN NO EVENT C WILL The International AVS Center, MCNC, the AVS Consortium and the individual C submitting the module and files associated with said module BE LIABLE TO C ANYONE FOR ANY DAMAGES ARISING FROM THE USE OF THIS SOFTWARE, INCLUDING, C WITHOUT LIMITATION, DAMAGES RESULTING FROM LOST DATA OR LOST PROFITS, OR ANY C SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES. C C This AVS module and associated files are public domain software unless C otherwise noted. Permission is hereby granted to do whatever you like with C it, subject to the conditions that may exist in copyrighted materials. Should C you wish to make a contribution toward the improvement, modification, or C general performance of this module, please send us your comments: why you C liked or disliked it, how you use it, and most important, how it helps your C work. We will receive your comments at avs@ncsc.org. C C Please send AVS module bug reports to avs@ncsc.org. C C mod_gen Version 1 C Module Name: "endif" (Input) (Subroutine) C Author: Dr. John Tee, Consultant, AVS Inc. UK C Date Created: Wed May 27 10:27:45 1992 C C This file is automatically generated by the Module Generator (mod_gen) C Please do not modify or move the contents of this comment block as C mod_gen needs it in order to read module sources back in. C C input 0 "In0" field REQUIRED C input 1 "In1" field REQUIRED C output 0 "Out" field C param 0 "Flag" toggle 0 0 1 C End of Module Description Comments C **************************************** C Module Specification C **************************************** integer function endif_spec() implicit none C IAC CODE CHANGE : include 'avs/avs.inc' INCLUDE '/usr/avs/include/avs.inc' integer in_port, out_port, param external endif_compute integer endif_compute call AVSset_module_name('endif', 'data') call AVSset_module_flags(single_arg_data) C Input Port Specifications in_port = AVScreate_input_port('In0', 'field', REQUIRED) in_port = AVScreate_input_port('In1', 'field', REQUIRED) C Output Port Specifications out_port = AVScreate_output_port('Out', 'field') C Parameter Specifications param = AVSadd_parameter('Flag', 'boolean', 0, 0, 1) call AVSconnect_widget(param, 'toggle') call AVSset_compute_proc(endif_compute) C ----> START OF USER-SUPPLIED CODE SECTION #2 (ADDITIONAL SPECIFICATION INFO) C <---- END OF USER-SUPPLIED CODE SECTION #2 endif_spec = 1 return end C **************************************** C Module Compute Routine C **************************************** integer function endif_compute( In0, In1, Out, Flag) implicit none C IAC CODE CHANGE : include 'avs/avs.inc' INCLUDE '/usr/avs/include/avs.inc' integer In0 integer In1 integer Out integer Flag C THIS IS A 'HINTS' AREA - YOU MAY CUT AND PASTE AT WILL FROM IT C integer dimsi, dims0, dims1 dimension dimsi(10), dims0(10), dims1(10) C Output template (copy basic information from input to alloc output) integer template integer comdimi, dsize integer pixptr, optr, iptr integer ixs, iys, i, j, k, iargb, iresult C Processing routine C integer JTfield_copy_image C C Free old field data if (Out .ne. 0) call AVSfield_free(Out) C C Get select information from the input field C Dimensions of resulting field are the same as input field if(flag. eq. 0)then comdimi = AVSfield_get_int(In0, avs_field_ndim) iresult = AVSfield_get_dimensions(In0, dimsi) C Build a template from the input field and modify it to help allocate C the output field. Set to 0 to force creation of a template field C structure. template = 0 iresult = AVSfield_make_template(In0, template) else comdimi = AVSfield_get_int(In1, avs_field_ndim) iresult = AVSfield_get_dimensions(In1, dimsi) template = 0 iresult = AVSfield_make_template(In1, template) endif C Allocate the output field using the template field C This automatically allocates the data array (and points if needed) C copies the provided dimensions into the fields dimensions array C and sets the field description information - uniform, etc. C Free the template when completed. Out = AVSfield_alloc(template, dimsi) call AVSfield_free(template) C THIS IS THE END OF THE 'HINTS' AREA. ADD YOUR OWN CODE BETWEEN THE C FOLLOWING COMMENTS. THE CODE YOU SUPPLY WILL NOT BE OVERWRITTEN. C ----> START OF USER-SUPPLIED CODE SECTION #3 (COMPUTE ROUTINE BODY) C This doesn't seem to work (perhaps because it is for coordinates only) C - there must be a similar routine i(AVSfield_copy_data?) which does! C if(flag .eq. 0)iresult = AVSfield_copy_points(In, Outif0) C if(flag .eq. 1)iresult = AVSfield_copy_points(In, Outif1) C In the mean-time, try copying bytes, at the expense of speed and generality ixs = dimsi(1) iys = dimsi(2) optr = AVSfield_data_ptr(Out) if(flag.eq.0)then iptr = AVSfield_data_ptr(In0) else iptr = AVSfield_data_ptr(In1) endif C iresult = JTfield_copy_image(iptr, optr, ixs, iys) do j=1, iys pixptr = (j-1) * ixs * 4 do i=1,ixs do iargb=0, 3 k = AVSload_byte(iptr,pixptr) call AVSstore_byte (optr, pixptr, k) pixptr = pixptr + 1 enddo enddo enddo C ----> START OF USER-SUPPLIED CODE SECTION #3 (COMPUTE ROUTINE BODY) C <---- END OF USER-SUPPLIED CODE SECTION #3 endif_compute = 1 return end C ********************************************************************** C Initialization for modules contained in this file. C ********************************************************************** subroutine AVSinit_modules C IAC CODE CHANGE : include 'avs/avs.inc' INCLUDE '/usr/avs/include/avs.inc' external endif_spec integer endif_spec call AVSmodule_from_desc(endif_spec) end C ----> START OF USER-SUPPLIED CODE SECTION #4 (SUBROUTINES, FUNCTIONS, UTILITY ROUTINES) C <---- END OF USER-SUPPLIED CODE SECTION #4