//
// time: Fri Mar 21 14:22:58 1997
//
// version: 3.1.1 (format), 3.1.4 (DX Beta)
//
//
// Begin MDF
// MODULE InsetImage
// CATEGORY Rendering
// DESCRIPTION Interactive Image window 
// INPUT object; object; (no default);  object to render in inset window
// INPUT renderMode[visible:0]; value or string or object; "software";  set rendering mode to "hardware" or "software"
// INPUT defaultCamera[visible:0]; value list or string list or object; (no default);  default camera to use for inset image
// INPUT resetCamera[visible:0]; object; 0;  whether to reset the camera to defaultCamera
// INPUT bkgndColor[visible:0]; value list or string list or object; "black";  background color of inset image
// INPUT interactionMode[visible:0]; integer; (no default);  rotate (0) pan (1) or zoom (2)
// INPUT offset[visible:0]; vector or value list; [0, 0];  offset of inset image (in pixels) in parent window, from top left
// INPUT parent; window; (no default);  
// INPUT title; string; (no default);  window title
// OUTPUT renderable; object;  
// OUTPUT camera; object;  
// OUTPUT where; window;  
// End MDF
//
// comment: This complex macro allows you to inset an independently interactive image within a larger image.
// page assignment: Main	order=3, windowed=0, showing=1
// page assignment: camera	order=2, windowed=0, showing=0
// workspace: width = 609, height = 626
// layout: snap = 0, width = 50, height = 50, align = NN
//
macro InsetImage(
 object
,renderMode = "software"
,defaultCamera
,resetCamera = 0
,bkgndColor = "black"
,interactionMode
,offset = [0, 0]
,parent
,title
) -> (
 renderable
,camera
,where
) {
    // 
    // node Input[33]: x = 25, y = 27, inputs = 0, label = Input
    // page group: Main
    // parameter: position = 1, name = 'object', value = '(no default)', descriptive = 1, description = ' object to render in inset window', required = 0, visible = 1
    //
InsetImage_Input_33_out_1 = object;
    // 
    // node Transmitter[25]: x = 11, y = 121, inputs = 1, label = inputObject
    // page group: Main
    //
inputObject = InsetImage_Input_33_out_1;
    // 
    // node Receiver[2]: x = 119, y = 5, inputs = 1, label = inputObject
    // page group: camera
    //
InsetImage_Receiver_2_out_1[cache: 0] = inputObject;
    // 
    // node AutoCamera[1]: x = 141, y = 101, inputs = 9, label = AutoCamera
    // page group: camera
    //
InsetImage_AutoCamera_1_out_1 = 
    AutoCamera(
    InsetImage_Receiver_2_out_1,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Input[3]: x = 9, y = 3, inputs = 0, label = Input
    // page group: camera
    // parameter: position = 3, name = 'defaultCamera', value = '(no default)', descriptive = 1, description = ' default camera to use for inset image', required = 0, visible = 0
    //
InsetImage_Input_3_out_1 = defaultCamera;
    // 
    // node Inquire[1]: x = 12, y = 99, inputs = 3, label = Inquire
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "is null + 1"
    // page group: camera
    //
InsetImage_Inquire_1_out_1 = 
    Inquire(
    InsetImage_Input_3_out_1,
    "is null + 1",
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Switch[1]: x = 93, y = 183, inputs = 3, label = Switch
    // page group: camera
    //
InsetImage_Switch_1_out_1 = 
    Switch(
    InsetImage_Inquire_1_out_1,
    InsetImage_Input_3_out_1,
    InsetImage_AutoCamera_1_out_1
    ) [instance: 1, cache: 1];
    // 
    // node Inquire[2]: x = 76, y = 351, inputs = 3, label = Inquire
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "camera aspect"
    // page group: camera
    //
InsetImage_Inquire_2_out_1 = 
    Inquire(
    InsetImage_Switch_1_out_1,
    "camera aspect",
    NULL
    ) [instance: 2, cache: 1];
    // 
    // node Inquire[3]: x = 188, y = 354, inputs = 3, label = Inquire
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "camera resolution"
    // page group: camera
    //
InsetImage_Inquire_3_out_1 = 
    Inquire(
    InsetImage_Switch_1_out_1,
    "camera resolution",
    NULL
    ) [instance: 3, cache: 1];
    // 
    // node Compute[1]: x = 138, y = 434, inputs = 3, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "[$1,int($0*$1 + 0.9)]"
    // page group: camera
    // expression: value = [b,int(a*b + 0.9)]
    // name[2]: value = a
    // name[3]: value = b
    //
InsetImage_Compute_1_out_1 = 
    Compute(
    "[$1,int($0*$1 + 0.9)]",
    InsetImage_Inquire_2_out_1,
    InsetImage_Inquire_3_out_1
    ) [instance: 1, cache: 1];
    // 
    // node Input[37]: x = 84, y = 18, inputs = 0, label = Input
    // page group: Main
    // parameter: position = 9, name = 'title', value = '(no default)', descriptive = 1, description = ' window title', required = 0, visible = 1
    //
InsetImage_Input_37_out_1 = title;
    // 
    // node Transmitter[3]: x = 117, y = 509, inputs = 1, label = defaultWindowSz
    // page group: camera
    //
defaultWindowSz = InsetImage_Compute_1_out_1;
    // 
    // node Receiver[4]: x = 147, y = 4, inputs = 1, label = defaultWindowSz
    // page group: Main
    //
InsetImage_Receiver_4_out_1[cache: 0] = defaultWindowSz;
    // 
    // node Input[34]: x = 279, y = 13, inputs = 0, label = Input
    // page group: Main
    // parameter: position = 7, name = 'offset', value = '[0, 0]', descriptive = 0, description = ' offset of inset image (in pixels) in parent window, from top left', required = 0, visible = 0
    //
InsetImage_Input_34_out_1 = offset;
    // 
    // node Input[35]: x = 335, y = 19, inputs = 0, label = Input
    // page group: Main
    // parameter: position = 8, name = 'parent', value = '(no default)', descriptive = 1, description = ' ', required = 0, visible = 1
    //
InsetImage_Input_35_out_1 = parent;
    // 
    // node Input[4]: x = 567, y = 18, inputs = 0, label = Input
    // page group: Main
    // parameter: position = 4, name = 'resetCamera', value = '0', descriptive = 0, description = ' whether to reset the camera to defaultCamera', required = 0, visible = 0
    //
InsetImage_Input_4_out_1 = resetCamera;
    // 
    // node Transmitter[19]: x = 504, y = 112, inputs = 1, label = resetCam
    // page group: Main
    //
resetCam = InsetImage_Input_4_out_1;
    // 
    // node Receiver[6]: x = 470, y = 30, inputs = 1, label = resetCam
    // page group: Main
    //
InsetImage_Receiver_6_out_1[cache: 0] = resetCam;
    // 
    // node SuperviseWindow[1]: x = 143, y = 126, inputs = 10, label = SuperviseWindow
    // input[1]: defaulting = 1, visible = 1, type = 32, value = "Image2"
    // input[10]: defaulting = 0, visible = 1, type = 3, value = 1
    // page group: Main
    //
InsetImage_SuperviseWindow_1_out_1,
InsetImage_SuperviseWindow_1_out_2,
InsetImage_SuperviseWindow_1_out_3 = 
    SuperviseWindow(
    InsetImage_Input_37_out_1,
    NULL,
    InsetImage_Receiver_4_out_1,
    InsetImage_Input_34_out_1,
    InsetImage_Input_35_out_1,
    NULL,
    NULL,
    NULL,
    InsetImage_Receiver_6_out_1,
    1
    ) [instance: 1, cache: 1];
    // 
    // node Transmitter[2]: x = 0, y = 264, inputs = 1, label = defaultCamera1
    // page group: camera
    //
defaultCamera1 = InsetImage_Switch_1_out_1;
    // 
    // node Receiver[3]: x = 61, y = 260, inputs = 1, label = defaultCamera1
    // page group: Main
    //
InsetImage_Receiver_3_out_1[cache: 0] = defaultCamera1;
    // 
    // node Receiver[23]: x = 191, y = 209, inputs = 1, label = resetCam
    // page group: Main
    //
InsetImage_Receiver_23_out_1[cache: 0] = resetCam;
    // 
    // node Receiver[26]: x = 274, y = 217, inputs = 1, label = inputObject
    // page group: Main
    //
InsetImage_Receiver_26_out_1[cache: 0] = inputObject;
    // 
    // node Input[31]: x = 445, y = 274, inputs = 0, label = Input
    // page group: Main
    // parameter: position = 6, name = 'interactionMode', value = '(no default)', descriptive = 1, description = ' rotate (0) pan (1) or zoom (2)', required = 0, visible = 0
    //
InsetImage_Input_31_out_1 = interactionMode;
    // 
    // node SuperviseState[1]: x = 201, y = 305, inputs = 9, label = SuperviseState
    // input[5]: defaulting = 0, visible = 1, type = 3, value = 0
    // input[8]: defaulting = 1, visible = 1, type = 1, value = 0
    // page group: Main
    //
InsetImage_SuperviseState_1_out_1,
InsetImage_SuperviseState_1_out_2,
InsetImage_SuperviseState_1_out_3,
InsetImage_SuperviseState_1_out_4 = 
    SuperviseState(
    InsetImage_SuperviseWindow_1_out_1,
    InsetImage_Receiver_3_out_1,
    InsetImage_Receiver_23_out_1,
    InsetImage_Receiver_26_out_1,
    0,
    InsetImage_SuperviseWindow_1_out_2,
    InsetImage_SuperviseWindow_1_out_3,
    InsetImage_Input_31_out_1,
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Input[2]: x = 173, y = 443, inputs = 0, label = Input
    // page group: Main
    // parameter: position = 2, name = 'renderMode', value = '"software"', descriptive = 0, description = ' set rendering mode to "hardware" or "software"', required = 0, visible = 0
    //
InsetImage_Input_2_out_1 = renderMode;
    // 
    // node Options[1]: x = 144, y = 519, inputs = 3, label = Options
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "rendering mode"
    // page group: Main
    //
InsetImage_Options_1_out_1 = 
    Options(
    InsetImage_SuperviseState_1_out_1,
    "rendering mode",
    InsetImage_Input_2_out_1
    ) [instance: 1, cache: 1];
    // 
    // node Transmitter[26]: x = 99, y = 366, inputs = 1, label = superCam
    // page group: Main
    //
superCam = InsetImage_SuperviseState_1_out_2;
    // 
    // node Receiver[27]: x = 293, y = 147, inputs = 1, label = superCam
    // page group: camera
    //
InsetImage_Receiver_27_out_1[cache: 0] = superCam;
    // 
    // node Input[5]: x = 521, y = 4, inputs = 0, label = Input
    // page group: camera
    // parameter: position = 5, name = 'bkgndColor', value = '"black"', descriptive = 0, description = ' background color of inset image', required = 0, visible = 0
    //
InsetImage_Input_5_out_1 = bkgndColor;
    // 
    // node Inquire[4]: x = 443, y = 95, inputs = 3, label = Inquire
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "is  null + 1"
    // page group: camera
    //
InsetImage_Inquire_4_out_1 = 
    Inquire(
    InsetImage_Input_5_out_1,
    "is  null + 1",
    NULL
    ) [instance: 4, cache: 1];
    // 
    // node Switch[13]: x = 533, y = 152, inputs = 3, label = Switch
    // input[3]: defaulting = 0, visible = 1, type = 16777248, value = {"black"}
    // page group: camera
    //
InsetImage_Switch_13_out_1 = 
    Switch(
    InsetImage_Inquire_4_out_1,
    InsetImage_Input_5_out_1,
    {"black"}
    ) [instance: 13, cache: 1];
    // 
    // node UpdateCamera[1]: x = 322, y = 235, inputs = 10, label = UpdateCamera
    // page group: camera
    //
InsetImage_UpdateCamera_1_out_1 = 
    UpdateCamera(
    InsetImage_Receiver_27_out_1,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    InsetImage_Switch_13_out_1
    ) [instance: 1, cache: 1];
    // 
    // node Transmitter[18]: x = 454, y = 340, inputs = 1, label = actualCam
    // page group: camera
    //
actualCam = InsetImage_UpdateCamera_1_out_1;
    // 
    // node Receiver[32]: x = 241, y = 422, inputs = 1, label = actualCam
    // page group: Main
    //
InsetImage_Receiver_32_out_1[cache: 0] = actualCam;
    // 
    // node Display[1]: x = 256, y = 501, inputs = 10, label = Display
    // input[3]: defaulting = 1, visible = 1, type = 1024, value = NULL
    // input[4]: visible = 1
    // page group: Main
    // depth: value = 24
    //
InsetImage_Display_1_out_1[cache: 2] = 
    Display(
    InsetImage_Options_1_out_1,
    InsetImage_Receiver_32_out_1,
    InsetImage_SuperviseState_1_out_3,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL
    ) [instance: 1, cache: 1];
    // 
    // node Output[1]: x = 68, y = 564, inputs = 1, label = Output
    // page group: Main
    // parameter: position = 1, name = 'renderable', value = ' ', descriptive = 0, description = ' ', required = 0, visible = 1
    //
renderable = InsetImage_Options_1_out_1;
    // 
    // node Output[2]: x = 402, y = 485, inputs = 1, label = Output
    // page group: Main
    // parameter: position = 2, name = 'camera', value = ' ', descriptive = 0, description = ' ', required = 0, visible = 1
    //
camera = InsetImage_Receiver_32_out_1;
    // 
    // node Output[3]: x = 368, y = 564, inputs = 1, label = Output
    // page group: Main
    // parameter: position = 3, name = 'where', value = '(NULL)', descriptive = 1, description = ' ', required = 0, visible = 1
    //
where = InsetImage_Display_1_out_1;
    // 
    // node Transmitter[8]: x = 443, y = 555, inputs = 1, label = imageWindow
    // page group: Main
    //
imageWindow = InsetImage_Display_1_out_1;
    // 
    // node Transmitter[24]: x = 392, y = 185, inputs = 1, label = windowSz
    // page group: Main
    //
windowSz = InsetImage_SuperviseWindow_1_out_2;
// network: end of macro body
}
InsetImage_Input_33_out_1 = NULL;
InsetImage_Transmitter_25_out_1 = NULL;
InsetImage_Receiver_2_out_1 = NULL;
InsetImage_AutoCamera_1_out_1 = NULL;
InsetImage_Input_3_out_1 = NULL;
InsetImage_Inquire_1_out_1 = NULL;
InsetImage_Switch_1_out_1 = NULL;
InsetImage_Inquire_2_out_1 = NULL;
InsetImage_Inquire_3_out_1 = NULL;
InsetImage_Compute_1_out_1 = NULL;
InsetImage_Input_37_out_1 = NULL;
InsetImage_Transmitter_3_out_1 = NULL;
InsetImage_Receiver_4_out_1 = NULL;
InsetImage_Input_34_out_1 = NULL;
InsetImage_Input_35_out_1 = NULL;
InsetImage_Input_4_out_1 = NULL;
InsetImage_Transmitter_19_out_1 = NULL;
InsetImage_Receiver_6_out_1 = NULL;
InsetImage_SuperviseWindow_1_out_1 = NULL;
InsetImage_SuperviseWindow_1_out_2 = NULL;
InsetImage_SuperviseWindow_1_out_3 = NULL;
InsetImage_Transmitter_2_out_1 = NULL;
InsetImage_Receiver_3_out_1 = NULL;
InsetImage_Receiver_23_out_1 = NULL;
InsetImage_Receiver_26_out_1 = NULL;
InsetImage_Input_31_out_1 = NULL;
InsetImage_SuperviseState_1_out_1 = NULL;
InsetImage_SuperviseState_1_out_2 = NULL;
InsetImage_SuperviseState_1_out_3 = NULL;
InsetImage_Input_2_out_1 = NULL;
InsetImage_Options_1_out_1 = NULL;
InsetImage_Transmitter_26_out_1 = NULL;
InsetImage_Receiver_27_out_1 = NULL;
InsetImage_Input_5_out_1 = NULL;
InsetImage_Inquire_4_out_1 = NULL;
InsetImage_Switch_13_out_1 = NULL;
InsetImage_UpdateCamera_1_out_1 = NULL;
InsetImage_Transmitter_18_out_1 = NULL;
InsetImage_Receiver_32_out_1 = NULL;
InsetImage_Display_1_out_1 = NULL;
