summaryrefslogtreecommitdiff
path: root/src/cairo-image-surface.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix bogus cairo_rectangle_fixed_t to be cairo_rectangle_int16_t.Carl Worth2006-06-061-6/+6
| | | | | | This rectangle has regular integer values, not fixed-point values. So the old name was horribly wrong and misleading, (and yes I think it was even I that had suggested it).
* Remove trailing whitespace from lines with a single brace.Carl Worth2006-06-061-1/+1
| | | | | | | | This patch was produced with the following (GNU) sed script: sed -i -r -e '/^[ \t]*[{}][ \t]*/ s/[ \t]+$//' run on all *.[ch] files within cairo.
* Remove trailing whitespace from lines that look like comments.Carl Worth2006-06-061-15/+15
| | | | | | | | | | This patch was produced with the following (GNU) sed script: sed -i -r -e '/^[ \t]*\/?\*/ s/[ \t]+$//' run on all *.[ch] files within cairo, (though I manually excluded src/cairo-atsui-font.c which has a code line that appears as a comment to this script).
* Remove extraneous whitespace from "blank" lines.Carl Worth2006-06-061-14/+14
| | | | | | | | This patch was produced with the following (GNU) sed script: sed -i -r -e 's/^[ \t]+$//' run on all *.[ch] files within cairo.
* New API: Add cairo_image_surface_get_{data,format,stride}Carl Worth2006-06-051-0/+69
|
* New API: Add new function cairo_surface_get_contentCarl Worth2006-05-241-1/+2
| | | | | | This assumes that the directfb, glitz, and quartz backends always create surfaces with content of COLOR_ALPHA which might be totally wrong.
* Rename cairo_rectangle_t to cairo_rectangle_fixed_t.Robert O'Callahan2006-05-041-14/+14
| | | | | | This is in preparation for a later function addition for extracting clip rectangles from a cairo_t, (which will add a public cairo_rectangle_t).
* Add reference to cairo_surface_set_user_data in docs. for ↵Carl Worth2006-04-271-0/+3
| | | | cairo_image_surface_create_for_data
* Change cairo_image_surface_create to zero out surface contents.Dom Lachowicz2006-04-141-3/+4
| | | | | | | | | | | This closes bug #5816: Image surfaces do not start out blank by default https://bugs.freedesktop.org/show_bug.cgi?id=5816 This also fixes all of the test suite failures introduced by moving the CLEAR on blank page optimization up to the paginated surface from the PS surface.
* Flesh test-paginated-surface out into a complete surface.Carl Worth2006-04-141-1/+1
| | | | | | | | This adds an aactual test_paginated_surface_backend rather than just having this test surface create a paginated surface around an image surface. This is a more realistic test of what a paginated surface is and should be more useful as an example of how to use the paginated surface, (and in particular the analysis portions).
* Implement cairo_surface_get_typeCarl Worth2006-02-271-0/+1
|
* Change documentation to recommend cairo_paint rather than ↵Carl Worth2006-01-181-2/+2
| | | | | | | | cairo_rectangle;cairo_fill for clearing a surface. Add documentation. Add a cairo_content_t argument to PDF surface constructors. Add documentation. Add a cairo_content_t argument to PS surface constructors. Track changes in PS/PDF surface constructor API.
* Big change to the test infrastructure and supporting internals. The goal now ↵Carl Worth2006-01-171-2/+29
| | | | | | | | | | | | | | | | | | | | is to test both a COLOR_ALPHA and a COLOR content for each surface backend, (since the semantics are different and we probably need to support both in each backend. The PS/PDF backends don't allow a content to be passed in right now, so they fail against the rgb24 tests, but the trivial addition to the constructors will allow them to pass all tests with both content values. And new constructors (currently internal only) to create an image surface with a cairo_content_t rather than a cairo_format_t. Add a cairo_content_t argument to the constructor. Add a cairo_content_t to the constructor and use this content value when constructing intermediate image surfaces in acquire_source, show_page, copy_page, and snapshot. Add image flattening by compositing over white, as is done in cairo-ps-surface.c. Track changes to cairo-paginates-surface which now requires a cairo_content_t value (no change to public PS/PDF constructors yet). Track change in meta-surface and paginated-surface interfaces by now accepting a cairo_content_t rather than a cairo_format_t. Ignore new output files (argb32 from pdf and ps as well as rgb24 from test-fallback, test-meta, and test-paginated). Add new utility for flattening PNG images in order to generate the -argbf-ref.png images. Add image_diff_flattened for comparing flattened output from PS and PDF backend with ARGB reference images by first blending the reference images over white. Get rid of conditional, format-specific background-color initialization before running tests. Now uses ARGB(0,0,0,0) in all cases. Switch from specifying tests with a format value to specifying tests with a content value. Add support for a 'fake' COLOR_ALPHA_FLATTENED content for testing the PS and PDF output against a flattened version of the argb32 reference images (first blended over white). Track change in cairo_ps_surface_create (now requires cairo_content_t value). Adjust tests that draw in default (black) to first paint white so that the results are visible. Adjust ARGB32 reference images for new white background for changed tests. Adjust RGB24 reference images for new black background due to changed initialization (and the tests themselves being unchanged).
* 2005-10-10 David Reveman <davidr@novell.com>Carl Worth2006-01-041-12/+2
| | | | | Throw away old gradient code from within cairo-pattern.c in favor of using new support in pixman for gradients. Update reference images for all tests involving gradients since the gradient output has changed slightly.
* Clamp surface dimensions to a minimum of 1. ↵Vladimir Vukicevic2006-01-031-1/+44
| | | | | | | (_cairo_glitz_surface_get_image): Set the glitz clip to NULL before calling glitz_get_pixels, to return the full surface contents. Restore clip afterwards. (_cairo_glitz_surface_composite_trapezoid): Return UNSUPPORTED if the antialias is anything other than DEFAULT/GRAY. Try to recover a standard cairo_format_t from given pixman format masks, so that various things that only work with a standard format work correctly. Remove cairo_glitz_surface_write_to_png, replace with generic cairo_surface_write_to_png (since it works with image-surface create_with_masks fix)
* Don't export cairo_image_surface_set_clip_region.Carl Worth2005-12-161-23/+9
| | | | | Eliminate some unnecessary _cairo_image_abstract_surface variations of backend function. Remove errant include of cairo-pdf.h.
* Globally rename "operator" to "op", to allow writing backends in C++Christian Biesinger2005-12-161-12/+12
| | | | reviewed by: cworth
* Rename surface->backend->show_glyphs to surface->backend->old_show_glyphs.Carl Worth2005-11-011-1/+1
| | | | | Move show_glyphs fallback from gstate to surface where it belongs. Reviewed by: keithp
* Split _cairo_operator_bounded into two separate functions ↵Keith Packard2005-10-281-4/+2
| | | | _cairo_operator_bounded_by_mask and _cairo_operator_bound_by_source to distinguish between how operators use source and mask operands.
* Call it CAIRO_EXTEND_PAD instead of CAIRO_EXTEND_NEAREST.Billy Biggs2005-10-101-1/+1
| | | | Update everybody to use _PAD instead of _NEAREST.
* Add const to _cairo_surface_is_image parameterKeith Packard2005-10-091-1/+1
|
* Add a "nearest" extend mode, where the closest pixel is repeated for pixels ↵Billy Biggs2005-10-091-12/+6
| | | | | | | | | | | | | outside of the source area. Note that for gradients, applications which had explicitly set a repeat mode of NONE will now need to change to use NEAREST to get the same behaviour. Split CARIO_EXTEND_DEFAULT to indicate defaults for surfaces and gradients. The default for gradients is still the NEAREST beaviour. Support the NEAREST mode, change NONE to be TRANSPARENT. Update the extend mode code to use the pixman support. Handle NEAREST, note that support for NONE is not yet handled for gradients. Add a check for NEAREST but don't do anything useful. Add a check for NEAREST but don't do anything useful. Update a comment about the extend support in the image backend. reviewed by: davidr, cworth, otaylor
* Fix docs not to talk about %NULL returns. #4271, Duncan Coutts.Owen Taylor2005-08-271-4/+14
|
* Implement new equations for CLEAR and SOURCE CLEAR: (mask IN clip) ? 0 : ↵Owen Taylor2005-08-181-1/+3
| | | | | | | | | | | | | dest SOURCE: (mask IN clip) ? src : dest That behave more like what people expect. CLEAR and SOURCE are now bounded. Assert that SOURCE and CLEAR aren't passed to these functions. Assert that SOURCE and CLEAR aren't passed to these functions when there is a mask. Do fixups for SOURCE and CLEAR as well as unbounded operators, since in the absence of a mask, we need SOURCE to work correctly (don't care about CLEAR) _cairo_ft_font_show_glyphs) Consistently use CLEAR/TRANSPARENT (source doesn't matter) rather than SOURCE/TRANSPARENT when clearing rectangles. src/cairo-xlib-surface.c src/cairo-surface.c: Use IN rather than SOURCE as an example of an unbounded operator in docs. Remove CLEAR/SOURCE columns since they are no longer unbounded. test/operator-clear.c test/operator-source Makefile.am: Add targetted tests of CLEAR/SOURCE.
* src/cairoint.h: Split out a couple of useful utility functions.Owen Taylor2005-08-161-40/+50
| | | | | | | | | | | | | | src/cairo-clip.c src/cairo-gstate.c: Use them. Move code to fill a pixman_region16_t to here. Document. Use _cairo_surface_fill_region(). Add a return status, use regions to simplify. src/cairoint.h Handle the return value from _cairo_surface_composite_fixup_unbounded(). src/cairo-surface.c src/cairoint.h (_cairo_surface_composite_shape_fixup_unbounded): Add a variant of _cairo_surface_composite_fixup_unbounded() to avoid creating a dummy cairo_surface_attributes_t. Use _cairo_surface_composite_shape_fixup_unbounded(). Call _cairo_surface_composite_shape_fixup_unbounded(), since the source might still be restricted, even though the mask is unbounded. Restore the rectangle optizations when drawing with unbounded operators by adding a clear for the extra area after drawing the rectangles.
* Add a new API for disabling antialiasing of shapes drawn by cairo. This is a ↵Billy Biggs2005-08-081-32/+39
| | | | | | | | | | | | | | | | | hint and is not supported by all backends. Store the antialiasing mode in the gstate and pass it to the backend for trapezoid rendering and for clipping. Pass the antialiasing parameter down to the backend where appropriate. Pass the antialiasing parameter down to the backend where appropriate. Add support for A1 format trapezoid rendering, and remove the _create_mask_image function, creating a temporary image from memory we allocate and clear. Support A1 masks to disable antialiasing using the RENDER extension when requested. Support A1 masks to disable antialiasing using the RENDER extension when requested. Blindly pass through the antialising parameter. Add the antialiasing parameter but don't support it. Add a test case and a reference image from the latest libpixman. Add the new antialiasing disabling API to the docs. Update progress on a parameter to disable antialiasing. reviewed by: cworth, otaylor
* Add a function to test whether a cairo_operator_t is bounded (does nothing ↵Owen Taylor2005-08-081-21/+105
| | | | | | | | | | | | | | | | | | | | for 0 src/mask) cairoint.h: Add a helper function to take clearing areas that are outside the source/mask but are cleared by unbounded operations. src/cairo-xlib-surface.c (_cairo_xlib_surface_composite): Use _cairo_surface_composite_fixup_unbounded() as needed. src/cairo-image-surface.c src/cairint.h: Keep track of whether the surface has a clip or not ... we need this for determining when we can bypass an intermediate mask for composite_trapezoids(). Create an intermediate mask of the right size with pixman_add_trapezoids() and composite that. When rendering with an unbounded operator, create the intermediate mask ourselves and render with ADD to that, then composite the result. Create an intermediate surface the size of the extents, render the glyphs to that then composite the results. Add the size of the glyph Compute the size of the glyph mask, then use _cairo_surface_composite_fixup_unbounded(). Use the right mask format. (Unrelated bugfix) New function taking a drawing function as a parameter to encapsulate shared logic between compositing trapezoid, glyphs, and masks. Use _cairo_gstate_clip_and_composite(). Also fix extents computations for unbounded operators. src/cairo-clip.c src/cairo-clip-private.h (_cairo_clip_combine_to_surface): Add the destination as an extra parameter to allow combining to an intermediate surface. tests/unbounded-operator.c tests/Makefile.am: Add a test for the operation of the 6 unbounded operators against different shapes. tests/clip-operator.c tests/Makefile.am: Add a test that tests surface clipping with different shapes against all the operators. Make use OVER like the name and description. With fixed semantics, SOURCE does something different.
* Change *_reference() functions to return the object being referenced.Kristian Høgsberg2005-08-041-2/+1
|
* Fix to call _cairo_error and return 0 on surface-type mismatch.Carl Worth2005-07-281-0/+10
|
* dest_image) src/cairo-quartz-surface.c ↵Owen Taylor2005-07-281-1/+3
| | | | (_cairo_quartz_surface_acquire_dest_image) src/cairo-xcb-surface.c (_cairo_xcb_surface_acquire_source,dest_image): src/cairo-xlib-surface.c (_cairo_xlib_surface_acquire_source,dest_image): Set image_extra to NULL to avoid purify warnings. (#3777, Stuart Parmenter)
* Remove all create_in_error functions as they were just muddling up the ↵Carl Worth2005-07-281-2/+2
| | | | | | | | | | | | | memory management semantics: _cairo_path_data_create_in_error _cairo_pattern_create_in_error _cairo_surface_create_in_error Don't bother with extra check of other->status to anticipate and try to prevent cairo_surface_create_similar from returning through cairo_surface_create_in_error. Just return &_cairo_surface|pattern|path_nil rather than _cairo_surface|pattern|path_create_in_error. After checking surface->status from a cairo_<foo>_surface_create function, just return CAIRO_STATUS_NO_MEMORY since that's the only error we'll get from one of these create functions. Remove unnecessary check for gstate == NULL; Fix old check for image == NULL instead of image->base.status. Add missing check of surface->image_base.status after creating surface->image. Add missing check of surface->base.status after creating surface.
* Add CAIRO_STATUS_INVALID_CONTENT, CAIRO_STATUS_INVALID_FORMAT, and ↵Carl Worth2005-07-271-34/+42
| | | | | | | | | | | CAIRO_STATUS_INVALID_VISUAL. Change functions to return type of void: cairo_scaled_font_extents cairo_surface_finish Add new functions to query object status: cairo_scaled_font_status cairo_surface_status Implementation of new error handling scheme for cairo_surface_t and cairo_scaled_font_t. Track change in return value of cairo_surface_finish.
* Fix to accept a cairo_pattern_t rather than a cairo_surface_t as the primary ↵Carl Worth2005-07-141-3/+3
| | | | | | | | argument. Track change in _cairo_pattern_release_surface and also pass the appropriate pattern for each acquired surface. The previous backend mismatch was causing memory leaks. Remove stale comment. Add missing fclose to keep valgrind happy about memory leaks.
* Remove the copying of the region. This was a workaround for a missing copy ↵Carl Worth2005-07-141-14/+1
| | | | bug in libpixman that has since been fixed. So now it was just a memory leak.
* Give enum tags an underscore prefix to match the style of the struct tags. ↵Carl Worth2005-07-081-3/+49
| | | | | | | Add new cairo_content_t and change cairo_surface_create_similar to accept a cairo_content_t rather than a cairo_format_t. Change surface backend create_similar call to accept a cairo_content_t rather than a cairo_format_t. Fix all calls into create_similar to pass a cairo_content_t rather than a cairo_format_t.
* Remove matrix, filter and repeat from the cairo_surface_t struct.Kristian Høgsberg2005-06-171-3/+3
|
* Implement path clipping and refactor _cairo_gstate_clip() out in three ↵Kristian Høgsberg2005-06-141-0/+1
| | | | | | | different functions corresponding to the three different clipping modes. Add NULL pointers for intersect_clip_path. New test case to exercise PDF clipping code.
* Remove Boolean 'drawable' parameter from the create_similar surface backend ↵Carl Worth2005-06-141-1/+0
| | | | function since nothing anywhere is actually using this parameter.
* Remove STATUS_OK macro which was not being used universally.Carl Worth2005-06-101-3/+3
|
* Rename CAIRO_OK to STATUS_OK. No intended changes in functionality.Carl Worth2005-06-011-3/+3
|
* Fix image->data to be unsignedCarl Worth2005-05-121-3/+3
| | | | Track change in signedness of data member/parameter.
* Push cairo_matrix_t const-correctness down through the entire implmentation, ↵Carl Worth2005-05-091-1/+1
| | | | (expanding on preliminary work by Robert O'Callahan <rocallahan@novell.com>)
* Eliminate the following deprecated functions from cairo's interface:Carl Worth2005-05-061-1/+0
| | | | | | cairo_copy cairo_get_path cairo_get_path_flat cairo_matrix_create cairo_matrix_destroy cairo_matrix_copy cairo_matrix_get_affine cairo_surface_set_repeat cairo_surface_set_matrix cairo_surface_get_matrix cairo_surface_set_filter cairo_surface_get_filter Also, eliminate all support for compiling against, or running with old, deprecated names for functions. Deal with all of the removals.
* Rename and re-order the cairo_operator_t enum to names that abbreviate less ↵Carl Worth2005-05-061-11/+19
| | | | and are easier to understand, (eg. CAIRO_OPERATOR_DEST_OVER instead of CAIRO_OPEERATOR_OVER_REVERSE).
* Factor out bulk of the code into a new callback based function, write_png(). ↵Kristian Høgsberg2005-04-251-0/+32
| | | | | | | | Call it with a stdio write callback. (cairo_surface_write_png_to_stream): New function to write a surface to a PNG stream. (cairo_image_surface_create_from_png): Likewise, move most of the code to read_png(), clean up error handling and reduce this function to calling read_png() with a stdio based read function. (cairo_image_surface_create_from_png_stream): New function to create an image surface from a PNG stream. New functions to get widht and height of an image surface. Add new prototype and error codes. Adjust to new PNG API.
* Add new cairo_paint function.Carl Worth2005-04-191-0/+22
| | | | | | | | | Add new get_extents function to the surface backend interface. Add function to query current clip_extents. Implement the new get_extents function for each backend. Save the clip extents from set_clip_region and implement _cairo_surface_get_clip_extents. Abstract away the evil XGetGeometry roundtrip in _cairo_xlib_surface_get_size. Rewrite a couple of tests to call cairo_paint.
* Set freed pointer to NULL.Carl Worth2005-04-131-1/+3
| | | | | Fix to actually set surface->finished when done. Closes bug #2950 as documented in test/surface-finish-twice.c. Note that this bug is fixed.
* Change to allow NULL backend function pointers to indicate unsupported ↵Carl Worth2005-04-071-14/+2
| | | | | | functions. Eliminate stub functions and replace with NULL in surface backend table.
* Rework the cairo_matrix_t interface in several ways. Expose a struct for ↵Carl Worth2005-04-071-6/+6
| | | | | | | | | | | | cairo_matrix_t. Add new function to return current matrix: cairo_get_matrix Deprecate the following functions (in documentation): cairo_matrix_create cairo_matrix_destroy cairo_matrix_get_affine Rename: cairo_matrix_set_affine -> cairo_matrix_init cairo_matrix_set_identity -> cairo_matrix_init_identity Add other new matrix initialization functions: cairo_matrix_init_translate cairo_matrix_init_scale cairo_matrix_init_rotate Change return type of almost all cairo_matrix functions from cairo_status_t to void. Track changes to cairo_matrix_t interface. Add a test case showing the same path drawn under various transforms, (including skews set directly by initializing a cairo_matrix_t).
* Change type of data parameter from char* to unsigned char*.Carl Worth2005-04-041-1/+1
| | | | | | | | Propagate the unsigned char* change down the stack. Add cast since XImage uses char* rather than unsigned char*. Fix memory leak of image data. Switch to use cairo_surface_write_png rather than a custom write_png_argb32. Add test to exercise the cairo_image_surface_create_for_png function.