def on_draw(self, widget, cr, user_data=None): if not self._supports_alpha: bgcolor = self._app.settings.get_string("background-color") cr.set_source_rgb(util.rgb2rf(bgcolor), util.rgb2gf(bgcolor), util.rgb2bf(bgcolor)) cr.paint() if self._app.agent.get_property("agent-name") != "" and not self._app.agent.frame_is_blank(): if self._app.settings.get_boolean("native-resolution"): cr.reset_clip() sz_x, sz_y = self._app.agent.agent_size cr.rectangle(0, 0, sz_x, sz_y) cr.clip() else: assert False for i in range(0, self._app.agent.get_frame_overlays()): off_x, off_y = self._app.agent.get_frame_offset(i) cr.set_source_surface(self._app.agent.surface, off_x * -1, off_y * -1) cr.paint() return False
def runTest(self): util.rgb2rf("#000000") == 0.0 util.rgb2rf("#ff0000") == 1.0