MCPcopy Create free account
hub / github.com/ActiveState/code / __init__

Method __init__

recipes/Python/577674_Bitmap_Maker/recipe-577674.py:157–171  ·  view source on GitHub ↗
( self, width, height, 
                 bkgd = Color.WHITE, frgd = Color.BLACK )

Source from the content-addressed store, hash-verified

155 _DOT_DASH_LEN = _DOT_LEN + _DASH_LEN
156
157 def __init__( self, width, height,
158 bkgd = Color.WHITE, frgd = Color.BLACK ):
159 self.wd = int( ceil(width) )
160 self.ht = int( ceil(height) )
161 self.bgcolor = 0
162 self.fgcolor = 1
163 self.palette = []
164 self.palette.append( bkgd.toLong() )
165 self.palette.append( frgd.toLong() )
166 self.setDefaultPenColor()
167
168 tmparray = [ self.bgcolor ] * self.wd
169 self.bitarray = [ tmparray[:] for i in range( self.ht ) ]
170 self.currentPen = 1
171 self.fontName = "%s-%d-%s" % ( "none", 0, "none" )
172
173 def setDefaultPenColor( self ):
174 self.currentPen = self.fgcolor

Callers

nothing calls this directly

Calls 4

setDefaultPenColorMethod · 0.95
rangeFunction · 0.85
appendMethod · 0.45
toLongMethod · 0.45

Tested by

no test coverage detected