| 34 |
|
|
| 35 |
function drawing_demo_canvas() { |
function drawing_demo_canvas() { |
| 36 |
$canvas = array( |
$canvas = array( |
| 37 |
'#type' => 'drawing_canvas', |
'#type' => 'canvas', |
| 38 |
'#height' => '700px', |
'#height' => '700px', |
| 39 |
'#width' => '700px', |
'#width' => '700px', |
| 40 |
); |
); |
| 41 |
/*$canvas['drawing_demo'] = array( |
/*$canvas['drawing_demo'] = array( |
| 42 |
'#type' => 'drawing_file', |
'#type' => 'file', |
| 43 |
'#location' => drupal_get_path('module', 'drawing') . '/drawing_demo.vector.svg', |
'#location' => drupal_get_path('module', 'drawing') . '/drawing_demo.vector.svg', |
| 44 |
'#height' => '800px', |
'#height' => '800px', |
| 45 |
'#width' => '700px', |
'#width' => '700px', |
| 46 |
);*/ |
);*/ |
| 47 |
|
|
| 48 |
$canvas['group'] = array( |
$canvas['group'] = array( |
| 49 |
'#type' => 'drawing_group', |
'#type' => 'group', |
| 50 |
'#transform' => array( |
'#transform' => array( |
| 51 |
'translate' => array(0, 60), |
'translate' => array(0, 60), |
| 52 |
'scale' => array( 0.5, 0.5), |
'scale' => array( 0.5, 0.5), |
| 54 |
); |
); |
| 55 |
|
|
| 56 |
$canvas['group']['path2'] = array( |
$canvas['group']['path2'] = array( |
| 57 |
'#type' => 'drawing_path', |
'#type' => 'path', |
| 58 |
'#explicit' => TRUE, |
'#explicit' => TRUE, |
| 59 |
'#points' => 'M 449.25,610.5 C 461.25,610.5 474,611.25 483,617.25 C 492,623.25 497.25,636.75 500.25,644.25 C 503.25,651.75 500.25,656.25 494.25,659.25 C 489,662.25 488.25,660.75 483,651 C 477.75,641.25 473.25,631.5 447,631.5 C 420.75,631.5 412.5,640.5 399.75,651 C 387,661.5 382.5,665.25 378,659.25 C 373.5,653.25 375,647.25 383.25,639.75 C 391.5,632.25 405,620.25 417.75,615 C 430.5,609.75 437.25,610.5 449.25,610.5 L 449.25,610.5 z ', |
'#points' => 'M 449.25,610.5 C 461.25,610.5 474,611.25 483,617.25 C 492,623.25 497.25,636.75 500.25,644.25 C 503.25,651.75 500.25,656.25 494.25,659.25 C 489,662.25 488.25,660.75 483,651 C 477.75,641.25 473.25,631.5 447,631.5 C 420.75,631.5 412.5,640.5 399.75,651 C 387,661.5 382.5,665.25 378,659.25 C 373.5,653.25 375,647.25 383.25,639.75 C 391.5,632.25 405,620.25 417.75,615 C 430.5,609.75 437.25,610.5 449.25,610.5 L 449.25,610.5 z ', |
| 60 |
'#fill' => '#ffffff', |
'#fill' => '#ffffff', |
| 61 |
); |
); |
| 62 |
$canvas['group']['path3'] = array( |
$canvas['group']['path3'] = array( |
| 63 |
'#type' => 'drawing_path', |
'#type' => 'path', |
| 64 |
'#explicit' => TRUE, |
'#explicit' => TRUE, |
| 65 |
'#points' => 'M 324.75,696 C 339.75,708 362.25,717.75 410.25,717.75 C 458.25,717.75 492,704.25 507,693 C 513.75,687.75 516.75,692.25 517.5,695.25 C 518.25,698.25 519.75,702.75 514.5,708 C 510.75,711.75 476.25,735.75 435.75,739.5 C 395.25,743.25 340.5,745.5 307.5,715.5 C 302.25,710.25 303.75,702.75 307.5,699.75 C 311.25,696.75 314.25,694.5 318.75,694.5 C 323.25,694.5 322.5,694.5 324.75,696 L 324.75,696 z ', |
'#points' => 'M 324.75,696 C 339.75,708 362.25,717.75 410.25,717.75 C 458.25,717.75 492,704.25 507,693 C 513.75,687.75 516.75,692.25 517.5,695.25 C 518.25,698.25 519.75,702.75 514.5,708 C 510.75,711.75 476.25,735.75 435.75,739.5 C 395.25,743.25 340.5,745.5 307.5,715.5 C 302.25,710.25 303.75,702.75 307.5,699.75 C 311.25,696.75 314.25,694.5 318.75,694.5 C 323.25,694.5 322.5,694.5 324.75,696 L 324.75,696 z ', |
| 66 |
'#fill' => '#ffffff', |
'#fill' => '#ffffff', |
| 67 |
); |
); |
| 68 |
|
|
| 69 |
$canvas['group']['path7'] = array( |
$canvas['group']['path7'] = array( |
| 70 |
'#type' => 'drawing_path', |
'#type' => 'path', |
| 71 |
'#explicit' => TRUE, |
'#explicit' => TRUE, |
| 72 |
'#points' => 'M 316.5,14.25 C 309.75,63.75 294.75,78.75 274.5,94.5 C 240.75,120 207.75,135.75 200.25,139.5 C 180.75,149.25 110.25,188.25 73.5,244.5 C 62.25,261.75 73.5,268.5 75.75,270 C 78,271.5 103.5,274.5 158.25,241.5 C 213,208.5 237,189 267.75,156.75 C 284.25,139.5 286.5,129.75 286.5,125.25 C 286.5,120 282.75,117.75 276.75,116.25 C 273.75,115.5 273,114 276.75,111.75 C 280.5,109.5 296.25,102 300,99 C 303.75,96 321.75,84 322.5,64.5 C 323.25,45 321.75,31.5 316.5,14.25 L 316.5,14.25 z ', |
'#points' => 'M 316.5,14.25 C 309.75,63.75 294.75,78.75 274.5,94.5 C 240.75,120 207.75,135.75 200.25,139.5 C 180.75,149.25 110.25,188.25 73.5,244.5 C 62.25,261.75 73.5,268.5 75.75,270 C 78,271.5 103.5,274.5 158.25,241.5 C 213,208.5 237,189 267.75,156.75 C 284.25,139.5 286.5,129.75 286.5,125.25 C 286.5,120 282.75,117.75 276.75,116.25 C 273.75,115.5 273,114 276.75,111.75 C 280.5,109.5 296.25,102 300,99 C 303.75,96 321.75,84 322.5,64.5 C 323.25,45 321.75,31.5 316.5,14.25 L 316.5,14.25 z ', |
| 73 |
'#fill' => '#ffffff', |
'#fill' => '#ffffff', |
| 74 |
); |
); |
| 75 |
$canvas['group']['path6'] = array( |
$canvas['group']['path6'] = array( |
| 76 |
'#type' => 'drawing_path', |
'#type' => 'path', |
| 77 |
'#explicit' => TRUE, |
'#explicit' => TRUE, |
| 78 |
'#points' => 'M 316.5,15 C 327,45.75 325.5,61.5 325.5,68.25 C 325.5,75 321.75,93 309.75,102 C 304.5,105.75 303,108.75 303,109.5 C 303,112.5 309.75,114.75 309.75,121.5 C 309.75,129.75 306,146.25 266.25,186 C 226.5,225.75 169.5,261 125.25,282.75 C 81,304.5 60,303 54,292.5 C 48,282 56.25,258.75 84,228 C 111.75,197.25 199.5,153 199.5,153 L 309,76.5 L 315,47.25', |
'#points' => 'M 316.5,15 C 327,45.75 325.5,61.5 325.5,68.25 C 325.5,75 321.75,93 309.75,102 C 304.5,105.75 303,108.75 303,109.5 C 303,112.5 309.75,114.75 309.75,121.5 C 309.75,129.75 306,146.25 266.25,186 C 226.5,225.75 169.5,261 125.25,282.75 C 81,304.5 60,303 54,292.5 C 48,282 56.25,258.75 84,228 C 111.75,197.25 199.5,153 199.5,153 L 309,76.5 L 315,47.25', |
| 79 |
'#fill' => '#93c5e4', |
'#fill' => '#93c5e4', |
| 80 |
); |
); |
| 81 |
$canvas['group']['path8'] = array( |
$canvas['group']['path8'] = array( |
| 82 |
'#type' => 'drawing_path', |
'#type' => 'path', |
| 83 |
'#explicit' => TRUE, |
'#explicit' => TRUE, |
| 84 |
'#points' => 'M 147.75,559.5 C 148.5,501 203.25,446.25 272.25,445.5 C 360,444.75 420.75,532.5 465,531.75 C 502.5,531 574.5,457.5 609.75,457.5 C 647.25,457.5 657.75,496.5 657.75,519.75 C 657.75,543 650.25,585 632.25,611.25 C 614.25,637.5 603,647.25 582,645.75 C 555,643.5 501,559.5 466.5,558 C 423,556.5 328.5,648.75 254.25,648.75 C 209.25,648.75 195.75,642 180.75,632.25 C 158.25,616.5 147,592.5 147.75,559.5 L 147.75,559.5 z ', |
'#points' => 'M 147.75,559.5 C 148.5,501 203.25,446.25 272.25,445.5 C 360,444.75 420.75,532.5 465,531.75 C 502.5,531 574.5,457.5 609.75,457.5 C 647.25,457.5 657.75,496.5 657.75,519.75 C 657.75,543 650.25,585 632.25,611.25 C 614.25,637.5 603,647.25 582,645.75 C 555,643.5 501,559.5 466.5,558 C 423,556.5 328.5,648.75 254.25,648.75 C 209.25,648.75 195.75,642 180.75,632.25 C 158.25,616.5 147,592.5 147.75,559.5 L 147.75,559.5 z ', |
| 85 |
'#fill' => '#ffffff', |
'#fill' => '#ffffff', |
| 86 |
); |
); |
| 87 |
$canvas['group']['path4'] = array( |
$canvas['group']['path4'] = array( |
| 88 |
'#type' => 'drawing_path', |
'#type' => 'path', |
| 89 |
'#explicit' => TRUE, |
'#explicit' => TRUE, |
| 90 |
'#points' => 'M 141,639 C 198,638.25 208.5,628.5 258.75,606 C 530.25,484.5 580.5,373.5 590.25,348 C 600,322.5 614.25,281.25 599.25,235.5 C 596.354,226.668 594.244,219.576 592.72,213.87 C 556.641,173.527 520.821,151.513 510,144.75 C 471,120 432.75,110.25 395.25,85.5 C 372,70.5 339.75,32.25 312.75,0 C 307.5,51.75 292.5,73.5 273.75,87.75 C 235.5,117.75 211.5,126.75 178.5,144.75 C 150.75,159.75 0,249 0,442.5 C 0,504.28 16.593,560.861 45.063,609.266 L 52.5,609 C 68.25,623.25 93,639.75 141,639 z ', |
'#points' => 'M 141,639 C 198,638.25 208.5,628.5 258.75,606 C 530.25,484.5 580.5,373.5 590.25,348 C 600,322.5 614.25,281.25 599.25,235.5 C 596.354,226.668 594.244,219.576 592.72,213.87 C 556.641,173.527 520.821,151.513 510,144.75 C 471,120 432.75,110.25 395.25,85.5 C 372,70.5 339.75,32.25 312.75,0 C 307.5,51.75 292.5,73.5 273.75,87.75 C 235.5,117.75 211.5,126.75 178.5,144.75 C 150.75,159.75 0,249 0,442.5 C 0,504.28 16.593,560.861 45.063,609.266 L 52.5,609 C 68.25,623.25 93,639.75 141,639 z ', |
| 91 |
'#fill' => '#0073ba', |
'#fill' => '#0073ba', |
| 92 |
); |
); |
| 93 |
$canvas['group']['path5'] = array( |
$canvas['group']['path5'] = array( |
| 94 |
'#type' => 'drawing_path', |
'#type' => 'path', |
| 95 |
'#explicit' => TRUE, |
'#explicit' => TRUE, |
| 96 |
'#points' => 'M 510,144.75 C 471,120 432.75,110.25 395.25,85.5 C 372,70.5 339.75,32.25 312.75,0 C 307.5,51.75 292.5,73.5 273.75,87.75 C 235.5,117.75 211.5,126.75 178.5,144.75 C 150.75,159.75 0,249 0,442.5 C 0,504.28 16.593,560.861 45.063,609.266 C 105.763,712.467 220.46,778.5 343.5,778.5 C 524.25,778.5 681,647.25 681,448.5 C 681,339.354 636.668,263.012 592.72,213.87 C 556.641,173.527 520.82,151.513 510,144.75 z M 601.164,232.547 C 650.406,294.111 675.375,366.768 675.375,448.5 C 675.375,495.928 666.342,540.73 648.526,581.665 C 631.626,620.496 607.29,654.898 576.193,683.919 C 514.724,741.283 432.086,772.875 343.5,772.875 C 299.674,772.875 256.668,764.504 215.676,747.993 C 175.413,731.776 139.129,708.555 107.833,678.974 C 41.923,616.678 5.625,532.696 5.625,442.5 C 5.625,362.164 31.701,290.78 83.128,230.333 C 122.417,184.153 164.783,158.559 181.175,149.699 C 189.133,145.358 196.598,141.527 203.818,137.822 C 226.448,126.207 247.823,115.236 277.222,92.177 C 292.899,80.263 309.599,61.392 316.711,13.475 C 341.485,42.941 370.233,76.054 392.201,90.227 C 411.701,103.097 431.702,112.115 451.045,120.837 C 469.343,129.087 488.264,137.618 506.987,149.5 C 507.019,149.521 507.689,149.938 507.689,149.938 C 562.421,184.11 591.581,220.566 601.164,232.547 z ', |
'#points' => 'M 510,144.75 C 471,120 432.75,110.25 395.25,85.5 C 372,70.5 339.75,32.25 312.75,0 C 307.5,51.75 292.5,73.5 273.75,87.75 C 235.5,117.75 211.5,126.75 178.5,144.75 C 150.75,159.75 0,249 0,442.5 C 0,504.28 16.593,560.861 45.063,609.266 C 105.763,712.467 220.46,778.5 343.5,778.5 C 524.25,778.5 681,647.25 681,448.5 C 681,339.354 636.668,263.012 592.72,213.87 C 556.641,173.527 520.82,151.513 510,144.75 z M 601.164,232.547 C 650.406,294.111 675.375,366.768 675.375,448.5 C 675.375,495.928 666.342,540.73 648.526,581.665 C 631.626,620.496 607.29,654.898 576.193,683.919 C 514.724,741.283 432.086,772.875 343.5,772.875 C 299.674,772.875 256.668,764.504 215.676,747.993 C 175.413,731.776 139.129,708.555 107.833,678.974 C 41.923,616.678 5.625,532.696 5.625,442.5 C 5.625,362.164 31.701,290.78 83.128,230.333 C 122.417,184.153 164.783,158.559 181.175,149.699 C 189.133,145.358 196.598,141.527 203.818,137.822 C 226.448,126.207 247.823,115.236 277.222,92.177 C 292.899,80.263 309.599,61.392 316.711,13.475 C 341.485,42.941 370.233,76.054 392.201,90.227 C 411.701,103.097 431.702,112.115 451.045,120.837 C 469.343,129.087 488.264,137.618 506.987,149.5 C 507.019,149.521 507.689,149.938 507.689,149.938 C 562.421,184.11 591.581,220.566 601.164,232.547 z ', |
| 97 |
'#fill' => '#004976', |
'#fill' => '#004976', |
| 98 |
); |
); |
| 99 |
$canvas['group']['path9'] = array( |
$canvas['group']['path9'] = array( |
| 100 |
'#type' => 'drawing_path', |
'#type' => 'path', |
| 101 |
'#explicit' => TRUE, |
'#explicit' => TRUE, |
| 102 |
'#points' => 'M 599.25,235.5 C 614.25,281.25 600,322.5 590.25,348 C 580.5,373.5 530.25,484.5 258.75,606 C 208.5,628.5 198,638.25 141,639 C 93,639.75 68.25,623.25 52.5,609 L 45.063,609.266 C 105.763,712.467 220.46,778.5 343.5,778.5 C 524.25,778.5 681,647.25 681,448.5 C 681,339.354 636.668,263.012 592.72,213.87 C 594.244,219.576 596.354,226.668 599.25,235.5 z ', |
'#points' => 'M 599.25,235.5 C 614.25,281.25 600,322.5 590.25,348 C 580.5,373.5 530.25,484.5 258.75,606 C 208.5,628.5 198,638.25 141,639 C 93,639.75 68.25,623.25 52.5,609 L 45.063,609.266 C 105.763,712.467 220.46,778.5 343.5,778.5 C 524.25,778.5 681,647.25 681,448.5 C 681,339.354 636.668,263.012 592.72,213.87 C 594.244,219.576 596.354,226.668 599.25,235.5 z ', |
| 103 |
'#fill' => 'none', |
'#fill' => 'none', |
| 104 |
); |
); |
| 105 |
|
|
| 106 |
$canvas['group']['path1'] = array( |
$canvas['group']['path1'] = array( |
| 107 |
'#type' => 'drawing_path', |
'#type' => 'path', |
| 108 |
'#explicit' => FALSE, // this is not obligatory |
'#explicit' => FALSE, // this is not obligatory |
| 109 |
'#fill' => '#00598e', |
'#fill' => '#00598e', |
| 110 |
'#points' => array( |
'#points' => array( |
| 220 |
), |
), |
| 221 |
); |
); |
| 222 |
$canvas['text1'] = array( |
$canvas['text1'] = array( |
| 223 |
'#type' => 'drawing_text', |
'#type' => 'text', |
| 224 |
'#value' => 'This drawing is made by the drawing_demo.module testmodule in the drawing package.', |
'#value' => 'This drawing is made by the drawing_demo.module testmodule in the drawing package.', |
| 225 |
'#cx' => 0, |
'#cx' => 0, |
| 226 |
'#cy' => 20, |
'#cy' => 20, |
| 227 |
); |
); |
| 228 |
$canvas['text2'] = array( |
$canvas['text2'] = array( |
| 229 |
'#type' => 'drawing_text', |
'#type' => 'text', |
| 230 |
'#value' => 'Render done via the drawing API, including fill and stroke.', |
'#value' => 'Render done via the drawing API, including fill and stroke.', |
| 231 |
'#cx' => 0, |
'#cx' => 0, |
| 232 |
'#cy' => 40, |
'#cy' => 40, |
| 233 |
); |
); |
| 234 |
$canvas['text3'] = array( |
$canvas['text3'] = array( |
| 235 |
'#type' => 'drawing_text', |
'#type' => 'text', |
| 236 |
'#value' => 'You have to be cautious with overlapping figures, like drawing_demo, its difficult to find the correct order of elements.', |
'#value' => 'You have to be cautious with overlapping figures, like drawing_demo, its difficult to find the correct order of elements.', |
| 237 |
'#cx' => 0, |
'#cx' => 0, |
| 238 |
'#cy' => 60, |
'#cy' => 60, |