python - PyGI: Create pixbuf from 0 -
i want image of cable (line) between 2 points. thought on doing cable distance between 2 points , rotating image number of degrees have 2 points between.
but don't know how create image nothing. mean, doing image of 5px wide , "x" lenght, , rotate "y" degrees.
also if select color, nice.
sorry bad english , thanks
you can try create svg e.g. using svgwrite module , load pixbufloader. rotation can done calculating corresponding coordinates or using svg transformation.
import svgwrite gi.repository import gdkpixbuf drawing = svgwrite.drawing(size=('100px', '100px')) line = drawing.line(start=(50, 0), end=(50, 100), stroke='blue') drawing.add(line) encoded = drawing.tostring().encode() loader = gdkpixbuf.pixbufloader() loader.write(encoded) loader.close() pixbuf = loader.get_pixbuf()
Comments
Post a Comment