コード例 #1
0
	def update(self):
		self.stroke_id = str(self.chunk[8:12].encode('hex'))
		self.cache_fields.append((8, 4, 'outline id'))

		data = self.chunk[8:]

		ls_offset = 4
		lc_offset = 6
		ct_offset = 8
		lw_offset = 12
		offset = 28
		dash_offset = 104

		if self.version == CDR13:
			ls_offset = 24
			lc_offset = 26
			ct_offset = 28
			lw_offset = 30
			offset = 40
			dash_offset = 116

		self.stroke_spec = ord(data[ls_offset])
		self.cache_fields.append((ls_offset + 8, 1, 'outline specification'))

		self.stroke_caps = ord(data[lc_offset])
		self.cache_fields.append((lc_offset + 8, 1, 'outline caps'))

		self.stroke_join = ord(data[ct_offset])
		self.cache_fields.append((ct_offset + 8, 1, 'outline corners'))

		self.stroke_width = parse_size_value(data[lw_offset:lw_offset + 4])
		self.cache_fields.append((lw_offset + 8, 1, 'outline width'))

		dashnum = word2py_int(data[dash_offset:dash_offset + 2])
		self.cache_fields.append((dash_offset + 8, 2, 'number of dash records'))

		if dashnum > 0:
			self.stroke_dashes = range(dashnum)
			for i in self.stroke_dashes:
				dash = word2py_int(data[dash_offset + 2 + i * 2:dash_offset + 4 + i * 2])
				self.stroke_dashes[i] = dash
			self.cache_fields.append((dash_offset + 10, 2 * dashnum, 'dash records'))

		offset += 0x30
		self.color_space_type = ord(data[offset])
		self.cache_fields.append((offset + 8, 1, 'color space type'))

		offset += 16
		self.stroke_color = parse_cdr_color(self.color_space_type, self.chunk[offset:offset + 4])
		if self.stroke_color:
			self.cache_fields.append((offset, 4, 'color value'))
コード例 #2
0
ファイル: utils.py プロジェクト: sk1project/uc2
def parse_hsb(data):
	"""
	Parses HSB/HSV color bytes and returns fill style list.
	"""
	h = word2py_int(data[0:2]) / 360.0
	s = ord(data[2]) / 255.0
	v = ord(data[3]) / 255.0
	r, g, b = hsv_to_rgb(h, s, v)
	return [uc2const.COLOR_RGB, [r, g, b], 1.0, '']
コード例 #3
0
ファイル: utils.py プロジェクト: sk1project/uc2
def parse_hls(data):
	"""
	Parses HLS color bytes and returns fill style list.
	"""
	h = word2py_int(data[0:2]) / 360.0
	l = ord(data[2]) / 255.0
	s = ord(data[3]) / 255.0
	r, g, b = hls_to_rgb(h, l, s)
	return [uc2const.COLOR_RGB, [r, g, b], 1.0, '']
コード例 #4
0
def parse_hls(data):
    """
	Parses HLS color bytes and returns fill style list.
	"""
    h = word2py_int(data[0:2]) / 360.0
    l = ord(data[2]) / 255.0
    s = ord(data[3]) / 255.0
    r, g, b = hls_to_rgb(h, l, s)
    return [uc2const.COLOR_RGB, [r, g, b], 1.0, '']
コード例 #5
0
def parse_hsb(data):
    """
	Parses HSB/HSV color bytes and returns fill style list.
	"""
    h = word2py_int(data[0:2]) / 360.0
    s = ord(data[2]) / 255.0
    v = ord(data[3]) / 255.0
    r, g, b = hsv_to_rgb(h, s, v)
    return [uc2const.COLOR_RGB, [r, g, b], 1.0, '']
コード例 #6
0
	def update(self):
		data = self.chunk[8:]
		self.font_id = str(data[0:2].encode('hex'))
		self.cache_fields.append((8, 2, 'font id'))

		self.encoding = word2py_int(data[2:4])
		self.cache_fields.append((10, 2, 'font encoding'))

		self.font_flags = str(data[4:18].encode('hex'))
		self.cache_fields.append((12, 14, 'font flags'))

		try:
			#Gets font name
			data = data[18:52]
			zero = '00'.decode('hex')
			if not self.version in [CDR6, CDR7, CDR8, CDR9]:
				self.font_name = (data.rstrip(zero) + zero).decode('utf-16')
			else:
				self.font_name = data.rstrip(zero).decode(self.config.system_encoding)

			self.cache_fields.append((26, len(data), 'font name'))
		except:
			self.font_name = ''