Commit Graph

17 Commits

Author SHA1 Message Date
Kornel 14f286f8e9 Use foreign-types to manage CFImage 2017-09-15 00:47:06 +01:00
Ryan Thomas 08f5ffd4bf Squash warnings on zero-sized structs #89.
Changes zero-sized structs to an `enum` and removed unused macro use statement.
2017-07-27 19:46:50 +01:00
bors-servo aa0471758a Auto merge of #80 - snapview:master, r=jdm
Introduces CGWindowList API for window capturing and improves `CGImage` and `CGContext`

Initially I just wanted to rewrite https://github.com/servo/core-graphics-rs/pull/52 as it seems that the author is not interested in changing his pull request. So I just implemented `CGImage` bindings, but today another pull request has been merged (https://github.com/servo/core-graphics-rs/pull/79) which does exactly the same.

This pull request still improves some things in regards to `CGImage`, the most important ones are:
* Now `CGImage` uses `CGImageRelease` instead of `CFRelease` (it's a much safer to use `CGImageRelease` here, as it does not crash if you pass a `NULL` image reference to it).
* Now you can retrieve bytes from `CGImage` (uses data provider and copies the bytes from it).

Also several improvements in `CGContext`:
* Added a function `create_image()`, which allows you to create an image out of existing `CGContext`.
* Now it is possible to specify a data pointer passed as a first parameter to the `CGBitmapContextCreate()` upon `CGContext` creation -- very important thing when you deal with images as it allows you to specify your own buffer instead of allocating and copying an additional one from the context (tested it on my machine, it gave me 18.46% of performance boost).

And of course this pull requests adds `CGWindowListCreateImage()` and related things, so now window capturing is possible.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-graphics-rs/80)
<!-- Reviewable:end -->
2017-04-24 09:49:03 -05:00
Daniel Abramov 02cfd064ad Add major CGImageRef related bindings 2017-04-24 16:04:24 +02:00
alfredoyang d503560bb1 Remove serde crate 2017-04-18 18:00:12 +08:00
Michael Sanders 8daf52206a Add CGImage support 2017-04-03 21:38:43 -07:00
Michael Sanders 34d678356b Use bitflags crate for CGEventFlags 2017-02-22 20:26:33 -08:00
Wilson Giese 1d652dd5db Add CGEvent and CGEventSource
Signed-off-by: Wilson Giese <giese.wilson@gmail.com>
2016-10-20 22:41:33 -07:00
Patrick Walton 3c3727442e Add some bindings to the private CGSRegion APIs.
These enable us to tell the window server about the opaque regions of
the window so that it can perform occlusion culling.

See https://github.com/NUIKit/CGSInternal/blob/master/CGSRegion.h
2016-05-31 16:50:05 -07:00
Patrick Walton 7f00bbf441 Support serialization of CGFont objects.
Due to API limitations, this will only serialize native fonts, not Web
fonts. Specifically, there is no way I know of to fetch the
`CGDataProvider` associated with a `CGFont`. This isn't a problem for
Servo, however, because Servo knows which fonts are Web fonts and stores
their byte data separately.
2015-11-30 16:41:46 -08:00
Patrick Walton 87cc3ba551 Add some basic support for bitmap graphics contexts and color spaces 2015-10-13 18:28:55 -07:00
Jack Moffitt 6937fdfe50 Add metadata for crates.io. 2015-06-03 21:57:27 -06:00
Jack Moffitt 7c41f6db7f Remove cfgs. 2015-06-02 23:42:59 -06:00
David Partouche 20de0e87e4 Forgot to rename display mod 2014-11-04 17:45:33 +01:00
David Partouche 066201f910 Added some Quartz Display Services functions (used in glutin) 2014-11-04 17:44:07 +01:00
Keegan McAllister 9faeb8fe6d Rust upgrade 2014-09-16 11:38:44 -07:00
Jack Moffitt b02256d3a6 Cargoify rust-core-graphics 2014-08-25 22:37:38 -06:00