Example #1
0
        public static Matrix Multiply(Matrix a, Matrix b)
        {
            Matrix result = new Matrix();

            CairoAPI.cairo_matrix_multiply(result, a, b);
            return(result);
        }
 public PSSurface(string filename, double width, double height)
 {
     surface = CairoAPI.cairo_ps_surface_create(filename, width, height);
     lock (surfaces.SyncRoot){
         surfaces [surface] = this;
     }
 }
 public Win32Surface(IntPtr hdc)
 {
     surface = CairoAPI.cairo_win32_surface_create(hdc);
     lock (surfaces.SyncRoot) {
         surfaces [surface] = this;
     }
 }
 public XlibSurface(IntPtr display, IntPtr drawable, IntPtr visual, int width, int height)
 {
     surface = CairoAPI.cairo_xlib_surface_create(display, drawable, visual, width, height);
     lock (surfaces.SyncRoot){
         surfaces [surface] = this;
     }
 }
Example #5
0
 public XcbSurface(IntPtr connection, uint drawable, IntPtr visual, int width, int height)
 {
     surface = CairoAPI.cairo_xcb_surface_create(connection, drawable, visual, width, height);
     lock (surfaces.SyncRoot) {
         surfaces [surface] = this;
     }
 }
Example #6
0
 public ImageSurface(string filename)
 {
     surface = CairoAPI.cairo_image_surface_create_from_png(filename);
     lock (surfaces.SyncRoot){
         surfaces [surface] = this;
     }
 }
Example #7
0
        public Rectangle FillExtents()
        {
            double x1, y1, x2, y2;

            CairoAPI.cairo_fill_extents(state, out x1, out y1, out x2, out y2);
            return(new Rectangle(x1, y1, x2, y2));
        }
Example #8
0
        public static XcbSurface FromBitmap(IntPtr connection, uint bitmap, IntPtr screen, int width, int height)
        {
            IntPtr ptr;

            ptr = CairoAPI.cairo_xcb_surface_create_for_bitmap(connection, bitmap, screen, width, height);
            return(new XcbSurface(ptr, true));
        }
Example #9
0
 public ImageSurface(Format format, int width, int height)
 {
     surface = CairoAPI.cairo_image_surface_create(format, width, height);
     lock (surfaces.SyncRoot){
         surfaces [surface] = this;
     }
 }
Example #10
0
 public ImageSurface(ref byte[] data, Cairo.Format format, int width, int height, int stride)
 {
     surface = CairoAPI.cairo_image_surface_create_for_data(data, format, width, height, stride);
     lock (surfaces.SyncRoot){
         surfaces [surface] = this;
     }
 }
Example #11
0
        public TextExtents TextExtents(string utf8)
        {
            TextExtents extents = new TextExtents();

            CairoAPI.cairo_text_extents(state, utf8, ref extents);
            return(extents);
        }
Example #12
0
 public GlitzSurface(IntPtr glitz_surface)
 {
     surface = CairoAPI.cairo_glitz_surface_create(glitz_surface);
     lock (surfaces.SyncRoot) {
         surfaces [surface] = this;
     }
 }
        static internal Surface LookupExternalSurface(IntPtr p)
        {
            lock (surfaces.SyncRoot){
                object o = surfaces [p];
                if (o == null)
                {
#if CAIRO_1_2
                    SurfaceType st = CairoAPI.cairo_surface_get_type(p);

                    switch (st)
                    {
                    case SurfaceType.Image:
                        return(new ImageSurface(p, false));

                    case SurfaceType.Pdf:
                        return(new PdfSurface(p, false));

                    case SurfaceType.XLib:
                        return(new XlibSurface(p, false));

                    case SurfaceType.Xcb:
                        return(new XcbSurface(p, false));
                    }
#else
                    return(new Surface(p, false));
#endif
                }
                return((Surface)o);
            }
        }
Example #14
0
 public DirectFBSurface(IntPtr dfb, IntPtr surface)
 {
     surface = CairoAPI.cairo_directfb_surface_create(dfb, surface);
     lock (surfaces.SyncRoot) {
         surfaces [surface] = this;
     }
 }
Example #15
0
        public Rectangle StrokeExtents()
        {
            double x1, y1, x2, y2;

            CairoAPI.cairo_stroke_extents(state, out x1, out y1, out x2, out y2);
            return(new Rectangle(x1, y1, x2, y2));
        }
        public static XlibSurface FromBitmap(IntPtr display, IntPtr bitmap, IntPtr screen, int width, int height)
        {
            IntPtr ptr;

            ptr = CairoAPI.cairo_xlib_surface_create_for_bitmap(display, bitmap, screen, width, height);
            return(new XlibSurface(ptr, true));
        }
        public static Cairo.Surface CreateForImage(
            Cairo.Format format, int width, int height)
        {
            IntPtr p = CairoAPI.cairo_image_surface_create(
                format, width, height);

            return(new Cairo.Surface(p, true));
        }
        public static Cairo.Surface CreateForImage(
            ref byte[] data, Cairo.Format format, int width, int height, int stride)
        {
            IntPtr p = CairoAPI.cairo_image_surface_create_for_data(
                data, format, width, height, stride);

            return(new Cairo.Surface(p, true));
        }
        public Cairo.Surface CreateSimilar(
            Cairo.Content content, int width, int height)
        {
            IntPtr p = CairoAPI.cairo_surface_create_similar(
                this.Handle, content, width, height);

            return(new Cairo.Surface(p, true));
        }
Example #20
0
 public void Merge(FontOptions other)
 {
     if (other == null)
     {
         throw new ArgumentNullException("other");
     }
     CairoAPI.cairo_font_options_merge(handle, other.Handle);
 }
Example #21
0
 public void InitRotate(double radians)
 {
     /*
      * double s, c;
      * s = Math.Sin (radians);
      * c = Math.Cos (radians);
      * this.Init (c, s, -s, c, 0, 0);
      */
     CairoAPI.cairo_matrix_init_rotate(this, radians);
 }
Example #22
0
        public void GlyphPath(Matrix matrix, Glyph[] glyphs)
        {
            IntPtr ptr;

            ptr = FromGlyphToUnManagedMemory(glyphs);

            CairoAPI.cairo_glyph_path(state, ptr, glyphs.Length);

            Marshal.FreeHGlobal(ptr);
        }
 protected Surface(IntPtr ptr, bool owns)
 {
     surface = ptr;
     lock (surfaces.SyncRoot){
         surfaces [ptr] = this;
     }
     if (!owns)
     {
         CairoAPI.cairo_surface_reference(ptr);
     }
 }
Example #24
0
 public SolidPattern(Color color, bool solid)
 {
     if (solid)
     {
         pattern = CairoAPI.cairo_pattern_create_rgb(color.R, color.G, color.B);
     }
     else
     {
         pattern = CairoAPI.cairo_pattern_create_rgba(color.R, color.G, color.B, color.A);
     }
 }
        protected virtual void Dispose(bool disposing)
        {
            if (surface == (IntPtr)0)
            {
                return;
            }

            lock (surfaces.SyncRoot)
                surfaces.Remove(surface);

            CairoAPI.cairo_surface_destroy(surface);
            surface = (IntPtr)0;
        }
Example #26
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
            {
                //Console.WriteLine ("Cairo.Context: called from thread");
                return;
            }

            if (state == IntPtr.Zero)
            {
                return;
            }

            //Console.WriteLine ("Destroying");
            CairoAPI.cairo_destroy(state);
            state = IntPtr.Zero;
        }
Example #27
0
        public Pattern PopGroup()
        {
            IntPtr      pattern = CairoAPI.cairo_pop_group(state);
            PatternType pt      = CairoAPI.cairo_pattern_get_type(pattern);

            switch (pt)
            {
            case PatternType.Solid:
                return(new SolidPattern(pattern));

            case PatternType.Surface:
                return(new SurfacePattern(pattern));

            case PatternType.Linear:
                return(new LinearGradient(pattern));

            case PatternType.Radial:
                return(new RadialGradient(pattern));

            default:
                return(new Pattern(pattern));
            }
        }
Example #28
0
 bool Equals(FontOptions options)
 {
     return(options != null && CairoAPI.cairo_font_options_equal(Handle, options.Handle));
 }
Example #29
0
 public void Destroy()
 {
     CairoAPI.cairo_font_options_destroy(handle);
 }
Example #30
0
 public FontOptions Copy()
 {
     return(new FontOptions(CairoAPI.cairo_font_options_copy(handle)));
 }