cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
var.common.Sketcher Class Reference

Public Member Functions

def __init__ (self, windowname, dests, colors_func)
 
def show (self)
 
def on_mouse (self, event, x, y, flags, param)
 

Public Attributes

 prev_pt
 
 windowname
 
 dests
 
 colors_func
 
 dirty
 

Detailed Description

Definition at line 118 of file common.py.

Constructor & Destructor Documentation

◆ __init__()

def var.common.Sketcher.__init__ (   self,
  windowname,
  dests,
  colors_func 
)

Definition at line 119 of file common.py.

119  def __init__(self, windowname, dests, colors_func):
120  self.prev_pt = None
121  self.windowname = windowname
122  self.dests = dests
123  self.colors_func = colors_func
124  self.dirty = False
125  self.show()
126  cv.setMouseCallback(self.windowname, self.on_mouse)
127 

Member Function Documentation

◆ on_mouse()

def var.common.Sketcher.on_mouse (   self,
  event,
  x,
  y,
  flags,
  param 
)

Definition at line 131 of file common.py.

131  def on_mouse(self, event, x, y, flags, param):
132  pt = (x, y)
133  if event == cv.EVENT_LBUTTONDOWN:
134  self.prev_pt = pt
135  elif event == cv.EVENT_LBUTTONUP:
136  self.prev_pt = None
137 
138  if self.prev_pt and flags & cv.EVENT_FLAG_LBUTTON:
139  for dst, color in zip(self.dests, self.colors_func()):
140  cv.line(dst, self.prev_pt, pt, color, 5)
141  self.dirty = True
142  self.prev_pt = pt
143  self.show()
144 
145 
146 # palette data from matplotlib/_cm.py
Here is the call graph for this function:

◆ show()

def var.common.Sketcher.show (   self)

Definition at line 128 of file common.py.

128  def show(self):
129  cv.imshow(self.windowname, self.dests[0])
130 
Here is the caller graph for this function:

Member Data Documentation

◆ colors_func

var.common.Sketcher.colors_func

Definition at line 123 of file common.py.

◆ dests

var.common.Sketcher.dests

Definition at line 122 of file common.py.

◆ dirty

var.common.Sketcher.dirty

Definition at line 124 of file common.py.

◆ prev_pt

var.common.Sketcher.prev_pt

Definition at line 120 of file common.py.

◆ windowname

var.common.Sketcher.windowname

Definition at line 121 of file common.py.


The documentation for this class was generated from the following file: