Пример #1
0
        public static Matrix Multiply(Matrix a, Matrix b)
        {
            Matrix result = new Matrix();

            CairoAPI.cairo_matrix_multiply(result, a, b);
            return(result);
        }
Пример #2
0
 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;
     }
 }
Пример #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;
     }
 }
Пример #6
0
 public ImageSurface(string filename)
 {
     surface = CairoAPI.cairo_image_surface_create_from_png(filename);
     lock (surfaces.SyncRoot){
         surfaces [surface] = this;
     }
 }
Пример #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));
        }
Пример #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));
        }
Пример #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;
     }
 }
Пример #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;
     }
 }
Пример #11
0
        public TextExtents TextExtents(string utf8)
        {
            TextExtents extents = new TextExtents();

            CairoAPI.cairo_text_extents(state, utf8, ref extents);
            return(extents);
        }
Пример #12
0
 public GlitzSurface(IntPtr glitz_surface)
 {
     surface = CairoAPI.cairo_glitz_surface_create(glitz_surface);
     lock (surfaces.SyncRoot) {
         surfaces [surface] = this;
     }
 }
Пример #13
0
        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);
            }
        }
Пример #14
0
 public DirectFBSurface(IntPtr dfb, IntPtr surface)
 {
     surface = CairoAPI.cairo_directfb_surface_create(dfb, surface);
     lock (surfaces.SyncRoot) {
         surfaces [surface] = this;
     }
 }
Пример #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));
        }
Пример #17
0
        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));
        }
Пример #18
0
        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));
        }
Пример #19
0
        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));
        }
Пример #20
0
 public void Merge(FontOptions other)
 {
     if (other == null)
     {
         throw new ArgumentNullException("other");
     }
     CairoAPI.cairo_font_options_merge(handle, other.Handle);
 }
Пример #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);
 }
Пример #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);
        }
Пример #23
0
 protected Surface(IntPtr ptr, bool owns)
 {
     surface = ptr;
     lock (surfaces.SyncRoot){
         surfaces [ptr] = this;
     }
     if (!owns)
     {
         CairoAPI.cairo_surface_reference(ptr);
     }
 }
Пример #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);
     }
 }
Пример #25
0
        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;
        }
Пример #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;
        }
Пример #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));
            }
        }
Пример #28
0
 bool Equals(FontOptions options)
 {
     return(options != null && CairoAPI.cairo_font_options_equal(Handle, options.Handle));
 }
Пример #29
0
 public void Destroy()
 {
     CairoAPI.cairo_font_options_destroy(handle);
 }
Пример #30
0
 public FontOptions Copy()
 {
     return(new FontOptions(CairoAPI.cairo_font_options_copy(handle)));
 }