rubyquartz 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. data/COPYRIGHT +24 -0
  2. data/History.txt +9 -0
  3. data/Manifest.txt +95 -0
  4. data/README.txt +71 -0
  5. data/Rakefile +51 -0
  6. data/ext/ExportedSymbols.txt +1 -0
  7. data/ext/bitmap.c +129 -0
  8. data/ext/bitmap.h +38 -0
  9. data/ext/bitmap_context.c +67 -0
  10. data/ext/bitmap_context.h +31 -0
  11. data/ext/color.c +145 -0
  12. data/ext/color.h +34 -0
  13. data/ext/colorspace.c +94 -0
  14. data/ext/colorspace.h +33 -0
  15. data/ext/context.c +393 -0
  16. data/ext/context.h +33 -0
  17. data/ext/extconf.rb +48 -0
  18. data/ext/font.c +148 -0
  19. data/ext/font.h +32 -0
  20. data/ext/function.c +124 -0
  21. data/ext/function.h +32 -0
  22. data/ext/image.c +140 -0
  23. data/ext/image.h +31 -0
  24. data/ext/image_source.c +143 -0
  25. data/ext/image_source.h +31 -0
  26. data/ext/pdf_document.c +91 -0
  27. data/ext/pdf_document.h +31 -0
  28. data/ext/pdf_page.c +79 -0
  29. data/ext/pdf_page.h +31 -0
  30. data/ext/point.c +42 -0
  31. data/ext/point.h +32 -0
  32. data/ext/rect.c +45 -0
  33. data/ext/rect.h +32 -0
  34. data/ext/rubyquartz.c +80 -0
  35. data/ext/rubyquartz.h +29 -0
  36. data/ext/rubyquartz_prefix.h +45 -0
  37. data/ext/shading.c +68 -0
  38. data/ext/shading.h +32 -0
  39. data/ext/size.c +42 -0
  40. data/ext/size.h +32 -0
  41. data/ext/text.c +258 -0
  42. data/ext/text.h +39 -0
  43. data/ext/utilities.c +181 -0
  44. data/ext/utilities.h +43 -0
  45. data/lib/rubyquartz.rb +59 -0
  46. data/lib/rubyquartz/bitmap.rb +62 -0
  47. data/lib/rubyquartz/bitmap_context.rb +50 -0
  48. data/lib/rubyquartz/color.rb +68 -0
  49. data/lib/rubyquartz/colorspace.rb +42 -0
  50. data/lib/rubyquartz/context.rb +116 -0
  51. data/lib/rubyquartz/font.rb +48 -0
  52. data/lib/rubyquartz/function.rb +57 -0
  53. data/lib/rubyquartz/image.rb +48 -0
  54. data/lib/rubyquartz/image_source.rb +50 -0
  55. data/lib/rubyquartz/pdf_document.rb +47 -0
  56. data/lib/rubyquartz/pdf_page.rb +54 -0
  57. data/lib/rubyquartz/point.rb +63 -0
  58. data/lib/rubyquartz/rect.rb +127 -0
  59. data/lib/rubyquartz/shading.rb +48 -0
  60. data/lib/rubyquartz/size.rb +39 -0
  61. data/lib/rubyquartz/text.rb +50 -0
  62. data/test/images/TestContext.test_begin_path.png +0 -0
  63. data/test/images/TestContext.test_draw_image.png +0 -0
  64. data/test/images/TestContext.test_draw_path.png +0 -0
  65. data/test/images/TestContext.test_draw_pdf.png +0 -0
  66. data/test/images/TestContext.test_draw_shading_axial.png +0 -0
  67. data/test/images/TestContext.test_draw_text.png +0 -0
  68. data/test/images/TestContext.test_draw_text_baseline_aligned.png +0 -0
  69. data/test/images/TestContext.test_draw_text_flipped.png +0 -0
  70. data/test/images/TestContext.test_draw_text_flipped_non_zero_point.png +0 -0
  71. data/test/images/TestContext.test_draw_text_non_zero_point.png +0 -0
  72. data/test/images/TestContext.test_fill.png +0 -0
  73. data/test/images/TestContext.test_gsave.png +0 -0
  74. data/test/images/TestContext.test_gsave_block.png +0 -0
  75. data/test/images/TestContext.test_line_width.png +0 -0
  76. data/test/images/TestContext.test_lineto.png +0 -0
  77. data/test/images/TestContext.test_rotate.png +0 -0
  78. data/test/images/TestContext.test_rounded_rect.png +0 -0
  79. data/test/images/TestContext.test_scale.png +0 -0
  80. data/test/images/TestContext.test_set_line_dash.png +0 -0
  81. data/test/images/TestContext.test_shadow.png +0 -0
  82. data/test/images/TestContext.test_stroke_rect.png +0 -0
  83. data/test/images/TestContext.test_text_bounds.png +0 -0
  84. data/test/images/TestContext.test_translate.png +0 -0
  85. data/test/inputs/circle.pdf +0 -0
  86. data/test/inputs/wash.png +0 -0
  87. data/test/rubyquartz_test.rb +51 -0
  88. data/test/tc_bitmap_context.rb +43 -0
  89. data/test/tc_color.rb +43 -0
  90. data/test/tc_context.rb +315 -0
  91. data/test/tc_font.rb +54 -0
  92. data/test/tc_image_source.rb +69 -0
  93. data/test/tc_pdf_document.rb +63 -0
  94. data/test/tc_pdf_page.rb +53 -0
  95. data/test/tc_text.rb +39 -0
  96. metadata +156 -0
data/ext/point.h ADDED
@@ -0,0 +1,32 @@
1
+ /*
2
+ Copyright (c) 2006, The Omni Group, Inc. All rights reserved.
3
+
4
+ OPEN PERMISSION TO USE AND REPRODUCE OMNI SOURCE CODE SOFTWARE
5
+
6
+ Omni Source Code software is available from The Omni Group on their web
7
+ site at www.omnigroup.com.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a
10
+ copy of this software and associated documentation files (the "Software"),
11
+ to deal in the Software without restriction, including without limitation
12
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
13
+ and/or sell copies of the Software, and to permit persons to whom the
14
+ Software is furnished to do so, subject to the following conditions:
15
+
16
+ Any original copyright notices and this permission notice shall be included
17
+ in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
+ DEALINGS IN THE SOFTWARE.
26
+ */
27
+
28
+
29
+ extern void Init_point(void);
30
+ extern VALUE point_class;
31
+
32
+ extern VALUE point_value_from_point(CGPoint point);
data/ext/rect.c ADDED
@@ -0,0 +1,45 @@
1
+ /*
2
+ Copyright (c) 2006, The Omni Group, Inc. All rights reserved.
3
+
4
+ OPEN PERMISSION TO USE AND REPRODUCE OMNI SOURCE CODE SOFTWARE
5
+
6
+ Omni Source Code software is available from The Omni Group on their web
7
+ site at www.omnigroup.com.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a
10
+ copy of this software and associated documentation files (the "Software"),
11
+ to deal in the Software without restriction, including without limitation
12
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
13
+ and/or sell copies of the Software, and to permit persons to whom the
14
+ Software is furnished to do so, subject to the following conditions:
15
+
16
+ Any original copyright notices and this permission notice shall be included
17
+ in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
+ DEALINGS IN THE SOFTWARE.
26
+ */
27
+
28
+
29
+ #include "rect.h"
30
+
31
+ #include "point.h"
32
+ #include "size.h"
33
+
34
+ VALUE rect_class;
35
+
36
+ VALUE rect_value_from_rect(CGRect rect)
37
+ {
38
+ VALUE origin_size[2] = {point_value_from_point(rect.origin), size_value_from_size(rect.size)};
39
+ return rb_class_new_instance(2, origin_size, rect_class);
40
+ }
41
+
42
+ void Init_rect(void)
43
+ {
44
+ rect_class = rb_define_class_under(module, "Rect", rb_cObject);
45
+ }
data/ext/rect.h ADDED
@@ -0,0 +1,32 @@
1
+ /*
2
+ Copyright (c) 2006, The Omni Group, Inc. All rights reserved.
3
+
4
+ OPEN PERMISSION TO USE AND REPRODUCE OMNI SOURCE CODE SOFTWARE
5
+
6
+ Omni Source Code software is available from The Omni Group on their web
7
+ site at www.omnigroup.com.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a
10
+ copy of this software and associated documentation files (the "Software"),
11
+ to deal in the Software without restriction, including without limitation
12
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
13
+ and/or sell copies of the Software, and to permit persons to whom the
14
+ Software is furnished to do so, subject to the following conditions:
15
+
16
+ Any original copyright notices and this permission notice shall be included
17
+ in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
+ DEALINGS IN THE SOFTWARE.
26
+ */
27
+
28
+
29
+ extern void Init_rect(void);
30
+ extern VALUE rect_class;
31
+
32
+ extern VALUE rect_value_from_rect(CGRect rect);
data/ext/rubyquartz.c ADDED
@@ -0,0 +1,80 @@
1
+ /*
2
+ Copyright (c) 2006, The Omni Group, Inc. All rights reserved.
3
+
4
+ OPEN PERMISSION TO USE AND REPRODUCE OMNI SOURCE CODE SOFTWARE
5
+
6
+ Omni Source Code software is available from The Omni Group on their web
7
+ site at www.omnigroup.com.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a
10
+ copy of this software and associated documentation files (the "Software"),
11
+ to deal in the Software without restriction, including without limitation
12
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
13
+ and/or sell copies of the Software, and to permit persons to whom the
14
+ Software is furnished to do so, subject to the following conditions:
15
+
16
+ Any original copyright notices and this permission notice shall be included
17
+ in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
+ DEALINGS IN THE SOFTWARE.
26
+ */
27
+
28
+ #include "point.h"
29
+ #include "size.h"
30
+ #include "rect.h"
31
+ #include "context.h"
32
+ #include "bitmap.h"
33
+ #include "image.h"
34
+ #include "bitmap_context.h"
35
+ #include "colorspace.h"
36
+ #include "color.h"
37
+ #include "font.h"
38
+ #include "text.h"
39
+ #include "function.h"
40
+ #include "shading.h"
41
+ #include "image_source.h"
42
+ #include "pdf_document.h"
43
+ #include "pdf_page.h"
44
+
45
+ VALUE module;
46
+
47
+ #ifdef DO_QUARTZ_MALLOC_CHECK
48
+ static VALUE _check_memory(VALUE self)
49
+ {
50
+ if (!malloc_zone_check(NULL))
51
+ rb_raise(rb_eException, "Memory check failed");
52
+ return self;
53
+ }
54
+ #endif
55
+
56
+ void Init_rubyquartz_api()
57
+ {
58
+ module = rb_define_module("Quartz");
59
+
60
+ #ifdef DO_QUARTZ_MALLOC_CHECK
61
+ rb_define_module_function(module, "_check_memory", _check_memory, 0);
62
+ #endif
63
+
64
+ Init_point();
65
+ Init_size();
66
+ Init_rect();
67
+ Init_colorspace();
68
+ Init_color();
69
+ Init_bitmap();
70
+ Init_image();
71
+ Init_context();
72
+ Init_bitmap_context();
73
+ Init_font();
74
+ Init_text();
75
+ Init_function();
76
+ Init_shading();
77
+ Init_image_source();
78
+ Init_pdf_document();
79
+ Init_pdf_page();
80
+ }
data/ext/rubyquartz.h ADDED
@@ -0,0 +1,29 @@
1
+ /*
2
+ Copyright (c) 2006, The Omni Group, Inc. All rights reserved.
3
+
4
+ OPEN PERMISSION TO USE AND REPRODUCE OMNI SOURCE CODE SOFTWARE
5
+
6
+ Omni Source Code software is available from The Omni Group on their web
7
+ site at www.omnigroup.com.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a
10
+ copy of this software and associated documentation files (the "Software"),
11
+ to deal in the Software without restriction, including without limitation
12
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
13
+ and/or sell copies of the Software, and to permit persons to whom the
14
+ Software is furnished to do so, subject to the following conditions:
15
+
16
+ Any original copyright notices and this permission notice shall be included
17
+ in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
+ DEALINGS IN THE SOFTWARE.
26
+ */
27
+
28
+
29
+ extern VALUE module;
@@ -0,0 +1,45 @@
1
+ /*
2
+ Copyright (c) 2006, The Omni Group, Inc. All rights reserved.
3
+
4
+ OPEN PERMISSION TO USE AND REPRODUCE OMNI SOURCE CODE SOFTWARE
5
+
6
+ Omni Source Code software is available from The Omni Group on their web
7
+ site at www.omnigroup.com.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a
10
+ copy of this software and associated documentation files (the "Software"),
11
+ to deal in the Software without restriction, including without limitation
12
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
13
+ and/or sell copies of the Software, and to permit persons to whom the
14
+ Software is furnished to do so, subject to the following conditions:
15
+
16
+ Any original copyright notices and this permission notice shall be included
17
+ in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
+ DEALINGS IN THE SOFTWARE.
26
+ */
27
+
28
+
29
+ #include <ApplicationServices/ApplicationServices.h>
30
+ #include <CoreFoundation/CoreFoundation.h>
31
+
32
+ #include "ruby.h"
33
+ #include "utilities.h"
34
+ #include "rubyquartz.h"
35
+
36
+ //#define DO_QUARTZ_MALLOC_CHECK
37
+ #ifdef DO_QUARTZ_MALLOC_CHECK
38
+ #include <malloc/malloc.h>
39
+ #define QUARTZ_MALLOC_CHECK do { \
40
+ if (!malloc_zone_check(NULL)) { \
41
+ fprintf(stderr, "Malloc check failed at %s:%d -- %s!\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); \
42
+ abort(); \
43
+ } \
44
+ } while(0)
45
+ #endif
data/ext/shading.c ADDED
@@ -0,0 +1,68 @@
1
+ /*
2
+ Copyright (c) 2006, The Omni Group, Inc. All rights reserved.
3
+
4
+ OPEN PERMISSION TO USE AND REPRODUCE OMNI SOURCE CODE SOFTWARE
5
+
6
+ Omni Source Code software is available from The Omni Group on their web
7
+ site at www.omnigroup.com.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a
10
+ copy of this software and associated documentation files (the "Software"),
11
+ to deal in the Software without restriction, including without limitation
12
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
13
+ and/or sell copies of the Software, and to permit persons to whom the
14
+ Software is furnished to do so, subject to the following conditions:
15
+
16
+ Any original copyright notices and this permission notice shall be included
17
+ in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
+ DEALINGS IN THE SOFTWARE.
26
+ */
27
+
28
+
29
+ #include "shading.h"
30
+
31
+ #include "colorspace.h"
32
+ #include "function.h"
33
+
34
+ VALUE shading_class;
35
+
36
+ CGShadingRef shading_get(VALUE self)
37
+ {
38
+ return (CGShadingRef)_cftype_get(self, CGShadingGetTypeID(), "CGShadingRef");
39
+ }
40
+
41
+ static VALUE shading_init_axial(VALUE self, VALUE colorspace, VALUE start_x, VALUE start_y, VALUE end_x, VALUE end_y,
42
+ VALUE function, VALUE extend_start, VALUE extend_end)
43
+ {
44
+ CGColorSpaceRef cs = colorspace_get(colorspace);
45
+ CGPoint start = CGPointMake(NUM2DBL(start_x), NUM2DBL(start_y));
46
+ CGPoint end = CGPointMake(NUM2DBL(end_x), NUM2DBL(end_y));
47
+ CGFunctionRef func = function_get(function);
48
+ bool extendStart = RTEST(extend_start);
49
+ bool extendEnd = RTEST(extend_end);
50
+
51
+ CGShadingRef *shading;
52
+ Data_Get_Struct(self, CGShadingRef, shading);
53
+ if (!shading)
54
+ rb_raise(rb_eException, "Shading not initialized correctly");
55
+ *shading = CGShadingCreateAxial(cs, start, end, func, extendStart, extendEnd);
56
+ if (!*shading)
57
+ rb_raise(rb_eException, "Unable to create shading");
58
+
59
+ return self;
60
+ }
61
+
62
+ void Init_shading()
63
+ {
64
+ shading_class = rb_define_class_under(module, "Shading", rb_cObject);
65
+ rb_define_alloc_func(shading_class, _cftype_alloc);
66
+
67
+ rb_define_method(shading_class, "_initialize_axial", shading_init_axial, 8);
68
+ }
data/ext/shading.h ADDED
@@ -0,0 +1,32 @@
1
+ /*
2
+ Copyright (c) 2006, The Omni Group, Inc. All rights reserved.
3
+
4
+ OPEN PERMISSION TO USE AND REPRODUCE OMNI SOURCE CODE SOFTWARE
5
+
6
+ Omni Source Code software is available from The Omni Group on their web
7
+ site at www.omnigroup.com.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a
10
+ copy of this software and associated documentation files (the "Software"),
11
+ to deal in the Software without restriction, including without limitation
12
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
13
+ and/or sell copies of the Software, and to permit persons to whom the
14
+ Software is furnished to do so, subject to the following conditions:
15
+
16
+ Any original copyright notices and this permission notice shall be included
17
+ in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
+ DEALINGS IN THE SOFTWARE.
26
+ */
27
+
28
+
29
+ extern void Init_shading(void);
30
+ extern VALUE shading_class;
31
+
32
+ extern CGShadingRef shading_get(VALUE self);
data/ext/size.c ADDED
@@ -0,0 +1,42 @@
1
+ /*
2
+ Copyright (c) 2006, The Omni Group, Inc. All rights reserved.
3
+
4
+ OPEN PERMISSION TO USE AND REPRODUCE OMNI SOURCE CODE SOFTWARE
5
+
6
+ Omni Source Code software is available from The Omni Group on their web
7
+ site at www.omnigroup.com.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a
10
+ copy of this software and associated documentation files (the "Software"),
11
+ to deal in the Software without restriction, including without limitation
12
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
13
+ and/or sell copies of the Software, and to permit persons to whom the
14
+ Software is furnished to do so, subject to the following conditions:
15
+
16
+ Any original copyright notices and this permission notice shall be included
17
+ in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
+ DEALINGS IN THE SOFTWARE.
26
+ */
27
+
28
+
29
+ #include "size.h"
30
+
31
+ VALUE size_class;
32
+
33
+ VALUE size_value_from_size(CGSize size)
34
+ {
35
+ VALUE wh[2] = {rb_float_new(size.width), rb_float_new(size.height)};
36
+ return rb_class_new_instance(2, wh, size_class);
37
+ }
38
+
39
+ void Init_size(void)
40
+ {
41
+ size_class = rb_define_class_under(module, "Size", rb_cObject);
42
+ }
data/ext/size.h ADDED
@@ -0,0 +1,32 @@
1
+ /*
2
+ Copyright (c) 2006, The Omni Group, Inc. All rights reserved.
3
+
4
+ OPEN PERMISSION TO USE AND REPRODUCE OMNI SOURCE CODE SOFTWARE
5
+
6
+ Omni Source Code software is available from The Omni Group on their web
7
+ site at www.omnigroup.com.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a
10
+ copy of this software and associated documentation files (the "Software"),
11
+ to deal in the Software without restriction, including without limitation
12
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
13
+ and/or sell copies of the Software, and to permit persons to whom the
14
+ Software is furnished to do so, subject to the following conditions:
15
+
16
+ Any original copyright notices and this permission notice shall be included
17
+ in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
+ DEALINGS IN THE SOFTWARE.
26
+ */
27
+
28
+
29
+ extern void Init_size(void);
30
+ extern VALUE size_class;
31
+
32
+ extern VALUE size_value_from_size(CGSize size);