Commit Graph

68 Commits

Author SHA1 Message Date
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
Glenn Watson 6c4a34acd9 Support changing AA settings on a context. 2016-09-01 20:07:49 +10:00
Anthony Ramine e805130b6b Fix all private_in_public errors 2016-09-01 11:58:05 +02:00
Anthony Ramine e47505dfa8 Don't reexport libc 2016-09-01 11:57:12 +02:00
Anthony Ramine 66df225fd8 Silence an unused_variables warning 2016-09-01 11:51:28 +02:00
Anthony Ramine e2e56e909b Remove some unused imports 2016-09-01 11:50:19 +02:00
Anthony Ramine 17c0b1ed9e Remove some useless comment and commented-out code 2016-09-01 11:49:45 +02:00
Anthony Ramine 39173f66d7 Silence all non_upper_case_globals warnings 2016-09-01 11:49:25 +02:00
Patrick Walton 443e95792a private: Add a binding to CGSSetSurfaceShape.
This is useful to make OpenGL areas have rounded corners. It matches
what the Cocoa framework does internally for this.
2016-06-03 16:08:10 -07:00
Patrick Walton 621a033730 private: Add a binding to CGSNewRegionWithRectList. 2016-06-03 16:07:24 -07:00
Patrick Walton 828a7fde4b private: Rename CGSRegion types to match reverse engineered headers
available elsewhere.

See: https://github.com/NUIKit/CGSInternal/blob/master/CGSRegion.h
2016-06-03 16:05:44 -07:00
Patrick Walton 35d5156182 geometry: Add a binding to CGRectInset. 2016-06-03 16:04:59 -07:00
Patrick Walton 508a240632 geometry: Add some convenience constructors for geometry types. 2016-06-03 16:04:40 -07:00
Patrick Walton 9b16b0e214 geometry: Add CG_ZERO_POINT to match CGZeroPoint. 2016-06-03 16:04:03 -07:00
Patrick Walton b31cffb648 geometry: Make CGPoint, CGRect, and CGSize copyable and clonable. 2016-06-03 16:03:35 -07:00
bors-servo 8be09b1ad4 Auto merge of #50 - pcwalton:regions, r=metajack
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

r? @metajack

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-graphics-rs/50)
<!-- Reviewable:end -->
2016-05-31 18:47:43 -05: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
Luo d1cb1a7764 add some display api. 2016-05-12 06:34:32 +08:00