Beispiel #1
0
        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));
        }
Beispiel #2
0
 public PdfSurface(string filename, double width, double height)
 {
     surface = CairoAPI.cairo_pdf_surface_create(filename, width, height);
     lock (surfaces.SyncRoot){
         surfaces [surface] = this;
     }
 }
Beispiel #3
0
        public TextExtents TextExtents(string utf8)
        {
            TextExtents extents = new TextExtents();

            CairoAPI.cairo_text_extents(state, utf8, ref extents);
            return(extents);
        }
Beispiel #4
0
 public RadialGradient(double cx0, double cy0, double radius0,
                       double cx1, double cy1, double radius1)
     : base()
 {
     pattern = CairoAPI.cairo_pattern_create_radial(cx0, cy0, radius0,
                                                    cx1, cy1, radius1);
 }
Beispiel #5
0
        public static Matrix Multiply(Matrix a, Matrix b)
        {
            Matrix result = new Matrix();

            CairoAPI.cairo_matrix_multiply(result, a, b);
            return(result);
        }
Beispiel #6
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));
        }
Beispiel #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));
        }
Beispiel #8
0
 public ImageSurface(string filename)
 {
     surface = CairoAPI.cairo_image_surface_create_from_png(filename);
     lock (surfaces.SyncRoot)
     {
         surfaces[surface] = this;
     }
 }
Beispiel #9
0
 public ImageSurface(byte *data, Cairo.Format format, int width, int height, int stride)
 {
     surface = CairoAPI.cairo_image_surface_create_for_data(data, (int)format, width, height, stride);
     lock (surfaces.SyncRoot)
     {
         surfaces[surface] = this;
     }
 }
Beispiel #10
0
 public ImageSurface(Format format, int width, int height)
 {
     surface = CairoAPI.cairo_image_surface_create(format, width, height);
     lock (surfaces.SyncRoot)
     {
         surfaces[surface] = this;
     }
 }
Beispiel #11
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));
        }
Beispiel #12
0
 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;
     }
 }
Beispiel #13
0
 public Win32Surface(IntPtr hdc)
 {
     surface = CairoAPI.cairo_win32_surface_create(hdc);
     lock (surfaces.SyncRoot)
     {
         surfaces[surface] = this;
     }
 }
Beispiel #14
0
 public void Merge(FontOptions other)
 {
     if (other == null)
     {
         throw new ArgumentNullException("other");
     }
     CairoAPI.cairo_font_options_merge(handle, other.Handle);
 }
Beispiel #15
0
        public void GlyphPath(Matrix matrix, Glyph[] glyphs)
        {
            IntPtr ptr;

            ptr = FromGlyphToUnManagedMemory(glyphs);

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

            Marshal.FreeHGlobal(ptr);
        }
Beispiel #16
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);
 }
Beispiel #17
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);
     }
 }
Beispiel #18
0
 protected Surface(IntPtr ptr, bool owns)
 {
     surface = ptr;
     lock (surfaces.SyncRoot)
     {
         surfaces[ptr] = this;
     }
     if (!owns)
     {
         CairoAPI.cairo_surface_reference(ptr);
     }
 }
Beispiel #19
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;
        }
Beispiel #20
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;
        }
Beispiel #21
0
 public SurfacePattern(Surface surface)
 {
     pattern = CairoAPI.cairo_pattern_create_for_surface(surface.Handle);
 }
Beispiel #22
0
 public Status AddColorStopRgb(double offset, Cairo.Color c)
 {
     CairoAPI.cairo_pattern_add_color_stop_rgb(pattern, offset,
                                               c.R, c.G, c.B);
     return(Status);
 }
Beispiel #23
0
 public LinearGradient(double x0, double y0, double x1, double y1)
     : base()
 {
     pattern = CairoAPI.cairo_pattern_create_linear(x0, y0, x1, y1);
 }
Beispiel #24
0
 public void Destroy()
 {
     CairoAPI.cairo_pattern_destroy(pattern);
 }
Beispiel #25
0
 protected void Reference()
 {
     CairoAPI.cairo_pattern_reference(pattern);
 }
Beispiel #26
0
 public void TextPath(string str)
 {
     CairoAPI.cairo_text_path(state, str);
 }
Beispiel #27
0
 public void ShowText(string str)
 {
     CairoAPI.cairo_show_text(state, str);
 }
Beispiel #28
0
 public void ShowPage()
 {
     CairoAPI.cairo_show_page(state);
 }
Beispiel #29
0
 public void SelectFontFace(string family, FontSlant slant, FontWeight weight)
 {
     CairoAPI.cairo_select_font_face(state, family, slant, weight);
 }
Beispiel #30
0
 public void CopyPage()
 {
     CairoAPI.cairo_copy_page(state);
 }