Permalink
Browse files

Xcowsay

git-svn-id: http://svn.nickg.me.uk/work/xcowsay@265 a97b1542-0b21-0410-a459-e47997c36f34
  • Loading branch information...
0 parents commit 8125331958c6eaf2d7f7ac156bfeca4aace95231 nick committed Feb 5, 2008
Showing with 368 additions and 0 deletions.
  1. +18 −0 Makefile
  2. +223 −0 cow.svg
  3. BIN cow_large.png
  4. BIN cow_med.png
  5. BIN cow_small.png
  6. +127 −0 xcowsay.c
18 Makefile
@@ -0,0 +1,18 @@
+APPS:=xcowsay
+OBJS:=xcowsay.o
+HEADERS:=
+
+CFLAGS:=-Wall -g `pkg-config --cflags gtk+-2.0`
+LDFLAGS:=`pkg-config --libs gtk+-2.0`
+LIBS:=
+
+all: $(APPS)
+
+xcowsay: $(OBJS)
+ cc $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
+
+%.o: %.c $(HEADERS)
+ cc $(CFLAGS) -c $<
+
+clean:
+ rm -f $(BIN) $(OBJS)
223 cow.svg
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.45.1"
+ sodipodi:docbase="/home/nick/work/xcowsay"
+ sodipodi:docname="cow.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/nick/work/xcowsay/cow.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.35"
+ inkscape:cx="375"
+ inkscape:cy="773.52898"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1002"
+ inkscape:window-height="801"
+ inkscape:window-x="200"
+ inkscape:window-y="71" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path2160"
+ d="M 383.90903,289.32263 C 371.25879,279.88414 357.76287,271.78525 343.81859,264.43245 C 326.03266,255.71203 307.26479,248.9371 287.55525,246.54667 C 273.38419,246.24378 239.9702,266.26621 282.69965,242.02368 C 266.80798,252.37322 250.71204,261.84352 234.20105,271.37397 C 223.59143,275.75027 181.74199,299.48378 225.6947,274.92127 C 215.56417,282.23823 207.89173,292.12226 200.30117,301.88886 C 195.98806,307.9347 192.82839,314.49039 190.18428,321.38249 C 187.5779,328.52802 187.41054,335.97052 187.49061,343.45531 C 187.99742,353.94068 190.95735,364.12795 194.28091,374.02557 C 199.00526,389.06413 208.52369,401.18929 218.8986,412.69829 C 230.76356,425.96219 247.08719,428.27347 263.91374,430.81848 C 290.78381,434.42484 317.37466,434.78744 343.89081,429.37315 C 360.34267,426.22193 375.08491,418.38531 389.80939,410.82001 C 347.88956,439.30201 384.08938,409.15616 392.69612,399.71542 L 419.34592,388.54897 C 403.98479,405.54272 389.06486,419.29921 367.16176,428.90638 C 352.72647,436.10529 338.08297,443.10059 322.03402,445.91493 C 295.46978,451.00596 268.85401,448.93889 242.03308,446.25233 C 224.25865,443.92225 206.4702,442.15122 194.50226,427.43149 C 184.27406,415.47096 174.47278,402.95615 169.43607,387.80553 C 165.49576,377.89908 162.2902,367.55455 161.42214,356.88558 C 161.19452,349.1207 161.26119,341.39742 163.46987,333.85561 C 166.08058,326.62649 169.22776,319.79255 173.6027,313.4234 C 181.27284,303.42822 189.26482,293.58591 198.9182,285.39338 C 217.80765,274.16271 236.48071,262.70441 256.41948,253.41593 C 216.75392,276.61435 246.86233,258.3875 255.60577,252.44851 C 274.25883,241.75396 289.29202,229.91761 310.94201,230.07484 C 330.41634,233.48924 348.72953,241.21246 366.58431,249.52004 C 381.02054,257.09004 395.36842,264.86239 409.19122,273.51263 L 383.90903,289.32263 z " />
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path2162"
+ d="M 370.08034,310.23659 C 357.58738,303.67282 344.41315,298.65552 330.97681,294.39812 C 298.10619,297.50151 338.51931,275.07922 335.35515,291.91088 C 338.31998,300.76087 343.77043,306.94516 351.08429,312.29743 C 357.26922,316.10722 364.19394,318.26594 370.97173,320.72438 C 372.12082,321.18833 373.26991,321.65227 374.419,322.11622 L 350.04529,338.46811 C 348.89558,338.02975 347.74586,337.5914 346.59614,337.15305 C 339.63101,334.63902 332.63632,332.12852 326.36534,328.0949 C 318.80797,321.89304 313.09438,314.84076 309.68788,305.422 C 309.79097,284.4717 335.3992,272.29859 354.376,278.51303 C 368.14915,283.25309 381.68028,288.6101 395.21896,293.97142 L 370.08034,310.23659 z " />
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path2164"
+ d="M 413.27106,286.57072 C 414.15277,277.34063 416.93508,268.62776 419.92774,259.94891 C 424.1208,248.80867 431.56828,240.0224 439.63422,231.57112 C 463.79451,215.43305 473.05767,206.59682 487.88817,228.42824 C 494.1999,237.939 496.6979,248.39804 497.671,259.48264 C 497.39134,266.26689 494.07134,272.10668 491.28639,278.08677 L 464.13064,289.98375 C 467.1187,284.48987 470.81472,279.13013 471.52291,272.67602 C 471.28554,262.05855 469.44379,252.06803 463.20761,242.99648 C 449.17022,224.34092 448.1308,231.42596 466.61574,220.55632 C 458.17583,228.45177 450.28435,236.62329 446.33645,247.814 C 443.29379,256.09219 440.06481,264.3775 439.78101,273.36458 L 413.27106,286.57072 z " />
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path2170"
+ d="M 411.58597,346.16404 C 415.4048,359.33486 424.05838,370.54051 432.27968,381.32696 C 443.30942,394.39117 454.66724,407.44518 467.95087,418.27353 C 478.72219,426.54388 489.18157,430.29661 502.53778,428.54775 C 515.07986,426.47645 526.59518,421.47303 537.72734,415.6566 C 502.34718,439.32135 524.62625,416.71758 530.05233,401.04622 C 532.89468,389.69689 532.98033,378.43329 530.71131,367.01343 C 528.44986,353.68889 521.89905,342.63473 514.25382,331.81306 C 506.80925,321.75328 498.09103,313.40796 486.97449,307.86749 L 511.46591,291.66726 C 522.09929,298.44347 530.88191,307.28838 538.54505,317.39242 C 547.21511,328.24271 553.19739,339.74497 555.93397,353.53666 C 558.24939,365.35239 559.1508,376.76878 556.21193,388.62559 C 548.59324,412.20741 540.58636,421.24031 515.16129,433.88379 C 503.80544,439.17004 492.16697,443.87331 479.62284,445.57912 C 465.64194,446.81578 454.98853,442.01731 444.03857,433.25438 C 430.64334,422.22262 419.55022,408.74147 408.26618,395.61874 C 399.69187,384.59133 390.88496,373.21999 385.38089,360.33521 L 411.58597,346.16404 z " />
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path2172"
+ d="M 219.487,423.3656 C 219.91254,443.03539 219.63217,462.70998 219.8301,482.38327 C 221.00862,500.51446 219.57645,518.47876 217.19555,536.42298 C 216.80194,538.95061 216.40832,541.47824 216.01471,544.00587 L 190.55975,556.46424 C 190.9806,553.97191 191.40145,551.47958 191.8223,548.98725 C 193.58449,530.88697 197.29256,512.94154 195.89816,494.60863 C 195.69153,475.44713 195.42312,456.20499 193.13856,437.16016 L 219.487,423.3656 z " />
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path2174"
+ d="M 268.10958,448.03267 C 268.88772,467.83845 269.65053,487.65322 270.52701,507.45981 C 270.96817,518.07218 270.76804,512.95562 271.13262,522.80929 L 245.79849,535.77466 C 245.80838,525.75524 245.81819,530.95721 245.7619,520.16876 C 245.49172,500.73568 245.3957,481.13053 241.97395,461.94707 L 268.10958,448.03267 z " />
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path2176"
+ d="M 370.81755,437.90894 C 369.62032,457.41016 369.84709,476.96147 369.54961,496.48908 C 369.4837,499.92137 369.41779,503.35365 369.35188,506.78594 L 344.68562,519.25407 C 344.8421,515.78741 344.99858,512.32075 345.15506,508.85409 C 345.67,489.70418 345.50492,470.51142 344.37045,451.38441 L 370.81755,437.90894 z " />
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path2178"
+ d="M 417.31229,419.47041 C 415.79153,442.4245 416.01753,465.45495 415.86157,488.44823 C 415.65262,502.53069 415.8887,516.6128 416.11693,530.69292 L 392.00511,542.97851 C 392.23101,528.81162 392.46882,514.64276 392.26047,500.47359 C 392.10679,477.97383 392.36107,455.4319 390.80975,432.97413 L 417.31229,419.47041 z " />
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path2182"
+ d="M 168.18648,297.99858 C 162.72983,294.81025 156.96198,292.30128 151.13058,289.91541 C 133.97384,289.17063 145.22918,288.63276 156.85205,282.49283 C 146.24008,290.2082 137.51171,300.22559 127.6947,308.95309 C 116.0127,318.37457 107.86419,330.72528 100.44553,343.57223 C 92.464639,356.03192 87.141051,369.88189 81.917047,383.64584 L 55.522024,395.90153 C 61.480319,382.12745 66.862037,367.96467 74.620626,355.08842 C 81.938404,342.06183 89.625323,329.18243 101.41864,319.6564 C 111.13379,311.02369 119.93228,301.26676 129.88705,293.14649 C 144.43722,284.31783 158.04343,267.557 175.54614,273.54905 C 181.60866,276.20012 187.71177,278.81258 193.53513,281.96577 L 168.18648,297.99858 z " />
+ <path
+ style="fill:#000000"
+ id="path2206"
+ d="M 248.70385,264.43965 C 254.68668,272.33872 259.69263,280.86372 264.38943,289.55257 C 268.07996,296.12164 267.20712,301.36593 265.80363,308.0807 C 256.71847,320.97626 241.44291,329.53046 225.84334,331.70675 C 218.62687,331.61569 212.16206,332.88206 205.68364,335.88418 C 240.18892,313.4555 226.72618,320.60004 221.93668,335.64432 C 221.39306,342.65963 220.74747,349.55405 219.43215,356.47344 C 215.52068,370.71714 197.04596,373.13672 185.5939,379.21332 L 209.22446,361.25893 C 204.06305,364.45752 188.87655,373.86532 192.87774,369.29788 C 194.43271,362.41779 195.45476,355.66276 195.40199,348.57774 C 199.18788,329.23293 206.07742,328.39764 228.83279,317.55101 C 235.55623,315.39583 242.34282,314.40549 249.43309,314.02958 C 243.79533,317.98044 238.8282,323.12575 232.51981,325.88216 C 234.59682,324.03706 237.09445,322.60094 238.78864,320.3133 C 241.05163,314.42354 242.17093,310.194 239.15904,303.86373 C 234.71669,295.37964 229.97694,287.01355 223.39022,279.95186 L 248.70385,264.43965 z " />
+ <path
+ style="fill:#000000"
+ id="path2208"
+ d="M 285.75564,443.52307 C 287.59609,437.92871 287.67111,432.0002 288.08487,426.17805 C 288.65056,419.608 290.67586,413.61472 293.32988,407.66954 C 302.26769,389.51005 324.06656,383.01062 342.08155,375.84173 C 356.47493,369.72464 366.54961,374.53477 376.02217,385.11652 C 378.48479,391.84771 382.70979,396.30094 387.80726,400.88275 C 390.31201,403.11297 393.57531,403.44926 396.59359,404.45948 L 372.13423,421.2529 C 368.92693,419.90373 365.40325,419.21139 362.74858,416.73115 C 357.79294,411.68701 353.37301,406.86559 350.95456,399.92277 C 342.16674,390.15686 333.01263,387.4295 320.0809,393.17354 C 296.22182,403.25089 341.29642,373.71447 320.29251,395.63437 C 317.51018,401.25214 314.98971,406.65997 314.37497,413.07782 C 314.04359,418.85445 314.11098,424.81229 312.73799,430.43917 L 285.75564,443.52307 z " />
+ <path
+ style="fill:#000000"
+ id="path2210"
+ d="M 184.7109,370.29113 C 185.0871,362.03925 185.02014,353.77469 184.96905,345.51688 C 185.65543,339.29031 183.91474,333.93984 181.67999,328.28386 L 207.46395,313.86287 C 209.59577,319.92388 211.98099,325.67625 211.01075,332.24797 C 210.96052,340.41798 210.88668,348.59537 211.26889,356.75916 L 184.7109,370.29113 z " />
+ <path
+ style="fill:#000000"
+ id="path2216"
+ d="M 200.41168,344.52117 C 201.59838,347.3115 202.40941,350.23766 203.36332,353.10677 C 204.6265,357.60786 207.37088,361.19962 210.21714,364.78163 C 210.66975,365.19712 211.12235,365.61262 211.57496,366.02811 L 197.17219,374.89075 C 196.70341,374.41826 196.23462,373.94577 195.76584,373.47327 C 192.89183,369.70061 190.16075,365.88739 188.5503,361.3574 C 187.55594,358.52531 186.7648,355.58469 185.38322,352.91346 L 200.41168,344.52117 z " />
+ <path
+ style="fill:#000000"
+ id="path2218"
+ d="M 202.90966,356.32251 C 204.92554,360.27872 208.27525,362.98277 211.59336,365.77853 L 197.49624,374.61374 C 194.0117,371.67071 190.65033,368.71339 188.08188,364.87453 L 202.90966,356.32251 z " />
+ <path
+ style="fill:#000000"
+ id="path2220"
+ d="M 195.90552,357.07522 C 198.44211,360.74843 201.70351,363.73137 205.08406,366.58454 L 190.72987,375.57822 C 187.39252,372.49012 184.30381,369.17643 181.1617,365.88734 L 195.90552,357.07522 z " />
+ <path
+ style="fill:#000000"
+ id="path2222"
+ d="M 210.50508,330.05939 C 210.89211,323.93723 210.79947,317.80138 210.77334,311.67115 C 210.32376,306.37876 210.6878,301.45059 211.91492,296.33711 C 213.67247,291.98604 215.66115,287.72746 217.6884,283.49697 C 219.61036,279.34919 222.97695,276.57322 226.46142,273.81148 C 273.01123,247.59314 199.07609,288.62717 249.41326,259.99493 C 250.50378,259.15224 251.78044,259.93095 252.83623,259.90241 L 238.8199,269.80005 C 237.91175,270.07943 236.8599,270.04674 236.04721,270.65301 C 280.91736,244.49919 198.83213,293.18225 242.14845,267.66824 C 238.60161,270.18031 235.11746,272.56216 233.07918,276.57794 C 230.92833,280.71742 229.05502,284.98168 227.02381,289.18391 C 225.59355,294.14796 225.29766,298.9593 225.52223,304.15621 C 225.4966,310.19519 225.39593,316.24066 225.79049,322.27108 L 210.50508,330.05939 z " />
+ <path
+ style="fill:#000000"
+ id="path2224"
+ d="M 238.06933,283.27411 C 235.94541,279.7121 234.85368,275.72749 233.7621,271.76998 L 248.59437,263.77849 C 249.56354,267.51009 250.50251,271.28868 252.81316,274.46199 L 238.06933,283.27411 z " />
+ <path
+ style="fill:#000000"
+ id="path2226"
+ d="M 235.23232,277.41138 C 236.37165,282.03689 237.87478,286.55987 239.32304,291.09465 C 240.61194,295.24703 242.61796,299.1491 244.25946,303.1818 C 245.01736,305.06211 245.41186,307.04719 245.91496,308.99983 L 230.97875,317.00364 C 230.56501,315.10427 230.27461,313.17268 229.56684,311.34666 C 227.91027,307.27656 225.83285,303.33725 224.50876,299.17773 C 223.20894,294.64568 221.99869,290.05656 220.18422,285.69902 L 235.23232,277.41138 z " />
+ <path
+ style="fill:#000000"
+ id="path2228"
+ d="M 234.07334,294.00825 C 235.739,298.85433 238.51277,303.21133 240.95964,307.68674 C 241.36339,309.04975 242.20796,310.19019 242.83212,311.44192 L 228.13642,319.83184 C 227.56165,318.55122 226.86013,317.32288 226.4104,315.98614 C 223.92735,311.38531 221.36454,306.82535 219.02248,302.14745 L 234.07334,294.00825 z " />
+ <path
+ style="fill:#000000"
+ id="path2230"
+ d="M 232.00293,303.34266 C 235.57095,306.5987 239.78314,309.00911 243.68811,311.83168 C 244.35066,312.25611 245.01322,312.68053 245.67577,313.10495 L 231.54253,322.17407 C 230.87676,321.73183 230.211,321.28959 229.54523,320.84735 C 225.5712,318.06458 221.55974,315.33627 217.56184,312.58913 L 232.00293,303.34266 z " />
+ <path
+ style="fill:#000000"
+ id="path2232"
+ d="M 220.2868,309.82774 C 224.00307,310.85187 227.43477,312.22018 230.85308,313.97978 C 232.77591,314.90609 234.69238,315.84537 236.60464,316.79281 L 222.48631,326.09128 C 220.60711,325.11875 218.73522,324.1311 216.82993,323.21013 C 213.33279,321.68149 209.8122,320.32833 206.07076,319.47318 L 220.2868,309.82774 z " />
+ <path
+ style="fill:#000000"
+ id="path2234"
+ d="M 199.97391,328.01083 C 199.14757,323.28838 200.57043,319.05946 201.88671,314.58793 C 202.87443,309.27954 205.78879,305.39413 208.88955,301.19163 C 211.79054,297.40118 213.85763,293.27567 215.4704,288.82938 C 216.4569,286.58446 216.2083,284.4121 216.11995,282.08174 L 231.38067,274.21025 C 231.49427,276.73664 231.77004,279.16859 230.70258,281.57845 C 229.22612,286.24959 227.28531,290.59563 224.16964,294.47649 C 221.44489,298.81805 217.83327,302.23538 216.84558,307.51622 C 215.71914,311.65969 214.21001,315.62167 215.15758,319.9558 L 199.97391,328.01083 z " />
+ <path
+ style="fill:#000000"
+ id="path2236"
+ d="M 178.16396,333.47148 C 181.42485,330.56072 185.26583,328.34702 188.91527,325.9489 C 192.10688,324.29581 193.98706,321.43808 196.11405,318.71174 C 198.08245,315.92768 199.19509,312.76939 200.4136,309.64376 C 201.18785,304.63261 202.08247,299.64285 203.00108,294.65518 C 203.62584,291.90741 205.3621,289.75936 206.79183,287.42407 L 222.15168,280.74861 C 220.66096,282.86109 218.90315,284.80607 218.13331,287.33743 C 217.12969,292.29327 215.92326,297.25766 215.72885,302.32829 C 214.64769,305.64619 213.6696,308.93872 211.60758,311.8513 C 209.75304,314.91999 207.74515,317.88135 204.65865,319.85465 C 201.09119,322.10563 197.60055,324.4873 193.98421,326.65395 L 178.16396,333.47148 z " />
+ <path
+ style="fill:#000000"
+ id="path2238"
+ d="M 206.99216,336.15501 C 207.24873,332.33987 207.11269,328.52223 206.99003,324.70794 C 206.82377,321.38902 206.1445,318.13506 205.62069,314.86427 L 220.25611,307.09757 C 220.79248,310.38722 221.37037,313.67151 221.78819,316.97906 C 222.11726,320.7572 222.31771,324.52385 222.34125,328.33426 L 206.99216,336.15501 z " />
+ <path
+ style="fill:#000000"
+ id="path2240"
+ d="M 188.29929,338.57038 C 186.84523,333.94703 187.02058,329.11602 186.96427,324.33385 C 186.93943,317.51072 187.63939,310.80669 189.00677,304.14135 C 189.47426,301.60022 190.85793,299.54577 192.16604,297.39565 L 207.7171,290.62415 C 206.41293,292.67322 204.73723,294.43988 204.15004,296.893 C 202.40013,303.42421 201.30461,309.99657 201.77914,316.80488 C 201.79559,321.36372 201.67555,325.95002 203.34739,330.28274 L 188.29929,338.57038 z " />
+ <path
+ style="fill:#000000"
+ id="path2242"
+ d="M 306.99173,442.39804 C 308.32838,438.46199 309.63043,434.56587 310.62731,430.5321 C 311.05922,426.80589 312.33925,423.27355 313.45335,419.71595 C 314.44621,416.01756 315.23266,412.2909 316.34194,408.62898 C 317.54499,405.63649 318.03757,402.45828 318.63508,399.30963 C 319.07831,397.30839 319.16512,395.25922 319.38128,393.23145 L 334.68686,385.62228 C 334.43993,387.71251 334.25368,389.81112 333.88136,391.88561 C 333.32983,395.11561 332.92551,398.39861 331.69302,401.4581 C 330.37609,405.04998 329.59787,408.72933 328.79182,412.47189 C 327.67674,416.00897 326.25436,419.50497 325.77091,423.19233 C 324.91678,427.2435 323.64277,431.09934 322.47889,435.04238 L 306.99173,442.39804 z " />
+ <path
+ style="fill:#000000"
+ id="path2244"
+ d="M 303.66924,439.74927 C 306.28604,433.10253 308.83307,426.43248 311.01795,419.6303 C 312.94173,414.28165 314.20925,408.74276 315.62314,403.2475 L 330.57939,396.08086 C 329.3304,401.69149 328.07156,407.30462 325.87765,412.64448 C 323.64782,419.26986 321.22579,425.82938 319.11682,432.49451 L 303.66924,439.74927 z " />
+ <path
+ style="fill:#000000"
+ id="path2246"
+ d="M 320.49277,432.02733 C 317.68797,427.62498 315.59104,422.91336 313.67866,418.08294 C 311.61498,412.70535 312.181,408.6702 314.16506,403.53977 C 320.08448,394.68744 326.44727,392.86719 336.7863,386.93732 L 323.58364,397.52152 C 347.78678,383.25981 333.85485,390.29395 329.40272,396.65379 C 327.13716,401.30821 326.47375,404.89712 328.31393,409.9979 C 330.08276,414.6075 331.89615,419.2291 335.16092,423.03867 L 320.49277,432.02733 z " />
+ <path
+ style="fill:#000000"
+ id="path2248"
+ d="M 341.46394,430.05916 C 340.26669,424.24306 338.99825,418.43291 337.50283,412.68548 C 335.95127,408.64291 335.62607,404.50259 335.25986,400.32749 L 350.33952,392.93989 C 350.33005,396.9028 350.32593,400.87561 351.95225,404.84219 C 353.50081,410.50893 354.76875,416.24396 356.51792,421.85333 L 341.46394,430.05916 z " />
+ <path
+ style="fill:#000000"
+ id="path2250"
+ d="M 360.92489,430.11034 C 358.15614,424.15922 354.91237,418.46155 351.62416,412.7862 C 349.74215,410.38423 348.7243,407.57921 347.38608,404.89703 L 361.82554,396.76025 C 363.1521,399.37434 364.32616,402.06593 365.95271,404.52238 C 369.13179,410.22406 372.17789,416.00946 375.67644,421.52455 L 360.92489,430.11034 z " />
+ <path
+ style="fill:#000000"
+ id="path2252"
+ d="M 350.75987,430.71751 C 350.24912,423.33641 348.06469,416.48697 345.0907,409.77361 C 343.61845,406.47787 341.95576,403.27542 340.27992,400.08059 L 354.57844,391.91245 C 356.23737,395.15826 358.07268,398.32588 359.38718,401.73442 C 362.27908,408.51012 364.52521,415.40845 365.78777,422.68291 L 350.75987,430.71751 z " />
+ <path
+ style="fill:#000000"
+ id="path2254"
+ d="M 331.16666,433.47839 C 330.95911,429.06969 330.64808,424.66519 330.42702,420.25576 C 330.14133,414.99752 330.20443,409.7376 330.29315,404.47599 C 329.98892,399.03231 329.90901,393.88872 330.89014,388.51918 L 345.67524,381.286 C 344.9145,386.55328 344.61166,391.62862 345.02704,396.9649 C 345.15011,402.17103 345.19526,407.37804 345.32342,412.58426 C 345.5408,416.95888 345.68973,421.35508 346.48391,425.67386 L 331.16666,433.47839 z " />
+ <path
+ style="fill:#000000"
+ id="path2256"
+ d="M 318.8332,435.14067 C 322.45265,424.12161 322.60491,412.25322 323.09793,400.74169 C 323.1395,399.04838 323.18106,397.35507 323.22262,395.66176 L 337.58243,388.42299 C 337.47602,390.15482 337.36961,391.88664 337.26321,393.61847 C 336.53665,405.1211 335.90956,416.67369 334.39984,428.09783 L 318.8332,435.14067 z " />
+ <path
+ style="fill:#000000"
+ id="path2258"
+ d="M 323.17152,436.94453 C 323.45688,428.52818 323.60271,420.13022 325.32724,411.86351 C 326.40717,406.17611 328.32554,400.69753 330.54002,395.37592 C 330.83943,394.7819 331.20089,394.22285 331.5312,393.64653 L 347.22043,386.65902 C 346.82601,387.2684 346.58576,387.97602 346.03717,388.48716 C 343.28529,393.53419 341.21303,399.03815 340.09008,404.7278 C 338.33427,412.79318 337.39298,421.01285 338.234,429.26982 L 323.17152,436.94453 z " />
+ <path
+ style="fill:#000000"
+ id="path2260"
+ d="M 340.49731,434.19801 C 341.10723,422.72598 341.86656,411.26016 342.38024,399.78144 C 342.42173,398.37668 342.46322,396.97193 342.50471,395.56717 L 357.07518,388.26401 C 356.92742,389.71916 356.77967,391.1743 356.63191,392.62945 C 355.75982,403.86601 354.70596,415.18054 355.71903,426.44216 L 340.49731,434.19801 z " />
+ <path
+ style="fill:#000000"
+ id="path2262"
+ d="M 331.50035,435.81423 C 333.89384,425.65464 336.55203,415.56958 338.58796,405.32887 C 339.34938,401.81891 339.6809,398.24496 340.13357,394.69026 L 355.04543,387.33382 C 354.45567,390.99522 353.95799,394.67358 353.14149,398.29579 C 350.85748,408.28069 348.0707,418.19348 346.70541,428.35699 L 331.50035,435.81423 z " />
+ <path
+ sodipodi:type="arc"
+ style="fill:#000080"
+ id="path2270"
+ sodipodi:cx="424.76913"
+ sodipodi:cy="336.16403"
+ sodipodi:rx="8.586297"
+ sodipodi:ry="14.142136"
+ d="M 433.35543 336.16403 A 8.586297 14.142136 0 1 1 416.18284,336.16403 A 8.586297 14.142136 0 1 1 433.35543 336.16403 z"
+ transform="matrix(0.8228605,-0.6663392,0.6967477,0.8604116,-141.30039,330.47005)" />
+ <path
+ sodipodi:type="arc"
+ style="fill:#000080"
+ id="path2274"
+ sodipodi:cx="424.76913"
+ sodipodi:cy="336.16403"
+ sodipodi:rx="8.586297"
+ sodipodi:ry="14.142136"
+ d="M 433.35543 336.16403 A 8.586297 14.142136 0 1 1 416.18284,336.16403 A 8.586297 14.142136 0 1 1 433.35543 336.16403 z"
+ transform="matrix(0.8228605,-0.6663392,0.6967477,0.8604116,-116.04663,317.84309)" />
+ </g>
+</svg>
BIN cow_large.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN cow_med.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN cow_small.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
127 xcowsay.c
@@ -0,0 +1,127 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+
+#include <gtk/gtk.h>
+#include <gtk/gtkwindow.h>
+
+#define SPEED 30 // Horizontal speed in pixels per 100ms
+
+typedef struct {
+ GtkWidget *window;
+ GtkWidget *cow_image;
+ GdkPixbuf *cow_pixbuf;
+ int x, y, width, height;
+ int screen_width;
+} xcowsay_t;
+
+static xcowsay_t xcowsay;
+
+static void get_alpha_mask(GdkDrawable *bitmap)
+{
+ GdkColormap *colormap;
+ GdkColor black;
+ GdkColor white;
+ GdkGC *gc;
+ int rowstride, nchannels, x, y;
+ guchar *pixels, *p;
+
+ colormap = gdk_colormap_get_system();
+ gdk_color_black(colormap, &black);
+ gdk_color_white(colormap, &white);
+
+ gc = gdk_gc_new(bitmap);
+
+ gdk_gc_set_foreground(gc, &black);
+ gdk_gc_set_background(gc, &white);
+ gdk_draw_rectangle (bitmap, gc, TRUE, 0, 0, xcowsay.width, xcowsay.height);
+
+ nchannels = gdk_pixbuf_get_n_channels(xcowsay.cow_pixbuf);
+ g_assert(gdk_pixbuf_get_colorspace(xcowsay.cow_pixbuf) == GDK_COLORSPACE_RGB);
+ g_assert(gdk_pixbuf_get_bits_per_sample(xcowsay.cow_pixbuf) == 8);
+ g_assert(gdk_pixbuf_get_has_alpha(xcowsay.cow_pixbuf));
+ g_assert(nchannels == 4);
+
+ rowstride = gdk_pixbuf_get_rowstride(xcowsay.cow_pixbuf);
+ pixels = gdk_pixbuf_get_pixels(xcowsay.cow_pixbuf);
+
+ gdk_gc_set_foreground(gc, &white);
+ gdk_gc_set_background(gc, &black);
+
+ for (y = 0; y < xcowsay.height; y++) {
+ for (x = 0; x < xcowsay.width; x++) {
+ p = pixels + y*rowstride + x*nchannels;
+ if (255 == p[3]) // p[3] is alpha channel
+ gdk_draw_point(bitmap, gc, x, y);
+ }
+ }
+}
+
+static void quit_callback(GtkWidget *widget, gpointer data)
+{
+ gtk_main_quit();
+}
+
+gboolean tick(gpointer data)
+{
+ if (xcowsay.x + xcowsay.width < xcowsay.screen_width / 2) {
+ xcowsay.x += SPEED;
+ gtk_window_move(GTK_WINDOW(xcowsay.window), xcowsay.x, xcowsay.y);
+ }
+ return true;
+}
+
+int main(int argc, char **argv)
+{
+ GdkDrawable *window_shape_bitmap;
+ GdkScreen *screen;
+
+ gtk_init(&argc, &argv);
+
+ xcowsay.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_decorated(GTK_WINDOW(xcowsay.window), FALSE);
+ gtk_window_set_resizable(GTK_WINDOW(xcowsay.window), FALSE);
+ gtk_window_set_title(GTK_WINDOW(xcowsay.window), "xcowsay");
+ gtk_window_set_skip_taskbar_hint(GTK_WINDOW(xcowsay.window), TRUE);
+
+ xcowsay.cow_pixbuf = gdk_pixbuf_new_from_file("cow_med.png", NULL);
+ if (NULL == xcowsay.cow_pixbuf) {
+ fprintf(stderr, "Failed to load cow image!\n");
+ return EXIT_FAILURE;
+ }
+ xcowsay.width = gdk_pixbuf_get_width(xcowsay.cow_pixbuf);
+ xcowsay.height = gdk_pixbuf_get_height(xcowsay.cow_pixbuf);
+
+ window_shape_bitmap =
+ (GdkDrawable*)gdk_pixmap_new(NULL, xcowsay.width, xcowsay.height, 1);
+ get_alpha_mask(window_shape_bitmap);
+ gtk_widget_shape_combine_mask(xcowsay.window, window_shape_bitmap, 0, 0);
+ gdk_pixmap_unref(window_shape_bitmap);
+
+ xcowsay.cow_image = gtk_image_new_from_pixbuf(xcowsay.cow_pixbuf);
+ gtk_container_add(GTK_CONTAINER(xcowsay.window), xcowsay.cow_image);
+
+ screen = gtk_widget_get_screen(xcowsay.window);
+ xcowsay.screen_width = gdk_screen_get_width(screen);
+
+ // Ok... this is a terrible hack *sniff*
+ // In order to stop the cow flashing up before it's moved offscreen
+ // we iconify it, show it, deiconify it, then move it (hopefully
+ // before it gets painted again!)
+ gtk_window_iconify(GTK_WINDOW(xcowsay.window));
+ gtk_widget_show_all(xcowsay.window);
+
+ xcowsay.x = -xcowsay.width;
+ xcowsay.y = 100;
+ gtk_window_deiconify(GTK_WINDOW(xcowsay.window));
+ gtk_window_move(GTK_WINDOW(xcowsay.window), xcowsay.x, xcowsay.y);
+
+ g_signal_connect(G_OBJECT(xcowsay.window), "destroy",
+ G_CALLBACK(quit_callback), NULL);
+
+ g_timeout_add(100, tick, NULL);
+
+ gtk_main();
+
+ return EXIT_SUCCESS;
+}

0 comments on commit 8125331

Please sign in to comment.