Ejemplo n.º 1
0
	def load_pattern(self):
		img_file = self.app.import_pattern(self.dlg)
		if img_file:
			fobj = open(img_file, 'rb')
			pattern, flag = libimg.read_pattern(fobj.read())
			pattern_type = sk2_const.PATTERN_TRUECOLOR
			if flag:
				pattern_type = sk2_const.PATTERN_IMG
				if flag == 'EPS':
					pattern_type = sk2_const.PATTERN_EPS
			self.pattern_def[0] = pattern_type
			self.pattern_def[1] = pattern
			if self.callback: self.callback(self.get_pattern_def())
Ejemplo n.º 2
0
	def load_pattern(self):
		img_file = self.app.import_pattern(self.dlg)
		if img_file:
			fobj = open(img_file, 'rb')
			pattern, flag = libimg.read_pattern(fobj.read())
			pattern_type = sk2_const.PATTERN_TRUECOLOR
			if flag:
				pattern_type = sk2_const.PATTERN_IMG
				if flag == 'EPS':
					pattern_type = sk2_const.PATTERN_EPS
			self.pattern_def[0] = pattern_type
			self.pattern_def[1] = pattern
			if self.callback: self.callback(self.get_pattern_def())
Ejemplo n.º 3
0
	def tr_dibcreate_pat_brush(self, chunk):
		# style, colorusage = get_data('<hh', chunk[:4])
		imagestr = wmflib.dib_to_imagestr(chunk[4:])
		bitsperpixel = get_data('<h', chunk[18:20])[0]

		ptrn, flag = libimg.read_pattern(imagestr)

		ptrn_type = sk2_const.PATTERN_TRUECOLOR
		if flag or bitsperpixel == 1: ptrn_type = sk2_const.PATTERN_IMG
		ptrn_style = [deepcopy(sk2_const.RGB_BLACK),
					deepcopy(sk2_const.RGB_WHITE)]
		ptrn_trafo = [] + sk2_const.NORMAL_TRAFO
		ptrn_transf = [] + sk2_const.PATTERN_TRANSFORMS

		pattern = [ptrn_type, ptrn, ptrn_style, ptrn_trafo, ptrn_transf]
		fill = [sk2_const.FILL_EVENODD, sk2_const.FILL_PATTERN, pattern]
		self.add_gdiobject(('fill', fill))
Ejemplo n.º 4
0
    def tr_dibcreate_pat_brush(self, chunk):
        # style, colorusage = get_data('<hh', chunk[:4])
        imagestr = wmflib.dib_to_imagestr(chunk[4:])
        bitsperpixel = get_data('<h', chunk[18:20])[0]

        ptrn, flag = libimg.read_pattern(imagestr)

        ptrn_type = sk2const.PATTERN_TRUECOLOR
        if flag or bitsperpixel == 1:
            ptrn_type = sk2const.PATTERN_IMG
        ptrn_style = [deepcopy(sk2const.RGB_BLACK),
                      deepcopy(sk2const.RGB_WHITE)]
        ptrn_trafo = [] + sk2const.NORMAL_TRAFO
        ptrn_transf = [] + sk2const.PATTERN_TRANSFORMS

        pattern = [ptrn_type, ptrn, ptrn_style, ptrn_trafo, ptrn_transf]
        fill = [sk2const.FILL_EVENODD, sk2const.FILL_PATTERN, pattern]
        self.add_gdiobject(('fill', fill))