Commits

James Tocknell committed 604f511 Merge

Merged

Comments (0)

Files changed (3)

docs/fake/shinypress/render.py

+class ScalingMode(object):
+    """
+    Scaling modes for use with the scale() function.
+
+    :var NONE: don't change the content size
+    :var KEEP_ASPECT: make the content as large as possible without changing the
+        aspect ratio
+    :var STRETCH: fill the target area with the content
+    :var ZOOM: fill the target area completely without changing the aspect ratio
+    """
+    NONE = 0
+    KEEP_ASPECT = 1
+    STRETCH = 2
+    ZOOM = 3
+
+def scale(content_size, target_size, scaling_mode):
+    """
+    Determine the size at which the given content should be drawn in order to
+    fit the given target area.
+
+    :param content_size: the size of the content to be rendered
+    :type content_size: a (width, height) tuple
+    :param target_size: the size of the area it should fit in
+    :type target_size: a (width, height) tuple
+    :param scaling_mode: how to resize the content
+    :type scaling_mode: shinypress.render.ScalingMode
+    :rtype: a (width, height) tuple
+    """
+    pass
+
+def render_image(
+    ctx, image, size,
+    scaling_mode=ScalingMode.KEEP_ASPECT,
+):
+    """
+    Render an image onto the given Cairo context using the given scaling mode.
+
+    :param ctx: a Cairo context
+    :param image: the image to be rendered
+    :param size: the dimensions of the image box
+    :type size: a (width, height) tuple
+    :param scaling_mode: how to resize the image to fit the image box
+    :type scaling_mode: shinypress.render.ScalingMode
+    """
+    pass
+
+def render_text(ctx, text, size, **todo_fill_in_these_kwargs):
+    """
+    Render some text onto the given Cairo context.
+
+    :param ctx: a Cairo context
+    :param text: the text to be rendered
+    :type text: unicode
+    :param size: the dimensions of the text box
+    :type size: a (width, height) tuple
+    """
+    pass

docs/fake/shinypress/theme.py

         Load a theme specification from a JSON file.
 
         :param f: file object
-        :rtype: Theme
+        :rtype: shinypress.theme.Theme
         """
 
     def get_block_size(self, template, block):
             theme.render(ctx, template, blocks)
             surf.show_page()
 
+Primitives
+~~~~~~~~~~
+
+There are some simple functions provided for rendering text and images:
+
+.. automodule:: shinypress.render
+    :members:
+
 Handlers
 ~~~~~~~~
 Handlers must be an object which specifies a ``layout`` method which takes a