Commit graph

40 commits

Author SHA1 Message Date
Carl Worth
36beed9bf1 Add CODING_STYLE document to standardize on some style issues.
Standardize brace handling around all else clauses according to new CODING_STYLE guidelines.
2005-06-03 14:51:57 +00:00
Kristian Høgsberg
f87fd91bcf Patch from Tomasz Cholewo <cholewo@ieee-cis.org>:
Store the index of the checksum instea of a pointer to the location.
2005-06-03 10:28:42 +00:00
Carl Worth
c56938e568 Rename CAIRO_OK to STATUS_OK. No intended changes in functionality. 2005-06-01 13:24:10 +00:00
Carl Worth
f0923288c5 Two fixes from Kristion Høgsberg:
Fix to close the file if we opened it.
Grab the status from out of the stream _before_ we destroy the stream.
2005-05-17 12:40:55 +00:00
Carl Worth
84bc5a32d6 Remove destroy_closure from cairo_output_stream_t interface.
Remove destroy_closure argument from cairo_pdf_surface_create_for_stream. Rename width,height to width_in_points, height_in_points for better clarity.
Brush a bunch of dust off of the PS backend and bring it up to date with the latest API conventions from the PDF backend. These include: accepting a filename rather than a FILE in the primary constructor, providing a stream-based interface for more flexibility, and accepting a surface size in device-space units (points) rather than inches.
Make it a little more clear that the width and height being passed around are in units of points.
Update to the latest cairo-ps.h changes as described above. Notice how much more sane things become now that the surface size is described in device-space units.
2005-05-17 05:58:01 +00:00
Kristian Høgsberg
ea410111d3 Take a filename instead of a FILE pointer. 2005-05-16 11:41:42 +00:00
Kristian Høgsberg
15ecc87763 Make this a varg function and use the new _cairo_output_stream_vprintf() function to format extra dict contents.
Reimplement the printf logic so we can special case formatting of doubles to be locale independent and trim trailing zeros.
2005-05-13 14:04:22 +00:00
Kristian Høgsberg
b9db66eb17 Rename cairo_pdf_surface_create_for_callback() to cairo_pdf_surface_create_for_stream(), and change PDF constructors to take width and height as points and move PPI setting to cairo_pdf_surface_set_ppi() 2005-05-13 09:26:20 +00:00
Carl Worth
d7fe527e0f Eliminate the following deprecated functions from cairo's interface:
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.
2005-05-06 13:32:53 +00:00
Kristian Høgsberg
8e485ec8c2 Fills as paths patch originally by Owen Taylor.
Make sure we have a current point for the relative path operators.
Add fill_path backend method.
Implement fill_path in the PDF backend.
2005-05-03 14:28:50 +00:00
Carl Worth
9c10b54e5e Add new cairo_paint function.
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.
2005-04-19 16:29:04 +00:00
Carl Worth
828094aef8 and delete:
cairo_set_pattern -> cairo_set_source cairo_get_pattern -> cairo_get_source cairo_set_rgb_color -> cairo_set_source_rgb
-> cairo_set_source_rgba cairo_set_alpha -> cairo_get_alpha ->
Note that we'll likely want to add cairo_set_source_surface.
Add _cairo_stock_color helper function. Improve some interfaces:
_cairo_color_init _cairo_color_init_rgb _cairo_color_set_rgb -> _cairo_color_init_rgba _cairo_color_set_alpha _cairo_color_multiply_alpha
_cairo_color_get_rgb -> _cairo_color_get_rbga _cairo_color_get_rgba_premultiplied
Add cairo_stock_t and some helper macros:
CAIRO_COLOR_WHITE CAIRO_COLOR_BLACK CAIRO_COLOR_TRANSPARENT
Fix cairo_pattern_t by eliminating pattern->alpha. Fix cairo_solid_pattern_t to use cairo_color_t rather than three doubles.
Track removal of pattern->alpha, simplifying the code considerably
Track _cairo_color interface changes. Remove gstate->alpha. Propagate down set_source renamings.
cairo_pattern_add_color_stop -> cairo_pattern_add_color_stop_rgba
and add:
cairo_pattern_add_color_stop_rgb
Remove pattern->alpha, simplifying the code considerably.
Track pattern and color interface changes.
Add const where appropriate on cairo_color_t*.
Add private type inspection predicate. (cairo_xlib_surface_set_size): Add check for surface type mismatch, (no useful error reporting yet, though).
Note coverage as en expected failure.
Improve line wrap on expected failure messages.
Port all tests to new cairo_set_source interfaces.
2005-04-14 14:42:26 +00:00
Owen Taylor
c803908d95 src/cairo.h src/cairo-font.c src/cairoint.h doc/public/cairo-sections.txt: Add cairo_font_face_set/get_user_data().
src/cairo-array.c src/cairoint.h src/cairo-surface.c: Refactor user data code from cairo-surface.c into cairo_user_data_array_t.
Switch these types to be like cairo_surface_t where the generic code frees the wrapper object.
src/cairo-atsui-font.c src/cairo-ft-font.c src/cairo-win32-font.c: Fix up for the above changes.
Implement a complicated mutual-referencing scheme to make sure that a face from cairo_ft_font_face_create_for_ft_face() is freed only when the FT_Face is no longer needed.
Update the docs to describe how to figure out when the FT_Face can be freed.
Fix refcount leaks when creating fonts.
Remove excess call to _cairo_unscaled_font_reference().
Remove stray initialization of font matrix to the identity.
test/user-data.c: Fix a bug when setting/unsetting a key with a free key slot before it, add that to the test case.
Don't append an element when user_data is NULL.
2005-04-08 13:14:17 +00:00
Carl Worth
9bef5b6f14 Change to allow NULL backend function pointers to indicate unsupported functions.
Eliminate stub functions and replace with NULL in surface backend table.
2005-04-07 14:25:00 +00:00
Owen Taylor
47824dee31 src/cairo.h src/cairo-gstate.c src/cairo-font.c: Add a cairo_font_face_t type to hold a description of a font face. Replace cairo_set_font() with cairo_set_font_face().
src/cairoint.h src/cairo-font.c src/cairo-gstate.c: Add "cairo_simple_font_face" for family/weight/slant and use it to implement font naming for the toy API.
src/cairo-ft.h src/cairo-ft-font.c cairo-win32.h cairo-win32-font.c: Switch the FreeType and Win32 backends over to using cairo_font_face_t.
src/cairo.h src/cairo-font.c src/cairo-ft-font.c src/cairo-win32-font.c: Pass in font matrix and CTM separately rather than as a composite scale when creating fonts; allows removing font_matrix argument to metrics functions.
src/cairoint.h src/cairo-font.c src/cairo-ft-font.c src/cairo-win32-font.c: Remove cairo_font_scale_t type, just use cairo_matrix_t and ignore translations.
src/cairo-ft.h src/cairo-ft-font.c: Remove cairo_ft_font_get_pattern() -- it can't work for all FreeType backend fonts and doesn't seem particularly useful.
Rename cairo_font_get_extents() to cairo_font_extents()
split font functions into a separate section.
Fix locking order problem.
Add caches for simple font faces and from cairo_font_face_t to cairo_scaled_font_t.
src/cairo.h src/cairoint.h src/cairo-font.c src/cairo-win32-font.c src/cairo-ft-font.c src/cairo-gstate.c src/cairo-gstate-private.h: Rename cairo_font_t to cairo_scaled_font_t.
2005-04-07 11:03:59 +00:00
Carl Worth
d135938efd Rework the cairo_matrix_t interface in several ways. Expose a struct for 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).
2005-04-07 10:01:49 +00:00
Carl Worth
027057bf62 Drop cairo_default_matrix since it is now always identical to cairo_identity_matrix.
Remove gstate->pixels_per inch. Change default matrix to always be the identity matrix.
Drop pixels_per_inch function from surface backend interface as it is no longer needed.
2005-04-04 06:49:19 +00:00
Carl Worth
9e405876e8 Style and indentation fixes.
cast to quiet new gcc-4 warnings.
Initialize variables to quiet new gcc-4 warnings.
Use unsigned char* as expected by freetype, libpng, Xlib, and zlib.
Propagate unsigned char* down from cairo_text_extents.
2005-04-02 05:18:11 +00:00
Kristian Høgsberg
bd5bbb6ce2 New PNG utility functions.
Reverse the naming of the pdf constructors so the callback based ones have the long names.
2005-03-28 13:58:26 +00:00
Carl Worth
9bb1715159 Move surface-specific cairo_t functions to cairo.c.
Remove functions that have now moved to cairo.c.
A few new files to ignore now with new compilation mode using a libtool helper library.
2005-03-23 13:49:32 +00:00
Kristian Høgsberg
987a13b814 Remove return statements from these functions (bug #2137). 2005-03-18 12:26:03 +00:00
Kristian Høgsberg
6993c086eb Add cairo_output_stream.c
Add new errors, CAIRO_STATUS_WRITE_ERROR and CAIRO_STATUS_SURFACE_FINISHED, add cairo_surface_finish() prototype, add cairo_write_func_t.
Add strings for new errors, documentation fix.
Rename surface destroy functions to finish and change them to not free the surface.
Change PDF surface constructors to take a write function in the general case and add stdio convenience constructors. Change destroy function to finish for cairo_pdf_surface. Change implementation to use cairo_output_stream_t functions for output.
Use _cairo_surface_show_glyphs instead of calling function pointer directly.
Add prototypes for cairo output stream functions, rename destroy to finish in cairo_surface_backend_t and add finished flag to cairo_surface_t.
Add cairo_surface_finish() and call it from cairo_surface_destroy(). Check the finished flag in cairo_surface_t in functions that change the surface.
2005-03-16 12:08:41 +00:00
Kristian Høgsberg
74416f2d9a Return CAIRO_STATUS_SUCCESS even if we don't implement masks yet, so we don't set cr->status to CAIRO_INT_STATUS_UNSUPPORTED. 2005-03-07 21:22:42 +00:00
David Reveman
50b5344d7d Pass mask to composite operation as pattern 2005-03-03 18:39:06 +00:00
David Reveman
a97f4cce5e Removed surface backend functions set_matrix, set_filter and set_repeat 2005-03-03 18:20:28 +00:00
David Reveman
019d381b40 Change to cairo_surface_t like structure of of cairo_pattern_t 2005-03-03 17:40:04 +00:00
Kristian Høgsberg
9597c0b791 Initialize array element size correctly. 2005-02-13 20:36:28 +00:00
Kristian Høgsberg
0502a5a63c Patches from Owen Taylor:
Emit text as octal escapes, to avoid problems with \, \r, ), etc. (_cairo_pdf_document_write_fonts): Change /Flags to be 4 (symbolic), not 32 (non-symbolic), otherwise acroread gets confuse. (cairo_pdf_ft_font_write_cmap_table): Use a 1,0 cmap subtable, not a 0,0, to conform to the PDF spec.
2005-02-13 12:41:42 +00:00
Kristian Høgsberg
211d115f18 Pretend we support compositing of solid color or gradient patterns to prevent image fallback. (emit_pattern): New function, code factored out from _cairo_pdf_surface_composite_trapezoids. (_cairo_pdf_surface_show_glyphs): Use emit_pattern here so we get pattern support for text.
Fix typo.
2005-02-01 20:47:43 +00:00
Owen Taylor
26148a1d15 src/cairoint.h src/cairo_image_surface.c src/cairo_pdf_surface.c src/cairo_png_surface.c src/cairo_surface.c src/cairo_xlib_surface.c: Replace the get_image()/set_image() backend operations with a more specific {acquire,release}_{source,dest}_image() and clone_similar().
src/cairoint.h src/cairo_pattern.c: Replace _cairo_pattern_get_surface() with a _cairo_pattern_begin_draw()/_cairo_pattern_end_draw() pair.
Save the format for which an image is created so we can access it later. (Needed for the _cairo_xlib_surface_clone_similar())
src/cairoint.h src/cairo_image_surface.c: Add _cairo_surface_is_image().
Add CAIRO_OK(status) to check for CAIRO_STATUS_SUCCESS.
In the absence of of RENDER, make cairo_xlib_surface_create_similar() return an image surface.
Don't try to use RENDER to composite glyphs in the absence of the RENDER extension.
2005-01-31 08:50:22 +00:00
Kristian Høgsberg
17ec6f1482 The overall idea of this rewrite is that we want to pass the source pattern all the way down into the backends. The motivation for this is that not all backends want a surface for the source operand, and by passing the pattern down, backends can choose to convert it to a surface if they need that.
The patch removes the create_surface function pointer from the surface vtable and moves much of that code into a couple of helper functions. The composite, compsite_trapezoids, and show_glyphs backend functions are updated to take a cairo_pattern_t instead of a surface as the source.
Change these functions to not create a surface for the pattern and just pass the pattern down to the backend functions.
New function to translate a set of trapezoids.
Break out the code to adjust and restore surface transformation and repeat settings into _cairo_pattern_prepare_surface and _cairo_pattern_restore_surface.
Split cairo_pattern_create_for_surface into an init function and a create function.
Utility functions to create a surface from a pattern.
Update these backends to work with the new pattern API. Glitz work by David Reveman.
Update these to pass through the new set of args.
Update this reference image as we now render it correctly.
2005-01-27 10:46:20 +00:00
Owen Taylor
a812c7a066 Chec pdf_font for NULL, not font. 2005-01-25 10:56:50 +00:00
Owen Taylor
97424a3c2a Change cairo_font_t to refer to a font scaled to a particular output device resolution.
src/cairoint.h src/cairo_font.c src/cairo_ft_font.c src/cairo_xlib_surface.c src/cairo_pdf_surface.c src/cairo_gstate.c src/cairo.c: Switch many internal methods from handling cairo_unscaled_font_t and cairo_font_scale_t pairs to handling cairo_font_t.
src/cairo-ft-private.h src/cairo_ft_fontc: Add some internal interfaces for use by the FreeType backend.
Clear the gstate's current font when the transform or target surface changes.
src/cairo.h src/cairo_ft_font.c: Rename cairo_ft_font_pattern to cairo_ft_font_get_pattern().
src/cairo.h src/cairo_ft_font.c: Make cairo_ft_font_create() and cairo_ft_font_create_for_ft_face() take a font scale; make the latter take load_flags for FT_Load_Glyph() as well. Change cairo_ft_font_face() to Xft-style cairo_ft_font_lock_face, cairo_ft_font_unlock_face.
Remove the name/slant/weight=>unscaled font cache, it didn't work with the new cairo_font_t setup. If it turns out to be needed, it can be added back in some other form.
src/cairoint.h src/cairo_font.c: Add a 'flags' field to cairo_glyph_cache_key_t, we use it for load flags with freetype backend.
Switch the caching to be from resolved fontconfig pattern => file; keep only a fixed number of FT_Face objects open at once, similar to FreeType.
src/cairo_gstate.c src/cairoint.h: Add public cairo_font_glyph_extents, use it to implement _cairo_gstate_glyph_extents().
Add refcounting for glyph cache elements; there was an bug where elements got ejected from the cache and freed before they could be used.
src/cairoint.h src/cairo_cache.c (_cairo_cache_random_entry()) New function to return a random entry in the cache matching a predicate; reuse the internals for the previous _random_live_entry().
src/cairoint.h src/cairo_cache.c (_cairo_cache_lookup()): Add an optional created_entry return value.
src/cairo_ft_font.c src/cairo_xlib_surface.c: Adapt to _cairo_cache_lookup() change.
Support max_memory == 0 to indicate an unbounded cache.
src/cairoint.h src/cairo_cache.c (_cairo_cache_remove()): Add a function to manually remove entries from the cache.
Update for changes, document cairo_matrix_t, cairo_glyph_t, etc.
src/cairo.h src/cairo-atsui.h src/cairo-ft.h src/cairo-glitz.h src/cairo-pdf.h src/cairo-png.h src/cairo-ps.h src/cairo-quartz.h src/cairo-xcb.h src/cairo-xlib.h: Add CAIRO_BEGIN/END_DECLS for extern "C", use it on all public headers. Move header guards outermost.
Fix encoding.
2005-01-21 14:33:47 +00:00
Carl Worth
b646ecfe08 Track various renamings.
Insert new includes for backend-specific header files.
Remove redundant include of cairo-features.h.
Rename header-exclusion macro from _CAIRO_H_ to CAIRO_H. Remove platform-specific grubbing for cairo-features.h and pixman.h in odd places.
Remove all backend-specific prototypes, (as they are now in their own header files).
Remove deprecated
Remove printf.
Convert to utf-8. Use the proper name for multiple-header exclusion (CAIRO_FEATURES_H). Track rename of FREETYPE_FONT_FEATURE to FT_FONT_FEATURE.
Split cairo.h up into cairo.h, cairo-ft.h, cairo-glitz.h, cairo-pdf.h, cairo-png.h, cairo-ps.h, cairo-xcb.h, cairo-xlib.h. Update for rename of cairo_wideint.h to cairo-wideint.h.
Rename CAIRO_HAS_FREETYPE_FONT to CAIRO_HAS_FT_FONT, (to match cairo_ft_font functions and cairo-ft.h).
Update for public header files now in /cairo.
2005-01-20 08:28:54 +00:00
Kristian Høgsberg
6fb833a84c Add byteswap macros missing for bigendian architectures. 2005-01-19 08:03:53 +00:00
Kristian Høgsberg
e1eec5cf0e Fix double free in error path. (cairo_pdf_ft_font_create): Reference the unscaled font to keep the FT_Face around. (cairo_pdf_ft_font_generate): Initialize end to avoid compiler warning; bail out if table write fails. Fixes from Owen. 2005-01-17 14:59:49 +00:00
Kristian Høgsberg
2c6939b7ac Add preliminary text support, including support for truetype font subsetting.
Change type of 'surface' argument in show_glyphs to void * as it is for all other surface virtual functions.
Update accordingly.
Add check for endianess.
Fix bug in array growing loop. (_cairo_array_append): Accept NULL for elements argument, in which case we just allocate space in the array.
2005-01-17 09:40:00 +00:00
Kristian Høgsberg
a850136805 Add -lz to CAIRO_LIBS when compiling the PDF backend.
Don't use compressBound, since it's only available in zlib 1.2 and newer.
2005-01-06 23:20:07 +00:00
Kristian Høgsberg
c9f545672a Implement image compression (taken from cairo_ps_surface.c). 2005-01-05 17:46:31 +00:00
Kristian Høgsberg
b1ec8ae13e New PDF backend.
Add PDF surface constructors.
New file - generic array implementation.
Add cairo_array prototypes.
Add cairo_array.c and cairo_pdf_surface.c.
2005-01-05 14:29:31 +00:00