From d6502c9080ec2d6fb4690bc9d360fbde8c0bd70e Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Sun, 10 May 2020 01:40:54 +0200 Subject: [PATCH] Added disabled flowers (for button bar). --- cmd/imadapt/imadapt.go | 39 +++++++++++++++++- .../res/images/flower_purpleA_NE_disabled.png | Bin 0 -> 3157 bytes .../res/images/flower_purpleC_NE_disabled.png | Bin 0 -> 3135 bytes .../res/images/flower_redA_NE_disabled.png | Bin 0 -> 3188 bytes .../res/images/flower_redC_NE_disabled.png | Bin 0 -> 3196 bytes .../res/images/flower_yellowC_NE_disabled.png | Bin 0 -> 3017 bytes cmd/tins2020/res/textures.txt | 5 +++ cmd/tins2020/tins2020.go | 2 +- gamecontrols.go | 7 +++- 9 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 cmd/tins2020/res/images/flower_purpleA_NE_disabled.png create mode 100644 cmd/tins2020/res/images/flower_purpleC_NE_disabled.png create mode 100644 cmd/tins2020/res/images/flower_redA_NE_disabled.png create mode 100644 cmd/tins2020/res/images/flower_redC_NE_disabled.png create mode 100644 cmd/tins2020/res/images/flower_yellowC_NE_disabled.png diff --git a/cmd/imadapt/imadapt.go b/cmd/imadapt/imadapt.go index e3ae6fc..c04bbcd 100644 --- a/cmd/imadapt/imadapt.go +++ b/cmd/imadapt/imadapt.go @@ -26,7 +26,16 @@ func run() error { for _, path := range flags.Args() { err := setAlpha(path, alpha) if err != nil { - return fmt.Errorf("couldn't set alpha for '%s'; error: %v", path, err) + return fmt.Errorf("couldn't set alpha of '%s'; error: %v", path, err) + } + } + case "gray": + flags := flag.NewFlagSet("gray", flag.ContinueOnError) + flags.Parse(args[1:]) + for _, path := range flags.Args() { + err := gray(path) + if err != nil { + return fmt.Errorf("couldn't convert to grayscale of '%s'; error: %v", path, err) } } } @@ -57,6 +66,34 @@ func setAlpha(path string, alpha int) error { return encodePNG(path, dst) } +func gray(path string) error { + src, err := os.Open(path) + if err != nil { + return err + } + defer src.Close() + im, _, err := image.Decode(src) + if err != nil { + return err + } + bounds := im.Bounds() + dst := image.NewRGBA(bounds) + for y := bounds.Min.Y; y < bounds.Max.Y; y++ { + for x := bounds.Min.X; x < bounds.Max.X; x++ { + c := im.At(x, y) + rgba := color.NRGBAModel.Convert(c).(color.NRGBA) + if rgba.A > 0 { + gray := color.GrayModel.Convert(c).(color.Gray) + rgba.R, rgba.G, rgba.B = gray.Y, gray.Y, gray.Y + dst.Set(x, y, rgba) + } else { + dst.Set(x, y, c) + } + } + } + return encodePNG(path, dst) +} + func encodePNG(path string, im image.Image) error { dst, err := os.Create(path) if err != nil { diff --git a/cmd/tins2020/res/images/flower_purpleA_NE_disabled.png b/cmd/tins2020/res/images/flower_purpleA_NE_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..36644e236843adc05f8cbe494537a6c2d851f8e5 GIT binary patch literal 3157 zcmeHK{a4aw6u)3o5+!Trn9EdJ+gfgAJDR$b$d_f#vbM9OZMN(Ez;A78a>6&IS7%21c^Yeo+;S*-1>vjx z@A9ADy|O3aJ039~Tag$he|jx()56{!Wm0n|32HE*l ztKCP$ESvS=Q-u4DN+z)VX>&=5@sjW0E|`GhUCO$|!8 z^OK6b*zvJ4v*=TIT3T9rjFuT0Ki9Kf#;{LtIrhgJ#7j9N^Vl0{u%lyUW~N?HUCnNs z`x$xmXIlHKej!(RG|KVTQj8wkuBOUZujdR;5TQ*fH{M_8tQo1<+Sppoe8 zE}lzdhPtfPfq@!?i$fQ+TAwW%ixJ^Pw8ln?u9s5+fF>w&PDzkvx_Rt$JADz(hmx8( z6v|X@?;|qXiYQaULO6y?88w$}b@Gt{0%!~+GcPRjtVNqEU)##!9LUO&GL6r#$B0XH z=MD`h6o|d1%=8|LXUqEf7TZXqs{W8H7QNc9u6>$k6+aBJYpte`~^NXNM zWt~>7z~k`%&m)|+B-)S)X7(`N@UjI?|rUqjcYg=y&EM*@utn2*{uco zuE)QV(Q@&p(VF~d3FFF9J79L7P!}mkZ_N&eqkI2x|9E6+o-CTP%foN^0Cu2;RL0Cz zA^pOb4S3{BIELo0wo`3pE#gF(lY`Re%2hwRju&BSIx+R^Iz>UKBVYg%#++@NxbzMu zYR#xSP;SY|%gYZ%In(=lVE`l^;z-=J+8Z27f*^?jKEzBHxsi@{R4V7DPI5p literal 0 HcmV?d00001 diff --git a/cmd/tins2020/res/images/flower_purpleC_NE_disabled.png b/cmd/tins2020/res/images/flower_purpleC_NE_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..a585a573befa4c7a7fbf7597cfb20453948d5c9d GIT binary patch literal 3135 zcmeHKYfO`86n+bxpio-TfQ&$mn`2oAjG=>yrQkFL5!mJuNuaIhL9z&ztAu$@88( z=jJy_6wIy z!2UP@V(tP^ydMQXEYe&F8UXZ80NlNu1x_BEdT{=W|Mh&3o8z${Tk@nd5X|mVKE14D z>1Nx+YL2E_Xwl8J=faRf_&!z0U@)w&M4>nSYDmVDS$fsY`0<_Dw|;s5`qrMHB>Q=b zUM`b-bvn5^jlMz|RH;<0Su@S) z2%e%r%sY}M<8mZczQZ)LOzyL94)d$FM&zRh!T!Z+)`FkDXRSHiupm|RUvm>u0y!&W z2wI(}SBOGok=%`bH^t=SBth{7_sh0)0cI%#xJMS6b$b#L5)_rWGUCD}EL)pt!Ok>O z{i7l4vN1&d?r)9MCInFcm-qU4Sw(q81x!4AxP!gDrCl=3(D6CF>rahL*h1}PuD6_N zp^?aKu>#C_H*kPfWO_lr%}Yv5#NdmzCiub7M;FJcIOn|EQU2ppfNPUT?46wp1#8KT zjg15k4-fKucfQ7I-wqaN#;T)CW@T=#1ABmrFn$%e6}Hf%1xA~uhPyd5Txijgx)^KI zOV7&)d?MrR)V-lZ_fsVapmivKcy&d4v4)eeUMCDJC~&9(SgI>|OeXXGg9moTppZy1If=BcnsS$Y_zqq*C4Y6 zi9{lyuaA$H%sAlRP{W5fc+cyJaUe#1hF-)d%E-vDFN!A~lB1%cAmS034Yz1s9=t=R zrKF@tUYDm1jDOI@Hoo!`k+W$bs2I6M%!e$6`fg1Hfk1%0icM5OM@PrfpLJg+>*hPM zu2`8$KHH*Z(K$#BFHGAlsH7lRLOhSHT_`jZad|x6I3g^o>QnTz7}MI*)04l~wLae< zwJcmR!rDg{cjSbyP%+Qi$D?h_>&i~-S_Nv_*FF&z9v%)=Csc$~6FHlYe#g7$K+Ln- z{t?lsRH_4Zb@Q_4UAS-|g+>dMA=12p8yOq(@(oFgWSDhxgF&RA)-djF+@Z^T4zm*b zvS95A`My|8K13ophJN($J&JY*;Hz*k%IPkgF3agQ|I<{%$a(<7?Gwa@nb+YeWHA8o MCz6ggA3Iy}55YAJEdT%j literal 0 HcmV?d00001 diff --git a/cmd/tins2020/res/images/flower_redA_NE_disabled.png b/cmd/tins2020/res/images/flower_redA_NE_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..593c4739ac9ac99aec7074fbc07b7e371ff3916b GIT binary patch literal 3188 zcmeH~=~L537{@mOAzG0r7A>YG9#fs#LORt6n1n>7gH8o{IBF|GtYc8oM7#p##0~?N zlGxTNjzr2ZfjWSAgd&xgP&JXu)G7uvkPrgl2)RQJlKlG1AJEr*lYO)M%(Jum?DKqf z=ew7_$j*#gl(Yx{5Vvb*##aC!;UN;BV&KkI{K^l&V&blhZF`Dq%){zRtvjf&7qRN= zqkoATYV~LRNRBRKJf(I^2nQCvqQ-|15>tgY+8|nj=o0W!_mx2f&B|0JRJN^m+hr zI{~0x20(yA0I&@X?_x9n(F-FJB6*1L5V;rs_xpf8r&p9V=G3IxE03uWyH(tmt3h@1 zi@*32eb)&>EQNR6<(!_L)(3pf6ppPcRxX}9p@84Fij^M+)Ffx$Dp9(B@>W?{Sr^w6 zG->#3Hv3LTN7{p;F{NJS8DWo34>WBDNO~g~;NMeIpn#)pN4YRLIeE$6y?bNs-@pI; z=&97f!NHYsi?-v_V&hMl*;rDs4N6?G0wT?pl*-02pkjY+ZfB=dx;e!0Scba>n)b!E zGlr8+oIF{@ikdK)VnvjYSMPVv@Wpe@ijf3>zAKfUWw_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.png b/cmd/tins2020/res/images/flower_yellowC_NE_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..a74d37a33eb44bbaa81003a4edda9aefdf5d6c10 GIT binary patch literal 3017 zcmeHJ`%juz7(SrUdIQ&P(^W2Q+KpW@S=ublR-|^Wt+RopHgjf*wpN*|R$U!}P(F20 z(%6Q&CYnZzTWo8VIdQr|Q3O&3&QxW+4D4hmTE#0~xCr>cx6l5*KVS*xhjUKOIZyIF z&w0;zpR1oSPR2y;jRXM1WSmMr0{|ACV!^I3bZ~N?`2dKzk&&KumfOB!HZ--nh?)(` z$O+R}qVfB){UXAh55p>dJddkmr8ximc>izVRMNX=?ugu<*KFb!beT%-didL~hQ9e4 z{`mfS$-&sWuUvDVe8+(|3ULO2M<<;6g&O(*eko2gk`gMb4!mq zPqq#>K+_sX=#S!9cCLOwC%}CuQ*c( z9}&cX*-f&VOcvpYdl5TTCX>BR%~!$l97D_si2`CPtPdL!M0m2QC^s4+-pLQ{k`N?uMQRQ3u*$R6d+Pj&p zjp)La2bHt>-pg6j9@pRZFG9%XBdT-8Vd>2yC0S@5}*wPS5b zU54Q~da6DfVbcB1PQ+hsv)P!V#a|c5U!t^ldI~);fC`=GMCFlKR^$qW*FT9dnM`!Z zF_wh%DV6Y35vgW@Nnx~e3wS*5a2%B-2sFg8xK&0Zd>UbbW10(xyn^^f@-?Zint@66 zEp#qATrSr|W~%oElZ46xnIXil{xUbW{lr6*4yzA7hioQ;*xrEwpERqB;ji)7^=gGe zvDl2ngQ%#eObSyXs46Kb;VC&U{%E!iZCUuM&)FURzq)N<95JY^T{cPcSvfg8boT(A z&Ck*VvC8G(>>(({J6p9}FU~2?|#7Dm~lwa zn>o-g*)x&A06&yiCw?u&n=6Njl-8CO`|Y;2ZRe_dD&XiAp{1VFjK^Ywbv@{Bf