1# -*- coding: utf-8 -*-2# Copyright 2011 Takeshi KOMIYA3#4# Licensed under the Apache License, Version 2.0 (the "License");5# you may not use this file except in compliance with the License.6# You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.1516from functools import partial1718from blockdiag.imagedraw import textfolder19from blockdiag.utils import Box202122class ImageDraw(object):23 self_generative_methods = []24 nosideeffect_methods = ['set_canvas_size', 'textsize', 'textlinesize']25 supported_path = False26 baseline_text_rendering = False2728 def set_canvas_size(self, size):29 pass3031 def set_options(self, **kwargs):32 pass3334 def line(self, xy, **kwargs):35 pass3637 def rectangle(self, box, **kwargs):38 pass3940 def polygon(self, xy, **kwargs):41 pass4243 def arc(self, xy, start, end, **kwargs):44 pass4546 def ellipse(self, xy, **kwargs):47 pass4849 def textsize(self, string, font, maxwidth=None, **kwargs):50 if maxwidth is None:51 maxwidth = 655355253 box = Box(0, 0, maxwidth, 65535)54 textbox = self.textfolder(box, string, font, **kwargs)55 return textbox.outlinebox.size565758 def textfolder(self):59 return partial(textfolder.get, self,60 adjustBaseline=self.baseline_text_rendering)6162 def textlinesize(self, string, font, **kwargs):63 pass6465 def text(self, xy, string, font, **kwargs):66 pass6768 def textarea(self, box, string, font, **kwargs):69 pass7071 def image(self, box, url):72 pass7374 def save(self, filename, size, _format):75 pass