Roger Davis | 23 May 21:15

Re: cairo Digest, Vol 82, Issue 23


> I would like to copy portion of the second surface to the first surface?

The FAQ explains this pretty well:

http://www.cairographics.org/FAQ/

(See 'How do I paint from one surface to another?')
--
cairo mailing list
cairo <at> cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo

Davide Calaminici | 23 May 20:29
Picon

Create two surface and copy from one surface to another

Hello everyone,


i would like to know how to create two surfaces.

On the first surface i want to draw circle and ellipse...
On the second surdace i want to draw rectangle.

I would like to copy portion of the second surface to the first surface?

Could someone help me, please, posting a little example of this?

Thank you very much.

--
cairo mailing list
cairo <at> cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo
Carlo | 20 May 16:01
Picon

How to load a font from a *.ttf file?

Hi,
how can I load a TrueType Font in cairo? I need to render some test on a 
surface (DirectFB backend, but I think that is not relevant), using a 
monospaced font. I tried Pango libraries, but it takes the font from 
FontConfig and I can't properly configure the width an height of the 
font, I can't resize the font to fit in a precise logical extent. Cairo 
scaled font seems to be useful for my purpose, but I don't understand 
how to load a *ttf.
Thank you in advance
Carlo
--
cairo mailing list
cairo <at> cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo

Hakki Dogusan | 19 May 12:46
Favicon

Getting SIGSEGV in pixman

Hi,

(WinXP, MinGW (gcc-4.6.2), Cairo-1.12.2, Pixman-0.25.2)

My program runs successfully with Cairo-1.10.2, but getting SIGSEGV with 
1.12.2.

Back trace is as follows:

Debugger name and version: GNU gdb (GDB) 7.4
Program received signal SIGSEGV, Segmentation fault.
At .sdk\pixman\pixman\pixman-fast-path.c:619
 > bt
#0  0x6ea7f29f in fast_composite_over_8888_8888 (imp=0x21c5308, 
info=0x22d608) at .sdk\pixman\pixman\pixman-fast-path.c:619
#1  0x6e9c6ded in pixman_image_composite32 (op=PIXMAN_OP_OVER, 
src=0x21f12b8, mask=0x0, dest=0x21f0d78, src_x=0, src_y=0, mask_x=0, 
mask_y=0, dest_x=0, dest_y=0, width=919, height=10) at 
.sdk\pixman\pixman\pixman.c:712
#2  0x6e93ff68 in composite_boxes (_dst=0x21f0e40, op=CAIRO_OPERATOR_IN, 
abstract_src=0x21f0f88, abstract_mask=0x0, src_x=0, src_y=0, mask_x=0, 
mask_y=0, dst_x=0, dst_y=0, boxes=0x22df90, extents=0x22e240) at 
.sdk\cairo\src\cairo-image-compositor.c:523
#3  0x6e99e608 in composite_aligned_boxes (compositor=0x6ebde060, 
extents=0x22e208, boxes=0x22df90) at 
.sdk\cairo\src\cairo-spans-compositor.c:604
#4  0x6e99ebee in clip_and_composite_boxes (compositor=0x6ebde060, 
extents=0x22e208, boxes=0x22df90) at 
.sdk\cairo\src\cairo-spans-compositor.c:797
#5  0x6e99eeaf in _cairo_spans_compositor_paint (_compositor=0x6ebde060, 
extents=0x22e208) at .sdk\cairo\src\cairo-spans-compositor.c:896
#6  0x6e9ba70d in _cairo_compositor_paint (compositor=0x6ebde060, 
surface=0x21f0e40, op=CAIRO_OPERATOR_OVER, source=0x22e580, 
clip=0x21c2e40) at .sdk\cairo\src\cairo-compositor.c:65
#7  0x6e91f248 in _cairo_image_surface_paint 
(abstract_surface=0x21f0e40, op=CAIRO_OPERATOR_OVER, source=0x22e580, 
clip=0x21c2e40) at .sdk\cairo\src\cairo-image-surface.c:915
#8  0x6e970906 in _cairo_surface_paint (surface=0x21f0e40, 
op=CAIRO_OPERATOR_OVER, source=0x22e580, clip=0x21c2e40) at 
.sdk\cairo\src\cairo-surface.c:1876
#9  0x6e9a22d7 in _cairo_surface_offset_paint (target=0x21f0e40, x=0, 
y=663, op=CAIRO_OPERATOR_OVER, source=0x22e580, clip=0x21b7510) at 
.sdk\cairo\src\cairo-surface-offset.c:85
#10 0x6e95c671 in _cairo_fallback_compositor_paint 
(_compositor=0x6eb8ff44, extents=0x22e708) at 
.sdk\cairo\src\cairo-fallback-compositor.c:58
#11 0x6e9ba70d in _cairo_compositor_paint (compositor=0x6eb8ff44, 
surface=0x21efae0, op=CAIRO_OPERATOR_OVER, source=0x22ea68, clip=0x0) at 
.sdk\cairo\src\cairo-compositor.c:65
#12 0x6e920e82 in _cairo_win32_display_surface_paint (surface=0x21efae0, 
op=CAIRO_OPERATOR_OVER, source=0x22ea68, clip=0x0) at 
.sdk\cairo\src\win32\cairo-win32-display-surface.c:769
#13 0x6e970906 in _cairo_surface_paint (surface=0x21efae0, 
op=CAIRO_OPERATOR_OVER, source=0x22ea68, clip=0x0) at 
.sdk\cairo\src\cairo-surface.c:1876
#14 0x6e955cf4 in _cairo_gstate_fill (gstate=0x21ed208, path=0x21ed36c) 
at .sdk\cairo\src\cairo-gstate.c:1289
#15 0x6e984584 in _cairo_default_context_fill (abstract_cr=0x21ed088) at 
.sdk\cairo\src\cairo-default-context.c:1010
#16 0x6e9a7bd0 in cairo_fill (cr=0x21ed088) at .sdk\cairo\src\cairo.c:2201

Could you help me, please?

--
Regards,
Hakki Dogusan
http://www.dynaset.org/dogusanh/
--
cairo mailing list
cairo <at> cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo

Jihe Wei | 18 May 11:54
Picon

Could I use cairo with opengles in android?

Hi ,
I wonder where can find some samples show use cairo in android device.
rarely found ,so i try it myself, but seems can't render anything
details as below,
     cairo_surface_t *surface = NULL;
     const EGLint attribs[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_BLUE_SIZE,
            8, EGL_GREEN_SIZE, 8, EGL_RED_SIZE, 8, EGL_RENDERABLE_TYPE,
            EGL_OPENGL_ES2_BIT, EGL_NONE };
    const EGLint ctx_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };

    EGLint format;
    EGLint numConfigs;
    EGLConfig config;
    EGLContext context;
    EGLint err;

    EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
    err = eglGetError();
    LOGE("eglGetDisplay err:%d", err);//return 12288

    eglInitialize(display, 0, 0);
    err = eglGetError();
    LOGE("eglInitialize err:%d", err);//return 12288
  
    eglChooseConfig(display, attribs, &config, 1, &numConfigs);
    err = eglGetError();
    LOGE("eglChooseConfig err:%d", err);

    eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format);

    context = eglCreateContext(display, config, EGL_NO_CONTEXT, ctx_attribs);
    err = eglGetError();
    LOGE("eglCreateContext err:%d", err);//return 12288

    cairo_device_t * device = cairo_egl_device_create(display, context);
    cairo_status_t status = cairo_device_status(device);//return success
   
    surface = cairo_gl_surface_create(device, CAIRO_CONTENT_ALPHA, info->width,
            info->height);//return CAIRO_SURFACE_TYPE_GL type

I use another surface to display the result from surface(gl)
    cairo_set_operator(cr_display, CAIRO_OPERATOR_ADD);
    cairo_set_source_surface(cr_display, surface, 0, 0);
    cairo_paint(cr_display);

Who could help to figure out? thx

--
cairo mailing list
cairo <at> cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo
Andrea Canciani | 17 May 22:33
Picon

[PATCH 0/3] quartz: Fix breakage

Quartz is currently failing badly because of multiple issues.  This
patchset addresses two minor issues and the incorrect implementation
of map_to_image.

The main thing left to be fixed is unbound surfaces (as sources/masks).

Andrea

--
cairo mailing list
cairo <at> cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo

Andrea Canciani | 17 May 22:30
Picon

[PATCH 1/3] png: Implement conversion of CAIRO_FORMAT_RGB30 to string

Fixes

png.c:55: warning: enumeration value ‘CAIRO_FORMAT_RGB30’ not handled
in switch
---
 test/png.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/test/png.c b/test/png.c
index e90ac66..3980ddc 100644
--- a/test/png.c
+++ b/test/png.c
@@ -57,6 +57,7 @@ format_to_string (cairo_format_t format)
     case CAIRO_FORMAT_A8:     return "a8";
     case CAIRO_FORMAT_RGB16_565:  return "rgb16";
     case CAIRO_FORMAT_RGB24:  return "rgb24";
+    case CAIRO_FORMAT_RGB30:  return "rgb30";
     case CAIRO_FORMAT_ARGB32: return "argb32";
     case CAIRO_FORMAT_INVALID:
     default: return "???";
--

-- 
1.7.7.5 (Apple Git-26)

--
cairo mailing list
cairo <at> cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo
Andrea Canciani | 17 May 22:28
Picon

[PATCH 1/5] surface: Improvements to map/unmap

The map public API is more useful if it guarantees that the image it
returns has a valid format. Conversely the private API probably wants
to avoid any kind of conversion as any pixel manipulation is performed
by pixman.

In addition to this, the backend functions for map and unmap can be
improved by:

1. making map/unmap symmetric (i.e. if map counts as +1 on the
   refcount, unmap counts as -1).

2. ensuring that map returns a cairo_image_surface_t * (this is not
   the case for quartz and some other backends, but no warning is
   issued because they are returning cairo_surface_t *).

This patchset should implement these improvements. Unfortunately this
also means that it affects many files in multiple different backends.

Please review and test (and hope with me that things did not break
while rebasing).

Andrea

--
cairo mailing list
cairo <at> cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo

Chris Wilson | 17 May 21:01
Picon

Re: [cairo-commit] src/cairo-gl-composite.c src/cairo-gl-device.c src/cairo-gl-dispatch-private.h src/cairo-gl-msaa-compositor.c src/cairo-gl-operand.c src/cairo-gl-private.h src/cairo-gl-surface.c

On Thu, 17 May 2012 11:16:03 -0700 (PDT), mrobinson <at> kemper.freedesktop.org (Martin Robinson) wrote:
> +static cairo_bool_t
> +should_fall_back (cairo_gl_surface_t *surface,
> +		  cairo_antialias_t antialias)
> +{
> +    if (antialias == CAIRO_ANTIALIAS_FAST)
> +	return TRUE;
> +    if (antialias == CAIRO_ANTIALIAS_NONE)
> +	return FALSE;
> +    return ! surface->supports_msaa;
> +}

This is a little non-descriptive, and I can't quite judge if it does
what I think it should just by the name. I was expecting something along
the lines of:

  can_use_msaa(cairo_gl_surface_t *surface, cairo_antialias_t antialias)
  {
    if (antialias == CAIRO_ANTIALIAS_NONE)
      return TRUE; /* single sample "MSAA" */
    if (antialias == CAIRO_ANTIALIAS_FAST)
      return surface->supports_msaa;
    if (antialias == CAIRO_ANTIALIAS_DEFAULT)
      return surface->supports_msaa && 
             to_gl_device(surface->base.device)->use_msaa_by_default;
    return FALSE;
  }

> +
>  static cairo_int_status_t
>  _cairo_gl_msaa_compositor_paint (const cairo_compositor_t	*compositor,
>  				 cairo_composite_rectangles_t	*composite)
> @@ -337,6 +348,9 @@ _cairo_gl_msaa_compositor_mask (const cairo_compositor_t	*compositor,
>      cairo_int_status_t status;
>      cairo_operator_t op = composite->op;
>  
> +    if (should_fall_back (dst, CAIRO_ANTIALIAS_GOOD))
s/GOOD/CAIRO_ANTLIAS_DEAFULT/;

Then this reads as
  if (! can_use_msaa (dst, CAIRO_ANTIALIAS_DEFAULT))
    return CAIRO_INT_STATUS_UNUSPPORTED;
for which I hope we both agree it is much easier to understand the intent.
-Chris

--

-- 
Chris Wilson, Intel Open Source Technology Centre
--
cairo mailing list
cairo <at> cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo

cu | 17 May 04:31
Picon
Favicon

cairo 1.12 crashes X server

Another one of "those" issues. I tried to switch Linux version of my
program from cairo 1.10 to cairo 1.12.
The program is built as a dynamic executable, using shared libcairo. It
is also using libgtk (which in turn also needs cairo, hence the shared
version).
When using cairo 1.10 - program works, no issuse. With cairo 1.12 -
attempting to launch the program crashes X server, of all things.

Any ideas as to why this may be happening or even how to track this
issue down would be greatly appreciated!
--
cairo mailing list
cairo <at> cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo

Dave Coventry | 16 May 23:07
Picon
Gravatar

Compiling Cairo for unicode ucs2

Hi,

I've been using a Hidden line removal python script which uses cairo,
but I'm getting the following error:

/usr/lib/python2.6/dist-packages/cairo/_cairo.so: undefined symbol:
PyUnicodeUCS4_AsUTF8String

Apparently I need to compile cairo with Python compiled to ucs2.

I've downloaded pycairo-1.10.0.tar.bz2, extracted to
/opt/pycairo-1.10.0 and then run ./waf configure which gives the
following results:

Murray py2cairo-1.10.0 # ./waf configure
  ./options()
Setting top to                           : /opt/py2cairo-1.10.0
Setting out to                           : /opt/py2cairo-1.10.0/build_directory
  ./configure()
Checking for 'gcc' (c compiler)          : ok
Checking for program python              : /usr/bin/python
Checking for python version              : (2, 7, 2, 'final', 0)
Checking for library python2.7           : yes
Checking for program python2.7-config    : /usr/bin/python2.7-config
Checking for header Python.h             : yes
Checking for program pkg-config          : /usr/bin/pkg-config
Checking for 'cairo' >= 1.10.0           : yes
Configuration:
PREFIX                                   : /usr/local
LIBDIR                                   : /usr/local/lib
'configure' finished successfully (0.984s)

Clearly the version that cairo is compiling against is python2.7 and
my PyUnicodeUCS4_AsUTF8String error is against Python2.6.

But when I run waf with python2.6 it appears to compile against python2.7:

Murray py2cairo-1.10.0 # python2.6 waf install
  ./options()
Waf: Entering directory `/opt/py2cairo-1.10.0/build_directory'
  ./build()
  src/build()
- install /usr/local/include/pycairo/pycairo.h (from src/pycairo.h)
[ 2/12] subst: pycairo.pc.in -> pycairo.pc
+ install /usr/local/lib/python2.7/site-packages/cairo/_cairo.so (from
build_directory/src/_cairo.so)
+ install /usr/local/lib/pkgconfig/pycairo.pc (from pycairo.pc)
Waf: Leaving directory `/opt/py2cairo-1.10.0/build_directory'
- install /usr/local/lib/python2.7/site-packages/cairo/__init__.py
(from src/__init__.py)
+ byte compiling '/usr/local/lib/python2.7/site-packages/cairo/__init__.py'
'install' finished successfully (0.318s)

How do I compile Cairo against the correct Unicode version?

Kind Regards,

Dave Coventry
--
cairo mailing list
cairo <at> cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo


Gmane