MLX42 1.0
MLX42
Loading...
Searching...
No Matches
xpm3_conv Namespace Reference

Functions

 main ()
 

Variables

dict colours
 

Function Documentation

◆ main()

xpm3_conv.main ( )

Definition at line 774 of file xpm3_conv.py.

774def main():
775 if len(sys.argv) != 2:
776 print("Use: py xpmconv.py |filename.xpm|")
777 exit(1)
778 if ".xpm" not in sys.argv[1]:
779 print("not an xpm file")
780 exit(1)
781 with open(sys.argv[1], "r") as f:
782 oldxpm = f.readlines()[3:]
783 fname = (sys.argv[1])[:-3] + "xpm42"
784 newxpm42 = open(fname, "w")
785 newxpm42.write("!XPM42\n")
786 cpp = int(oldxpm[0].split()[3])
787 newxpm42.write(oldxpm[0][1:-3] + "c\n")
788 oldxpm.pop(0)
789 prev = 0
790 for l in oldxpm:
791 if "/* pixels */" in l:
792 break
793 temp = l[1:-3] + "FF" + "\n"
794 out = temp[:cpp]
795 out = out + temp[(cpp+2):]
796 if "#" not in out[2:]:
797 repcol = out[cpp+1:]
798 temp = repcol[:-3].lower()
799 repcol = colours[repcol[:-3].lower()]
800 out = out[:cpp+1] + "#" + repcol.upper() + "FF\n"
801 if temp == "none":
802 out = out[:-3] + "00\n"
803 newxpm42.write(out)
804 prev += 1
805 oldxpm = oldxpm[prev + 1:]
806 for i, l in enumerate(oldxpm):
807 if "};" in oldxpm[i + 1]:
808 temp = l[1:-2] + "\n"
809 newxpm42.write(temp)
810 break
811 temp = l[1:-3] + "\n"
812 newxpm42.write(temp)
813
GLuint GLsizei GLsizei * length
Definition glad.h:3372
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ colours

dict xpm3_conv.colours

Definition at line 18 of file xpm3_conv.py.