88 Export.__init__(self, context)
90 self.
filename = context.name +
"_img.txt" 94 def getDataColor(self, ref) :
97 def getTargetColor(self, target) :
98 if target == Target.DSP1 :
100 if target == Target.DSP2 :
101 return "darkturquoise" 102 if target == Target.EVE1 :
104 if target == Target.EVE2 :
106 if target == Target.EVE3 :
108 if target == Target.EVE4 :
110 if target == Target.A15_0 :
112 if target == Target.MCU2_0 :
114 if target == Target.MCU2_1 :
116 if target == Target.IPU2 :
117 return "MediumOrchid" 122 str = 'Export Image [' + self.
filename +
' ]\n' 127 def outputTarget(self, target) :
128 self.
file.write(
' <TR><TD bgcolor="%s">%s</TD></TR>' % (self.
getTargetColor(target), target.name))
130 def outputTargetList(self) :
131 self.
file.write(
' ColorScheme [shape=none, margin=0, label=<\n')
132 self.
file.write(
' <TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"4\">\n')
133 for target
in self.
context.target_list :
135 self.
file.write(
' </TABLE>>];\n')
136 self.
file.write(
'\n')
137 self.
file.write(
'\n')
139 def outputData(self, data) :
140 self.
file.write(
' %s [color=%s, style=filled]\n' % (data.name, self.
getDataColor(data)))
142 def outputDataList(self) :
143 self.
file.write(
'\n')
144 self.
file.write(
' /* DATA OBJECTS */\n')
145 for ref
in self.
context.data_list :
147 self.
file.write(
'\n')
149 def outputNode(self, node) :
150 self.
file.write(
' %s [label=\"%s (%s)\", color=%s, style=filled]\n' % (node.name, node.name, node.kernel, self.
getTargetColor(node.target)) )
152 def outputNodeList(self) :
153 self.
file.write(
'\n')
154 self.
file.write(
' /* NODE OBJECTS */\n')
155 for ref
in self.
context.node_list :
157 self.
file.write(
'\n')
159 def outputNodeConnection(self, node) :
161 for dir
in node.param_dir :
162 if dir == Direction.INPUT :
163 self.
file.write(
' %s -> %s [taillabel=%d, labeldistance=3]\n' % (node.ref[idx].name, node.name, idx))
165 self.
file.write(
' %s -> %s [headlabel=%d, labeldistance=3]\n' % (node.name, node.ref[idx].name, idx))
168 def outputNodeConnectionList(self) :
169 self.
file.write(
'\n')
170 self.
file.write(
' /* NODE CONNECTIONS */\n')
171 for node
in self.
context.node_list :
173 self.
file.write(
'\n')
178 print (
'Generating image from OpenVX context ...')
179 print (
'dot tool input file is [%s] ...' % self.
filename)
180 print (
'dot tool output file is [%s] ...' % self.
filenameJpg)
183 self.
file.write(
'digraph %s {\n' % self.
context.name)
184 self.
file.write(
'\n')
185 self.
file.write(
' label = \"%s\"\n' % self.
context.name)
190 self.
file.write(
'\n')
191 self.
file.write(
'}\n')
197 print(
'Executing dot tool command ... [' + command_str +
']')
198 subprocess.call(command_args)
199 print (
'Generating image from OpenVX context ... DONE !!!')
200 except FileNotFoundError:
201 print(
'ERROR: \'dot\' tool not found. Make sure \'graphviz\' is installed and \'dot\' command is added to system PATH !!!')
202 print(
'ERROR: Cannot generate .jpg file !!!')
Export objects from context to JPG image file.
def getTargetColor(self, target)
def outputTarget(self, target)
def outputNode(self, node)
def outputNodeConnection(self, node)
def outputNodeConnectionList(self)
def export(self)
Export object as C source code.
def __init__(self, context)
Constructor used to create this object.
def outputTargetList(self)
def getDataColor(self, ref)
def outputData(self, data)