Commit Graph

85 Commits

Author SHA1 Message Date
Kornel c86445c76f Use foreign-types for CGContext 2017-09-15 00:47:06 +01:00
Kornel 8c0664a542 Hide foreign-types internals from docs 2017-09-15 00:47:06 +01:00
Kornel 81a2c1dc9d Use foreign-types for CGEvent 2017-09-15 00:47:06 +01:00
Kornel 1993281ca6 Use foreign-types for CGFont 2017-09-15 00:47:06 +01:00
Kornel ae15062bf1 Use foreign-types for CGDataProvider 2017-09-15 00:47:06 +01:00
Kornel 045fa8ca48 Use foreign-types to manage CGColorSpace 2017-09-15 00:47:06 +01:00
Kornel 14f286f8e9 Use foreign-types to manage CFImage 2017-09-15 00:47:06 +01:00
Kornel 987ec455b4 Test 2017-09-15 00:02:53 +01:00
Kornel e0b23498ff Silence warning 2017-09-14 23:17:38 +01:00
bors-servo 6db694d4dd Auto merge of #90 - rthomas:89-warnings, r=jdm
Remove warnings for zero-sized structs

This change removes a bunch of warnings from the crate.

The only remaining warnings are due to the bitflags macro usage.

This will help fix servo/core-text-rs#62 when it upgrades to `core-graphics = 0.9`.

@jdm

<!-- 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/90)
<!-- Reviewable:end -->
2017-07-27 15:33:02 -05: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
Ryan Thomas b0b6dcdbaa Remove warnings for zero-sized structs #89.
This follows the servo pattern mentioned in
https://github.com/rust-lang/rust/issues/27303 to replace the zero-sized
structs with an `enum`.
2017-07-27 19:46:36 +01:00
Daniel Abramov 7066159155 Add CGWindowListCreateImageFromArray() 2017-07-24 16:54:13 +02:00
Daniel Abramov f9f22263d8 Add a couple additional CGRect functions 2017-07-04 10:52:10 +02:00
Daniel Abramov f9d4aa4dea Add missing CGDisplayCreateImage() function. 2017-07-04 10:50:52 +02:00
Bastien Orivel 77d66fcc42 Bump bitflags to 0.9 and bump version 2017-06-19 20:29:12 +02:00
Martin Algesten da76a42406 pub, obviously 2017-05-31 16:13:47 +02:00
Martin Algesten f82e6e5015 CGContextSetFontSmoothingStyle 2017-05-19 10:45:17 +02: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 81ded0d8ab Add the posibility to specify buffer for CGContext 2017-04-24 16:07:33 +02:00
Daniel Abramov a4d3c12cb5 Add CFRectMakeWithDictionaryRepresentation 2017-04-24 16:07:33 +02:00
Daniel Abramov c57d98ab71 Add CGWindowList API 2017-04-24 16:04:32 +02: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
bors-servo 1753515405 Auto merge of #79 - msanders:ms/cgimage, r=jdm
Add CGImage support

<!-- 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/79)
<!-- Reviewable:end -->
2017-04-03 23:44:27 -05:00
Michael Sanders 8daf52206a Add CGImage support 2017-04-03 21:38:43 -07:00
Michael Sanders 65dd626c1c Rename to set_string_from_utf16_unchecked 2017-03-22 10:05:00 -07:00
Michael Sanders 52952115c1 Add support for CGEventKeyboardSetUnicodeString 2017-03-22 10:04:59 -07:00
bors-servo 43f708c430 Auto merge of #74 - msanders:ms/set-event-flags, r=jdm
Allow applying multiple bitmask flags to events

<!-- 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/74)
<!-- Reviewable:end -->
2017-03-17 14:28:34 -07:00
bors-servo 458684b073 Auto merge of #72 - msanders:ms/cgevent-type, r=jdm
Add support for CGEventSetType

<!-- 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/72)
<!-- Reviewable:end -->
2017-03-17 14:18:16 -07:00
Jeff Muizelaar 34659f9ae2 Fix callback types 2017-03-15 11:51:29 -04:00
Michael Sanders d15fa934d3 Add support for CGEventSetType 2017-02-23 19:51:14 -08:00
Michael Sanders a7c53a2bf9 Add prefix to bitflags
Necessary until rust-lang-nursery/bitflags/issues/21 is implemented.
2017-02-22 20:30:23 -08:00
Michael Sanders 34d678356b Use bitflags crate for CGEventFlags 2017-02-22 20:26:33 -08:00
Michael Sanders b35e818544 Allow applying multiple bitmask flags to events 2017-02-20 16:50:40 -08:00
bors-servo ecf21c2c5b Auto merge of #71 - pythoneer:patch-1, r=jdm
Fixed CGEventType in event.rs

changed the enum declaration from bit shifts to one without, like in the original  CGEventTypes.h

<!-- 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/71)
<!-- Reviewable:end -->
2017-02-20 04:55:51 -08:00
pythoneer 7687a5ed9c Fixed CGEventType in event.rs
changed the enum declaration from bit shifts to one without, like in the original  CGEventTypes.h
2017-02-02 21:38:07 +01:00
Anthony Ramine 5df4a8f58e Update serde to 0.9 2017-02-01 13:38:26 +01:00
Josh Matthews 0b08242836 Hide features from macOS 10.11 behind a feature. 2017-01-13 13:28:17 -05:00
Mason Chang b459976fc8 Add CGContextFillRect to CGContext 2017-01-09 17:18:21 -08:00
Michael Sanders 8079a2f905 Add support for CGEvent::new & CGEventGetLocation 2017-01-08 18:06:32 -08:00
bors-servo 3d50c8ea1d Auto merge of #59 - WilsonGiese:master, r=jdm
Add CGEvent and CGEventSource

Added CGEvent and CGEventSource to simulate keyboard events.

FFI corresponds mostly to their respective headers in CoreGraphics except for some data types which are defined in CGEventTypes.h.

Uses:
CoreGraphics.framework/Headers/CGEvent.h
CoreGraphics.framework/Headers/CGEventSource.h
CoreGraphics.framework/Headers/CGEventTypes.h

<!-- 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/59)

<!-- Reviewable:end -->
2016-11-06 23:08:09 -06:00
Jeff Muizelaar a7056be382 Add functions for controlling subpixel positioning 2016-10-31 13:30:32 -04:00
Jeff Muizelaar 005b64013e Add kCGBitmapByteOrder constants 2016-10-29 14:33:18 -04:00
Jeff Muizelaar f9a86ff46c Add support for CGContextSetTextDrawingMode 2016-10-29 13:49:47 -04:00
Wilson Giese b88ff77b0d Style 2016-10-28 13:11:11 -07:00
Wilson Giese a70192dae8 New for keyboard & mouse events 2016-10-27 17:54:35 -07:00
Wilson Giese 179f4747a9 Add MouseEvent 2016-10-27 17:38:48 -07:00
Wilson Giese 438e083fc3 Derive clone, copy, debug for enums 2016-10-23 23:36:13 -07: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