Changes

Jump to navigation Jump to search
Line 19: Line 19:  
  self.area.window.draw_rectangle(gc, True, x, y, w, h)
 
  self.area.window.draw_rectangle(gc, True, x, y, w, h)
   −
The arguments for ''alloc_color'' are between 1-
+
The arguments for ''alloc_color'' are between 0-65535 and the ''set_source_rgb'' method from cairo are between 0-1, so we have to convert these values as well:
 
  −
now, with cairo we should do something like this
      
  cr.set_source_rgb(0.762, 0.762, 0.762)
 
  cr.set_source_rgb(0.762, 0.762, 0.762)
Line 27: Line 25:  
  cr.fill()
 
  cr.fill()
   −
 
+
Note that the second attributo of ''draw_rectangle'' tells us about if the rectangle is filled or not. In this case is True, so we use ''cr.fill()'' in the new way but if we want just the outside lines of the rectangle we should use ''cr.stroke()''
 
  −
gc.foreground = self.area.get_colormap().alloc_color(0, 0, 0)
  −
self.area.window.draw_rectangle(gc, False, x, y, w, h)
      
= Code Snippets =
 
= Code Snippets =
266

edits

Navigation menu