mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-11 19:19:59 +08:00
Make alpha value to ClearColormap adjustable.
This commit is contained in:
@@ -65,10 +65,10 @@ class LinearColormap(LinearSegmentedColormap):
|
||||
class ClearColormap(LinearColormap):
|
||||
"""Color map that varies linearly from alpha = 0 to 1
|
||||
"""
|
||||
def __init__(self, rgb, name='clear_color'):
|
||||
def __init__(self, rgb, max_alpha=1, name='clear_color'):
|
||||
r, g, b = rgb
|
||||
cg_speq = {'blue': [(0.0, b), (1.0, b)],
|
||||
'green': [(0.0, g), (1.0, g)],
|
||||
'red': [(0.0, r), (1.0, r)],
|
||||
'alpha': [(0.0, 0.0), (1.0, 1.0)]}
|
||||
'alpha': [(0.0, 0.0), (1.0, max_alpha)]}
|
||||
LinearColormap.__init__(self, name, cg_speq)
|
||||
|
||||
@@ -10,10 +10,7 @@ qApp = None
|
||||
|
||||
|
||||
class ImageCanvas(FigureCanvasQTAgg):
|
||||
"""Canvas for displaying images.
|
||||
|
||||
This canvas derives from Matplotlib, so your normal
|
||||
"""
|
||||
"""Canvas for displaying images."""
|
||||
def __init__(self, parent, image, **kwargs):
|
||||
self.fig, self.ax = figimage(image, **kwargs)
|
||||
|
||||
@@ -91,7 +88,6 @@ class ImageViewer(QtGui.QMainWindow):
|
||||
self.layout = QtGui.QVBoxLayout(self.main_widget)
|
||||
self.layout.addWidget(self.canvas)
|
||||
|
||||
#TODO: Set status bar to fixed-width font so status doesn't wiggle
|
||||
status_bar = self.statusBar()
|
||||
self.status_message = status_bar.showMessage
|
||||
sb_size = status_bar.sizeHint()
|
||||
@@ -109,7 +105,7 @@ class ImageViewer(QtGui.QMainWindow):
|
||||
self.move(0, 0)
|
||||
w = size.width()
|
||||
y = 0
|
||||
#TODO: Layout isn't correct for multiple plots (overlaps).
|
||||
#TODO: Layout isn't correct for multiple plugins (overlaps).
|
||||
for p in self.plugins:
|
||||
p.move(w, y)
|
||||
y += p.geometry().height()
|
||||
|
||||
Reference in New Issue
Block a user