Home modules.gotpike.org
Username: Password: [Create Account]
[Forgot Password?]

Modules

ADT
Database
GTK2
GUI
IP
PiJAX
Public
Sql
Stdio
Subversion
System
Tools
Xosd
lua
v4l2
wx

Recent Changes

Public.Parser.XML2 1.50
Public.ZeroMQ 1.1
Public.Template.Mustache 1.0
Public.Protocols.XMPP 1.4
Sql.Provider.jdbc 1.0

Popular Downloads

Public.Parser.JSON2 1.0
Public.Parser.JSON 0.2
GTK2 2.23
Public.Web.FCGI 1.8
Public.Parser.XML2 1.48


Pike Module Reference:

module version 0.93, prepared

  MODULE Cairo
Classes
Context
Error
FontOptions
GTK2Context
Gradient
ImageSurface
Matrix
PDFSurface
PSSurface
Path
PathElement
PathIterator
Pattern
Surface
SurfacePattern

Description

This module provides binding to the Cairo 2D grapics library. See http://www.cairographics.org/ for more information about Cairo.


Constants

constant Cairo.HAS_PNG_FUNCTIONS
constant Cairo.HAS_FT_FONT

Description

Feature-flag defines that can be used to check what Cairo features that are available. These are set to 0 (zero) or 1 (one).


Constants

constant Cairo.ANTIALIAS_DEFAULT
constant Cairo.ANTIALIAS_NONE
constant Cairo.ANTIALIAS_GRAY
constant Cairo.ANTIALIAS_SUBPIXEL

Description

Various anti-alias settings that can be used when drawing shapes


Constants

constant Cairo.OPERATOR_CLEAR
constant Cairo.OPERATOR_SOURCE
constant Cairo.OPERATOR_OVER
constant Cairo.OPERATOR_IN
constant Cairo.OPERATOR_OUT
constant Cairo.OPERATOR_ATOP
constant Cairo.OPERATOR_DEST
constant Cairo.OPERATOR_DEST_OVER
constant Cairo.OPERATOR_DEST_IN
constant Cairo.OPERATOR_DEST_OUT
constant Cairo.OPERATOR_DEST_ATOP
constant Cairo.OPERATOR_XOR
constant Cairo.OPERATOR_ADD
constant Cairo.OPERATOR_SATURATE

Description

Various operators that can be used when drawing shapes


Constants

constant Cairo.LINE_CAP_BUTT
constant Cairo.LINE_CAP_ROUND
constant Cairo.LINE_CAP_SQUARE


Constants

constant Cairo.LINE_JOIN_MITER
constant Cairo.LINE_JOIN_ROUND
constant Cairo.LINE_JOIN_BEVEL


Constants

constant Cairo.FILL_RULE_WINDING
constant Cairo.FILL_RULE_EVEN_ODD


Constants

constant Cairo.PATH_MOVE_TO
constant Cairo.PATH_LINE_TO
constant Cairo.PATH_CURVE_TO
constant Cairo.PATH_CLOSE_PATH

Description

The various types of path elements in an Cairo path


Constant FORMAT_ARGB32

constant Cairo.FORMAT_ARGB32

Description

Each pixel is a 32-bit quantity, with alpha in the upper 8 bits, then red, then green, then blue. The 32-bit quantities are stored native-endian. Pre-multiplied alpha is used. (That is, 50% transparent red is 0x80800000, not 0x80ff0000.)


Constant FORMAT_RGB24

constant Cairo.FORMAT_RGB24

Description

Each pixel is a 32-bit quantity, with the upper 8 bits unused. Red, Green, and Blue are stored in the remaining 24 bits in that order.


Constant FORMAT_A8

constant Cairo.FORMAT_A8

Description

Each pixel is a 8-bit quantity holding an alpha value.


Constant FORMAT_A1

constant Cairo.FORMAT_A1

Description

Each pixel is a 1-bit quantity holding an alpha value. Pixels are packed together into 32-bit quantities. The ordering of the bits matches the endianess of the platform. On a big-endian machine, the first pixel is in the uppermost bit, on a little-endian machine the first pixel is in the least-significant bit.


Constants

constant Cairo.CONTENT_COLOR
constant Cairo.CONTENT_ALPHA
constant Cairo.CONTENT_COLOR_ALPHA

Description

The type of contents in Cairo's image surfaces


Constants

constant Cairo.SURFACE_TYPE_IMAGE
constant Cairo.SURFACE_TYPE_PDF
constant Cairo.SURFACE_TYPE_PS
constant Cairo.SURFACE_TYPE_XLIB
constant Cairo.SURFACE_TYPE_XCB
constant Cairo.SURFACE_TYPE_GLITZ
constant Cairo.SURFACE_TYPE_QUARTZ
constant Cairo.SURFACE_TYPE_WIN32
constant Cairo.SURFACE_TYPE_BEOS
constant Cairo.SURFACE_TYPE_DIRECTFB
constant Cairo.SURFACE_TYPE_SVG

Description

The surface type is used to describe the type of a given surface. The surface types are also known as "backends" or "surface backends" within cairo.

For each type of a surface there is a corresponding class that generally will be of the form Cairo.*Surface. Examples are Cairo.ImageSurface and Cairo.PDFSurface.

The surface type can be queried with get_type

The various cairo_surface functions can be used with surfaces of any type, but some backends also provide type-specific functions that must only be called with a surface of the appropriate type.

  CLASS Cairo.Error
Methods
create()
Description

An error generated by Cairo.


Variable code

int Cairo.Error()->code

Description

The error status code.


Variable status_string

string Cairo.Error()->status_string

Description

String representation of the error


Method create

void Cairo.Error()->create(int code)

Description

Create an error object with a specific error code.

Parameter code

The status code, one of CAIRO_STATUS_*

  CLASS Cairo.FontOptions
Methods
copy()
create()
equal()
merge()
status()

Method create

void Cairo.FontOptions()->create()


Method copy

object(Cairo.FontOptions) Cairo.FontOptions()->copy()


Method status

int Cairo.FontOptions()->status()


Method merge

void Cairo.FontOptions()->merge(object(Cairo.FontOptions) options)


Method equal

int(0..1) Cairo.FontOptions()->equal(object(Cairo.FontOptions) options)

  CLASS Cairo.Matrix
Methods
_sprintf()
init()
init_identity()
init_rotate()
init_scale()
init_translation()
invert()
multiply()
rotate()
scale()
transform_distance()
transform_point()
translate()

Method init

object(Cairo.Matrix) Cairo.Matrix()->init(float|int xx, float|int yx, float|int xy, float|int x0, float|int y0)


Method init_identity

object(Cairo.Matrix) Cairo.Matrix()->init_identity()


Method init_translation

object(Cairo.Matrix) Cairo.Matrix()->init_translation(float|int x, float|int y)


Method init_scale

object(Cairo.Matrix) Cairo.Matrix()->init_scale(float|int sx, float|int sy)


Method init_rotate

object(Cairo.Matrix) Cairo.Matrix()->init_rotate(float|int r)


Method translate

object(Cairo.Matrix) Cairo.Matrix()->translate(float|int tx, float|int ty)


Method scale

object(Cairo.Matrix) Cairo.Matrix()->scale(float|int sx, float|int sy)


Method rotate

object(Cairo.Matrix) Cairo.Matrix()->rotate(float|int r)


Method invert

object(Cairo.Matrix) Cairo.Matrix()->invert()


Method multiply

object(Cairo.Matrix) Cairo.Matrix()->multiply(object(Cairo.Matrix) m)


Method transform_distance

array(float) Cairo.Matrix()->transform_distance()


Method transform_point

array(float) Cairo.Matrix()->transform_point()


Method _sprintf

void Cairo.Matrix()->_sprintf()

  CLASS Cairo.Context
Methods
append_path()
arc()
arc_negative()
cairo_curve_to()
cairo_rel_curve_to()
clip()
clip_preserve()
close_path()
copy_page()
copy_path()
copy_path_flat()
create()
fill()
fill_extents()
fill_preserve()
get_anti_alias()
get_fill_rule()
get_font_matrix()
get_font_options()
get_line_cap()
get_line_join()
get_miter_limit()
get_operator()
get_tolerance()
identity_matrix()
in_fill()
in_stroke()
line_to()
mask()
move_to()
new_path()
paint()
paint_with_alpha()
rectangle()
rel_line_to()
rel_move_to()
reset_clip()
restore()
rotate()
save()
scale()
select_font_face()
set_anti_alias()
set_dash()
set_fill_rule()
set_font_matrix()
set_font_options()
set_font_size()
set_line_cap()
set_line_join()
set_line_width()
set_miter_limit()
set_operator()
set_source()
set_tolerance()
show_page()
show_text()
stroke()
stroke_extents()
text_extents()
transform()
translate()
user_to_device()
user_to_device_distance()
Description

Cairo.Context is the main object used when drawing with cairo. To draw with cairo, you create a Cairo.Context, set the target surface, and drawing options for the Cairo.Context, create shapes with functions like move_to and line_to, and then draw shapes with stroke or fill.

Cairo.Context's can be pushed to a stack via save. They may then safely be changed, without loosing the current state. Use restore to restore to the saved state.


Method create

void Cairo.Context()->create(object(Cairo.Surface) surface)

Description

Create a Cairo.Context to a Cairo.Surface. See below for a trivial example that draws a triangle to a image surface and saves the result to a png-file with alpha-channel.

Example
// Draw a triangle to a png-file
  Cairo.Surface surface = Cairo.ImageSurface(Cairo.FORMAT_ARGB32, 100, 100);
  Cairo.Context cr = Cairo.Context(surface);
  cr->move_to(0,0);
  cr->line_to(100,100);
  cr->line_to(0,100);
  cr->close_path();
  cr->set_source(0.4, 0.5, 0.6, 1.0);
  cr->fill_preserve();
  cr->set_source(1.0, 1.0, 1.0, 1.0);
  cr->set_line_width(1.0);
  cr->stroke();
  mapping(string:Image.Image) image = surface->get_image();
  Image.Image im = image["image"];
  Image.Image alpha = image["alpha"];
  Stdio.write_file("output.png",
                   Image.PNG.encode(im, ([ "alpha" : alpha ])));

Method move_to

object(Cairo.Context) Cairo.Context()->move_to(int|float x, int|float y)

Description

If the current subpath is not empty, begin a new subpath. After this call the current point will be (x, y).

Parameter x

The X coordinate of the new position

Parameter y

The Y coordinate of the new position


Method rel_move_to

object(Cairo.Context) Cairo.Context()->rel_move_to(int|float x, int|float y)

Description

If the current subpath is not empty, begin a new subpath. After this call the current point will be offset by (x, y).

Parameter x

The X offset

Parameter y

The Y offset


Method arc

object(Cairo.Context) Cairo.Context()->arc(int|float xc, int|float yc, int|float radius, int|float angle1, int|float angle2)

Description

Adds a circular arc of the given radius to the current path. The arc is centered at (xc, yc), begins at angle1 and proceeds in the direction of increasing angles to end at angle2. If angle2 is less than angle1 it will be progressively increased by 2*PI until it is greater than angle1.

If there is a current point, an initial line segment will be added to the path to connect the current point to the beginning of the arc.

Angles are measured in radians. An angle of 0 is in the direction of the positive X axis (in user-space). An angle of PI radians (90 degrees) is in the direction of the positive Y axis (in user-space). Angles increase in the direction from the positive X axis toward the positive Y axis. So with the default transformation matrix, angles increase in a clockwise direction.

(To convert from degrees to radians, use degrees * (Math.pi / 180).)

This function gives the arc in the direction of increasing angles; see arc_negative to get the arc in the direction of decreasing angles.

The arc is circular in user-space. To achieve an elliptical arc, you can scale the current transformation matrix by different amounts in the X and Y directions. For example, to draw an ellipse in the box given by x, y, width, height:

Example
cr = Cairo.Context();
 cr->save();
 cr->translate(x + width / 2.0, y + height / 2.0);
 cr->scale(1.0 / (height / 2.0), 1.0 / (width / 2.0));
 cr->arc(0., 0.0, 1.0, 0.0, 2 * Math.pi);
 cr->restore();

Method arc_negative

object(Cairo.Context) Cairo.Context()->arc_negative(int|float xc, int|float yc, int|float radius, int|float angle1, int|float angle2)

Description

Adds a circular arc of the given radius to the current path. The arc is centered at (xc, yc), begins at angle1 and proceeds in the direction of decreasing angles to end at angle2. If angle2 is greater than angle1 it will be progressively decreased by [2*PI] until it is greater than angle1.

See arc for more details. This function differs only in the direction of the arc between the two angles.


Method rel_line_to

object(Cairo.Context) Cairo.Context()->rel_line_to(int|float dx, int|float dy)


Method line_to

object(Cairo.Context) Cairo.Context()->line_to(int|float x, int|float y)


Method cairo_curve_to

object(Cairo.Context) Cairo.Context()->cairo_curve_to(float x1, float y1, float x2, float y2, float x3, float y3)

Parameter x1

the X coordinate of the first control point

Parameter y1

the Y coordinate of the first control point

Parameter x2

the X coordinate of the second control point

Parameter y2

the Y coordinate of the second control point

Parameter x3

the X coordinate of the end of the curve

Parameter y3

the Y coordinate of the end of the curve

Adds a cubic Bezier spline to the path from the current point to position (x3, y3) in user-space coordinates, using (x1, y1) and (x2, y2) as the control points. After this call the current point will be (x3, y3).


Method cairo_rel_curve_to

object(Cairo.Context) Cairo.Context()->cairo_rel_curve_to(float dx1, float dy1, float dx2, float dy2, float dx3, float dy3)


Method close_path

object(Cairo.Context) Cairo.Context()->close_path()


Method set_source

object(Cairo.Context) Cairo.Context()->set_source(object(Image.Color) color)
object(Cairo.Context) Cairo.Context()->set_source(object(Image.Color) color, float a)
object(Cairo.Context) Cairo.Context()->set_source(object(Cairo.Pattern) pattern)
object(Cairo.Context) Cairo.Context()->set_source(object(Cairo.Surface) surface, float|int x, float|int y)
object(Cairo.Context) Cairo.Context()->set_source(float r, float g, float b)
object(Cairo.Context) Cairo.Context()->set_source(float r, float g, float b, float a)


Method fill_preserve

object(Cairo.Context) Cairo.Context()->fill_preserve()


Method fill

object(Cairo.Context) Cairo.Context()->fill()


Method clip

void Cairo.Context()->clip()


Method clip_preserve

object(Cairo.Context) Cairo.Context()->clip_preserve()


Method reset_clip

object(Cairo.Context) Cairo.Context()->reset_clip()


Method save

object(Cairo.Context) Cairo.Context()->save()


Method restore

void Cairo.Context()->restore()

Note

This function does not return its own object. This is because the state is cleared from the cairo context when restore is called, and nesting of this command makes little sense.


Method translate

object(Cairo.Context) Cairo.Context()->translate(float|int tx, float|int ty)


Method scale

object(Cairo.Context) Cairo.Context()->scale(float|int sx, float|int sy)


Method rotate

object(Cairo.Context) Cairo.Context()->rotate(float|int r)


Method paint

object(Cairo.Context) Cairo.Context()->paint()


Method paint_with_alpha

object(Cairo.Context) Cairo.Context()->paint_with_alpha()


Method new_path

object(Cairo.Context) Cairo.Context()->new_path()


Method rectangle

object(Cairo.Context) Cairo.Context()->rectangle()


Method set_line_width

object(Cairo.Context) Cairo.Context()->set_line_width(float width)


Method stroke

void Cairo.Context()->stroke()

Note

This function does not return its own object. This is because the path is cleared from the cairo context when stroke is called, and nesting of this command makes little sense.


Method copy_path

object(Cairo.Path) Cairo.Context()->copy_path()


Method copy_path_flat

object(Cairo.Path) Cairo.Context()->copy_path_flat()


Method append_path

object(Cairo.Context) Cairo.Context()->append_path(Cairo.Path)


Method transform

object(Cairo.Context) Cairo.Context()->transform(object(Cairo.Matrix) matrix)


Method identity_matrix

object(Cairo.Context) Cairo.Context()->identity_matrix()

Description

Reset the transformation matrix on this context to the identity matrix.


Method select_font_face

object(Cairo.Context) Cairo.Context()->select_font_face(string font_family, int slant, int weight)

Description

Select font.

Selects a family and style of font from a simplified description as a family name, slant and weight. This function is meant to be used only for applications with simple font needs: Cairo doesn't provide for operations such as listing all available fonts on the system, and it is expected that most applications will need to use a more comprehensive font handling and text layout library in addition to cairo.


Method set_font_size

object(Cairo.Context) Cairo.Context()->set_font_size(float|int size)

Description

Sets the current font matrix to a scale by a factor of size, replacing any font matrix previously set with cairo_set_font_size() or cairo_set_font_matrix(). This results in a font size of size user space units. (More precisely, this matrix will result in the font's em-square being a size by size square in user space.)


Method set_font_matrix

object(Cairo.Context) Cairo.Context()->set_font_matrix(Cairo.Matrix)


Method get_font_matrix

object(Cairo.Matrix) Cairo.Context()->get_font_matrix()


Method set_font_options

object(Cairo.Context) Cairo.Context()->set_font_options(object(Cairo.FontOptions) options)


Method get_font_options

object(Cairo.FontOptions) Cairo.Context()->get_font_options()


Method show_text

object(Cairo.Context) Cairo.Context()->show_text(string text)

Description

A drawing operator that generates the shape from a string of UTF-8 characters, rendered according to the current font_face, font_size (font_matrix), and font_options.

This function first computes a set of glyphs for the string of text. The first glyph is placed so that its origin is at the current point. The origin of each subsequent glyph is offset from that of the previous glyph by the advance values of the previous glyph.

After this call the current point is moved to the origin of where the next glyph would be placed in this same progression. That is, the current point will be at the origin of the final glyph offset by its advance values. This allows for easy display of a single logical string with multiple calls to cairo_show_text().

NOTE: The cairo_show_text() function call is part of what the cairo designers call the "toy" text API. It is convenient for short demos and simple programs, but it is not expected to be adequate for the most serious of text-using applications. See cairo_show_glyphs() for the "real" text display API in cairo.


Method set_operator

object(Cairo.Context) Cairo.Context()->set_operator(int operator)

Description

Sets the compositing operator to be used for all drawing operations. See #cairo_operator_t for details on the semantics of each available compositing operator.

Parameter operator

A compositing operator, specified as a Cairo.OPERATOR_*


Method get_operator

int Cairo.Context()->get_operator()

Description

Gets the current compositing operator for a cairo context.

Returns

A compositing operator, specified as a Cairo.OPERATOR_*


Method set_tolerance

object(Cairo.Context) Cairo.Context()->set_tolerance(float tolerance)


Method get_miter_limit

int Cairo.Context()->get_miter_limit()

Description

Gets the miter limit for a cairo context.


Method set_miter_limit

object(Cairo.Context) Cairo.Context()->set_miter_limit(float miter_limit)


Method get_tolerance

float Cairo.Context()->get_tolerance()

Description

Gets the current tolerance for a cairo context.

Returns

The tolerance number


Method set_anti_alias

object(Cairo.Context) Cairo.Context()->set_anti_alias(int setting)


Method get_anti_alias

int Cairo.Context()->get_anti_alias()

Description

Gets the anti-alias setting of the cairo context.

Returns

The anti-alias setting


Method set_line_cap

object(Cairo.Context) Cairo.Context()->set_line_cap(int setting)


Method get_line_cap

int Cairo.Context()->get_line_cap()

Description

Gets the line-cap setting of the cairo context.

Returns

The line-cap setting


Method set_line_join

object(Cairo.Context) Cairo.Context()->set_line_join(int setting)


Method get_line_join

int Cairo.Context()->get_line_join()

Description

Gets the line-join setting of the cairo context.

Returns

The line-join setting


Method set_fill_rule

object(Cairo.Context) Cairo.Context()->set_fill_rule(int rule)


Method get_fill_rule

int Cairo.Context()->get_fill_rule()

Description

Gets the fill-rule setting of the cairo context.

Returns

The fill-rule setting


Method set_dash

object(Cairo.Context) Cairo.Context()->set_dash(array(float) dashes, float offset)


Method user_to_device

array(float) Cairo.Context()->user_to_device(float x, float y)


Method user_to_device_distance

array(float) Cairo.Context()->user_to_device_distance(float x, float y)


Method mask

object(Cairo.Context) Cairo.Context()->mask(object(Cairo.Pattern)|object(Cairo.Surface) object, float|void x, float|void y)

Description

A drawing operator that paints the current source using the alpha channel of object as a mask. (Opaque areas of object are painted with the source, transparent areas are not painted.)


Method in_stroke

int(0..1) Cairo.Context()->in_stroke(float|int x, float|int y)


Method in_fill

int(0..1) Cairo.Context()->in_fill(float|int x, float|int y)


Method stroke_extents

mapping(string : float) Cairo.Context()->stroke_extents()

Description

Return the extents of the current stroke

Returns
x1 : float
y1 : float
x2 : float
y2 : float

Method fill_extents

mapping(string : float) Cairo.Context()->fill_extents()

Description

Return the extents of the current fill

Returns
x1 : float
y1 : float
x2 : float
y2 : float

Method text_extents

mapping Cairo.Context()->text_extents(string s)

Returns
x_bearing : float
y_bearing : float
width : float
height : float
x_advance : float
y_advance : float

Method copy_page

void Cairo.Context()->copy_page()


Method show_page

void Cairo.Context()->show_page()

  CLASS Cairo.GTK2Context
Methods
create()

Method create

void Cairo.GTK2Context()->create()

  CLASS Cairo.Path
Methods
_get_iterator()

Method _get_iterator

object(PathIterator) Cairo.Path()->_get_iterator()

Description

Get an iterator for a given path. The iterator is implicitly used in the foreach(;;) statement.

Example
Cairo.Context ctx = ...;
 Cairo.Path p = ctx->copy_path();
 foreach(p; int i; Cairo.PathElement e)
   {
     ... examine e here ...
   }
  CLASS Cairo.PathIterator
Methods
`!()
`+=()
index()
value()

Method `!

int(0..1) Cairo.PathIterator()->`!()

Description

Checks if the iterator is pointing to a valid path element of the path.


Method `+=

void Cairo.PathIterator()->`+=(int step)

Description

Move step steps forward in the path.


Method index

int Cairo.PathIterator()->index()

Description

Return the current index of the path element that the iterator is pointing at.


Method value

object Cairo.PathIterator()->value()

Description

Return the current path element that the iterator is pointing at.

  CLASS Cairo.PathElement
Methods
_sprintf()
get_point()
get_type()

Method get_type

int Cairo.PathElement()->get_type()


Method get_point

mapping(string : float) Cairo.PathElement()->get_point(int point)


Method _sprintf

string Cairo.PathElement()->_sprintf()

  CLASS Cairo.Pattern
Methods
get_matrix()
set_matrix()

Method set_matrix

void Cairo.Pattern()->set_matrix(object(Cairo.Matrix) matrix)


Method get_matrix

object(Cairo.Matrix) Cairo.Pattern()->get_matrix()

  CLASS Cairo.Gradient
Methods
add_color_stop()
add_color_stop_rgb()
add_color_stop_rgba()

Method add_color_stop

object(Cairo.Pattern) Cairo.Gradient()->add_color_stop(float offset, object(Image.Color) color)
object(Cairo.Pattern) Cairo.Gradient()->add_color_stop(float offset, object(Image.Color) color, float alpha)


Method add_color_stop_rgb

object(Cairo.Pattern) Cairo.Gradient()->add_color_stop_rgb(float offset, float r, float g, float b)


Method add_color_stop_rgba

object(Cairo.Pattern) Cairo.Gradient()->add_color_stop_rgba(float offset, float r, float g, float b, float a)

  CLASS Cairo.SurfacePattern
Methods
get_extend()
set_extend()

Method set_extend

void Cairo.SurfacePattern()->set_extend(int extend)


Method get_extend

int Cairo.SurfacePattern()->get_extend()

  CLASS Cairo.Surface
Methods
finish()
flush()
write_to_png()

Method flush

void Cairo.Surface()->flush()


Method finish

void Cairo.Surface()->finish()


Method write_to_png

void Cairo.Surface()->write_to_png(string filename)

Description

Write an image surface to file in PNG format. This method is availible if Cairo has been built with PNG support.

Note

The recommended way to export to image-file is through the ImageSurface.get_image method of the ImageSurface class. That way all Pikes image encodings can be used.

  CLASS Cairo.ImageSurface
Methods
create()
get_height()
get_image()
get_type()
get_width()

Inherit Surface

  • Surface

  • Method create

    void Cairo.ImageSurface()->create(object(Image.Image) image)
    void Cairo.ImageSurface()->create(int format, int width, int height)


    Method get_width

    int Cairo.ImageSurface()->get_width()


    Method get_height

    int Cairo.ImageSurface()->get_height()


    Method get_image

    mapping Cairo.ImageSurface()->get_image()

    Note

    The surface is automatically flushed, so there are no need to call flush before calling this function.

    Returns
    "image" : object(Image.Image)

    The RGB representation of the image

    "alpha" : object(Image.Image)

    The alpha channel of the image

    Example
    mapping(string:Image.Image) image = surface->get_image();
       Image.Image im = image["image"];
       Image.Image alpha = image["alpha"];
       Stdio.write_file("output.png",
                        Image.PNG.encode(im, ([ "alpha" : alpha ])));
    

    Method get_type

    int Cairo.ImageSurface()->get_type()

    Description

    Query the surface type. Can be one of Cairo.SURFACE_TYPE_*

      CLASS Cairo.PDFSurface
    Methods
    create()
    set_dpi()

    Inherit Surface

  • Surface

  • Method create

    void Cairo.PDFSurface()->create(string filename, int|float width, int|float height)

    Parameter filename

    Filename of the pdf to create

    Parameter width

    Width in points

    Parameter height

    Height in points


    Method set_dpi

    void Cairo.PDFSurface()->set_dpi(int|float x_dpi, int|float y_dpi)

      CLASS Cairo.PSSurface
    Methods
    create()
    set_dpi()

    Inherit Surface

  • Surface

  • Method create

    void Cairo.PSSurface()->create(string filename, int|float width, int|float height)

    Parameter filename

    Filename of the ps to create

    Parameter width

    Width in points

    Parameter height

    Height in points


    Method set_dpi

    void Cairo.PSSurface()->set_dpi(int|float x_dpi, int|float y_dpi)

    gotpike.org | Copyright © 2004 - 2019 | Pike is a trademark of Department of Computer and Information Science, Linköping University