fxruby 1.6.22.pre3-x86-mingw32 → 1.6.22.pre4-x86-mingw32

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.
data/lib/fox16/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Fox
2
2
  def Fox.fxrubyversion
3
- "1.6.22.pre3"
3
+ "1.6.22.pre4"
4
4
  end
5
5
  end
@@ -223,9 +223,6 @@ module Fox
223
223
  # The active top-level window, if any [FXWindow]
224
224
  attr_reader :activeWindow
225
225
 
226
- # The main window, if any [FXWindow]
227
- attr_reader :mainWindow
228
-
229
226
  # The window of the current modal loop [FXWindow]
230
227
  attr_reader :modalWindow
231
228
 
@@ -39,16 +39,20 @@ module Fox
39
39
 
40
40
  class FXImage < FXDrawable
41
41
 
42
- # Pixel data [FXMemoryBuffer]
42
+ # [deprecated] Pixel data [FXMemoryBuffer]
43
43
  attr_reader :data
44
44
 
45
+ # Array of colors of all image pixels. Can also be written as String of raw [RGBA] values.
46
+ attr_accessor :pixels
47
+
48
+
45
49
  # Option flags [Integer]
46
50
  attr_accessor :options
47
51
 
48
52
  #
49
53
  # Create an image. If a client-side pixel buffer has been specified,
50
- # the image does not own the pixel buffer unless the +IMAGE_OWNED+ flag is
51
- # set. If the +IMAGE_OWNED+ flag is set but a +nil+ pixel buffer is
54
+ # the image owns the pixel buffer.
55
+ # If the +IMAGE_OWNED+ flag is set but a +nil+ pixel buffer is
52
56
  # passed, a pixel buffer will be automatically created and will be owned
53
57
  # by the image. The flags +IMAGE_SHMI+ and +IMAGE_SHMP+ may be specified for
54
58
  # large images to instruct #render to use shared memory to communicate
@@ -57,7 +61,7 @@ module Fox
57
61
  # ==== Parameters:
58
62
  #
59
63
  # +a+:: an application instance [FXApp]
60
- # +pixels+:: pixels [Array of FXColor values]
64
+ # +pixels+:: pixels [Array of FXColor values or string of raw [RGBA] values]
61
65
  # +opts+:: image options [Integer]
62
66
  # +width+:: image width [Integer]
63
67
  # +height+:: image height [Integer]
@@ -65,6 +69,31 @@ module Fox
65
69
  def initialize(a, pixels=nil, opts=0, width=1, height=1) # :yields: theImage
66
70
  end
67
71
 
72
+ #
73
+ # Populate the image with new pixel data of the same size or of a new size
74
+ #
75
+ # Pixel data is copied and IMAGE_OWNED option is set.
76
+ # If called with +width+ and +height+, the size of the serverside representation
77
+ # of the image, if it exists, is adjusted but the contents are not updated yet.
78
+ # This can be done by calling render().
79
+ #
80
+ # ==== Parameters:
81
+ #
82
+ # +pixels+:: pixels [Array of FXColor values or string of raw [RGBA] values]
83
+ # +opts+:: image options [Integer]
84
+ # +width+:: image width [Integer]
85
+ # +height+:: image height [Integer]
86
+ #
87
+ def setPixels(pixels, opts=0, width=nil, height=nil)
88
+ end
89
+
90
+ #
91
+ # Return a String of the raw color representation of all image pixels.
92
+ #
93
+ # Image pixels are stored bytewise as [RGBA] values.
94
+ #
95
+ def pixel_string ; end
96
+
68
97
  #
69
98
  # Return the color of the pixel at (_x_, _y_).
70
99
  #
@@ -31,8 +31,9 @@ module Fox
31
31
  # +opts+:: options [Integer]
32
32
  # +width+:: width [Integer]
33
33
  # +height+:: height [Integer]
34
+ # +quality+:: JPEG image quality [Integer]
34
35
  #
35
- def initialize(a, pix=nil, clr=0, opts=0, width=1, height=1) # :yields: theJPGIcon
36
+ def initialize(a, pix=nil, clr=0, opts=0, width=1, height=1, quality=75) # :yields: theJPGIcon
36
37
  end
37
38
  end
38
39
  #
@@ -30,8 +30,9 @@ module Fox
30
30
  # +opts+:: options [Integer]
31
31
  # +width+:: width [Integer]
32
32
  # +height+:: height [Integer]
33
+ # +quality+:: JPEG image quality [Integer]
33
34
  #
34
- def initialize(a, pix=nil, opts=0, width=1, height=1) # :yields: theJPGImage
35
+ def initialize(a, pix=nil, opts=0, width=1, height=1, quality=75) # :yields: theJPGImage
35
36
  end
36
37
  end
37
38
  end
@@ -1,4 +1,5 @@
1
1
  module Fox
2
+ # This class is deprecated. Use FXImage methods instead.
2
3
  class FXMemoryBuffer
3
4
 
4
5
  #
@@ -55,29 +55,28 @@ public:
55
55
  * large images to instruct render() to use shared memory to communicate
56
56
  * with the server.
57
57
  */
58
- FXImage(FXApp* a,VALUE ary=Qnil,FXuint opts=0,FXint w=1,FXint h=1){
58
+ FXImage(FXApp* a,VALUE string_or_ary=Qnil,FXuint opts=0,FXint w=1,FXint h=1){
59
59
  FXColor* pix=0;
60
- if(!NIL_P(ary)){
61
- Check_Type(ary,T_ARRAY);
62
- if(FXMALLOC(&pix,FXColor,RARRAY_LEN(ary))){
63
- for(long i=0; i<RARRAY_LEN(ary); i++){
64
- pix[i]=static_cast<FXColor>(NUM2UINT(rb_ary_entry(ary,i)));
65
- }
66
- }
67
- opts&=IMAGE_OWNED;
60
+ if(!NIL_P(string_or_ary)){
61
+ FXuint len=FXRbNumberOfFXColors(string_or_ary);
62
+ if(w*h != len){
63
+ rb_raise( rb_eArgError, "Array size does not match image size" );
68
64
  }
69
- return new FXRbImage(a,pix,opts,w,h);
65
+ pix=FXRbConvertToFXColors(string_or_ary);
66
+ opts|=IMAGE_OWNED;
70
67
  }
68
+ return new FXRbImage(a,pix,opts,w,h);
69
+ }
71
70
 
72
71
  /// To get to the pixel data
73
72
  FXMemoryBuffer *getData() const {
74
73
  if(self->getData()){
75
74
  return new FXMemoryBuffer(self->getData(),self->getWidth()*self->getHeight());
76
- }
75
+ }
77
76
  else{
78
77
  return 0;
79
- }
80
78
  }
79
+ }
81
80
  }
82
81
 
83
82
  /// To get to the option flags
@@ -86,21 +85,51 @@ public:
86
85
  /// Change options
87
86
  void setOptions(FXuint opts);
88
87
 
89
- /**
90
- * Populate the image with new pixel data of the same size; it will assume
91
- * ownership of the pixel data if image IMAGE_OWNED option is passed.
92
- * The server-side representation of the image, if it exists, is not updated.
93
- * This can be done by calling render().
94
- */
95
- virtual void setData(FXColor *pix,FXuint opts=0);
96
-
97
- /**
98
- * Populate the image with new pixel data of a new size; it will assume ownership
99
- * of the pixel data if image IMAGE_OWNED option is passed. The size of the server-
100
- * side representation of the image, if it exists, is adjusted but the contents are
101
- * not updated yet. This can be done by calling render().
102
- */
103
- virtual void setData(FXColor *pix,FXuint opts,FXint w,FXint h);
88
+ %extend {
89
+ /**
90
+ * Populate the image with new pixel data of the same size; it will assume
91
+ * ownership of the pixel data if image IMAGE_OWNED option is passed.
92
+ * The server-side representation of the image, if it exists, is not updated.
93
+ * This can be done by calling render().
94
+ */
95
+ void setPixels(VALUE string_or_ary,FXuint opts=0,VALUE w=Qnil,VALUE h=Qnil){
96
+ FXuint len=FXRbNumberOfFXColors(string_or_ary);
97
+ if( ( (NIL_P(w) || NIL_P(h)) && self->getWidth()*self->getHeight() != len) ||
98
+ (!(NIL_P(w) || NIL_P(h)) && NUM2UINT(w)*NUM2UINT(h) != len)){
99
+ rb_raise( rb_eArgError, "Array size does not match image size" );
100
+ }
101
+
102
+ FXColor* pix=FXRbConvertToFXColors(string_or_ary);
103
+ opts|=IMAGE_OWNED;
104
+ if( NIL_P(w) || NIL_P(h) ){
105
+ self->setData(pix,opts);
106
+ }else{
107
+ self->setData(pix,opts,NUM2UINT(w),NUM2UINT(h));
108
+ }
109
+ }
110
+
111
+ VALUE pixels(){
112
+ FXColor* data = self->getData();
113
+ if (data) {
114
+ FXuint size = self->getWidth()*self->getHeight();
115
+ VALUE ary = rb_ary_new2(size);
116
+ for (int i = 0; i < size; i++)
117
+ rb_ary_store(ary, i, UINT2NUM(data[i]));
118
+ return ary;
119
+ } else {
120
+ return Qnil;
121
+ }
122
+ }
123
+
124
+ VALUE pixel_string(){
125
+ FXColor* data = self->getData();
126
+ if (data) {
127
+ return rb_str_new((char*)data, self->getWidth()*self->getHeight()*sizeof(FXColor));
128
+ } else {
129
+ return Qnil;
130
+ }
131
+ }
132
+ }
104
133
 
105
134
  /// Get pixel at x,y
106
135
  FXColor getPixel(FXint x,FXint y) const;
data/test/TC_FXImage.rb CHANGED
@@ -11,7 +11,7 @@ class TC_FXImage < Fox::TestCase
11
11
 
12
12
  def test_default_constructor_args_1
13
13
  img = FXImage.new(app)
14
- assert_same(nil, img.data)
14
+ assert_same(nil, img.pixels)
15
15
  assert_equal(0, img.options)
16
16
  assert_equal(1, img.width)
17
17
  assert_equal(1, img.height)
@@ -19,7 +19,7 @@ class TC_FXImage < Fox::TestCase
19
19
 
20
20
  def test_default_constructor_args_2
21
21
  img = FXImage.new(app, nil)
22
- assert_same(nil, img.data)
22
+ assert_same(nil, img.pixels)
23
23
  assert_equal(0, img.options)
24
24
  assert_equal(1, img.width)
25
25
  assert_equal(1, img.height)
@@ -27,7 +27,7 @@ class TC_FXImage < Fox::TestCase
27
27
 
28
28
  def test_default_constructor_args_3
29
29
  img = FXImage.new(app, nil, 0)
30
- assert_same(nil, img.data)
30
+ assert_same(nil, img.pixels)
31
31
  assert_equal(0, img.options)
32
32
  assert_equal(1, img.width)
33
33
  assert_equal(1, img.height)
@@ -35,7 +35,7 @@ class TC_FXImage < Fox::TestCase
35
35
 
36
36
  def test_default_constructor_args_4
37
37
  img = FXImage.new(app, nil, 0, 1)
38
- assert_same(nil, img.data)
38
+ assert_same(nil, img.pixels)
39
39
  assert_equal(0, img.options)
40
40
  assert_equal(1, img.width)
41
41
  assert_equal(1, img.height)
@@ -43,7 +43,7 @@ class TC_FXImage < Fox::TestCase
43
43
 
44
44
  def test_default_constructor_args_5
45
45
  img = FXImage.new(app, nil, 0, 1, 1)
46
- assert_same(nil, img.data)
46
+ assert_same(nil, img.pixels)
47
47
  assert_equal(0, img.options)
48
48
  assert_equal(1, img.width)
49
49
  assert_equal(1, img.height)
@@ -59,24 +59,57 @@ class TC_FXImage < Fox::TestCase
59
59
  assert_equal(IMAGE_OWNED, img.options)
60
60
  end
61
61
 
62
+ def test_setPixels
63
+ img = FXImage.new(app, nil, 0, 2, 2)
64
+ img.pixels = [0x12345678, 2, 3, 4]
65
+ assert_equal(IMAGE_OWNED, img.options)
66
+ assert_equal([0x12345678, 2, 3, 4], img.pixels)
67
+ end
68
+
69
+ def test_setPixels2
70
+ img = FXImage.new(app)
71
+ img.setPixels([0x12345678, 2], 0, 2, 1)
72
+ assert_equal(IMAGE_OWNED, img.options)
73
+ assert_equal([0x12345678, 2], img.pixels)
74
+ end
75
+
76
+ def test_setPixels_string
77
+ img = FXImage.new(app, nil, 0, 2, 1)
78
+ img.pixels = "rgbaRGBA"
79
+ assert_equal(IMAGE_OWNED, img.options)
80
+ assert_equal("rgbaRGBA", img.pixel_string)
81
+ end
82
+
62
83
  def test_create
63
84
  #
64
85
  # If the image owns its pixel data and IMAGE_KEEP was not specified,
65
86
  # the data should go away after we call create.
66
87
  #
67
88
  img = FXImage.new(app, nil, IMAGE_OWNED)
68
- assert_not_nil(img.data)
89
+ assert_not_nil(img.pixels)
69
90
  img.create
70
- assert_nil(img.data)
91
+ assert_nil(img.pixels)
71
92
 
72
93
  #
73
94
  # If the image owns its pixel data and IMAGE_KEEP was specified,
74
95
  # the data should stay after we call create.
75
96
  #
76
97
  img = FXImage.new(app, nil, IMAGE_KEEP|IMAGE_OWNED)
77
- assert_not_nil(img.data)
98
+ assert_not_nil(img.pixels)
99
+ img.create
100
+ assert_not_nil(img.pixels)
101
+ end
102
+
103
+ def test_create_with_data
104
+ img = FXImage.new(app, "rgbaRGBA", 0, 1, 2)
105
+ assert_equal("rgbaRGBA", img.pixel_string)
106
+ img.create
107
+ assert_nil(img.pixels)
108
+
109
+ img = FXImage.new(app, [0x12345678], IMAGE_KEEP|IMAGE_OWNED)
110
+ assert_equal([0x12345678], img.pixels)
78
111
  img.create
79
- assert_not_nil(img.data)
112
+ assert_not_nil(img.pixels)
80
113
  end
81
114
 
82
115
  #
@@ -90,10 +123,10 @@ class TC_FXImage < Fox::TestCase
90
123
  #
91
124
  img = FXImage.new(app)
92
125
  img.create
93
- assert_nil(img.data)
126
+ assert_nil(img.pixels)
94
127
  assert_equal(0, img.options&IMAGE_OWNED)
95
128
  img.restore
96
- assert_not_nil(img.data)
129
+ assert_not_nil(img.pixels)
97
130
  assert_not_equal(0, img.options&IMAGE_OWNED)
98
131
  end
99
132
 
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fxruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 854953483
4
+ hash: 1923831889
5
5
  prerelease: 7
6
6
  segments:
7
7
  - 1
8
8
  - 6
9
9
  - 22
10
10
  - pre
11
- - 3
12
- version: 1.6.22.pre3
11
+ - 4
12
+ version: 1.6.22.pre4
13
13
  platform: x86-mingw32
14
14
  authors:
15
15
  - Lyle Johnson
@@ -17,36 +17,36 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-02-09 00:00:00 Z
20
+ date: 2012-02-16 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
- name: rdoc
23
+ name: hoe
24
24
  prerelease: false
25
25
  requirement: &id001 !ruby/object:Gem::Requirement
26
26
  none: false
27
27
  requirements:
28
28
  - - ~>
29
29
  - !ruby/object:Gem::Version
30
- hash: 19
30
+ hash: 27
31
31
  segments:
32
- - 3
33
- - 10
34
- version: "3.10"
32
+ - 2
33
+ - 12
34
+ version: "2.12"
35
35
  type: :development
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
- name: hoe
38
+ name: rdoc
39
39
  prerelease: false
40
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- hash: 25
45
+ hash: 19
46
46
  segments:
47
- - 2
48
- - 13
49
- version: "2.13"
47
+ - 3
48
+ - 10
49
+ version: "3.10"
50
50
  type: :development
51
51
  version_requirements: *id002
52
52
  description: FXRuby is the Ruby binding to the FOX GUI toolkit.
@@ -1024,84 +1024,84 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1024
1024
  requirements: []
1025
1025
 
1026
1026
  rubyforge_project: fxruby
1027
- rubygems_version: 1.8.15
1027
+ rubygems_version: 1.8.11
1028
1028
  signing_key:
1029
1029
  specification_version: 3
1030
1030
  summary: FXRuby is the Ruby binding to the FOX GUI toolkit.
1031
1031
  test_files:
1032
- - test/TC_FXMenuRadio.rb
1033
- - test/TC_FXLight.rb
1034
- - test/TC_FXMainWindow.rb
1035
- - test/TC_FXFont.rb
1036
- - test/TC_FXMenuCheck.rb
1037
- - test/TC_FXAccelTable.rb
1038
- - test/TC_FXHiliteStyle.rb
1039
- - test/TC_FXTreeListBox.rb
1040
- - test/TC_FXComboBox.rb
1041
- - test/TC_FXVec2f.rb
1042
- - test/TC_FXDialogBox.rb
1043
- - test/TC_FXStream.rb
1044
- - test/TC_FXVec3d.rb
1045
- - test/TC_Misc.rb
1032
+ - test/TC_FXVec2d.rb
1033
+ - test/TC_FXListBox.rb
1034
+ - test/TC_FXCheckButton.rb
1035
+ - test/TC_FXVec4f.rb
1046
1036
  - test/TC_FXIconList.rb
1037
+ - test/TC_FXXPMIcon.rb
1038
+ - test/TC_FXSegment.rb
1047
1039
  - test/TC_FXMemoryStream.rb
1048
- - test/TC_FXExtentd.rb
1049
- - test/TC_downcast.rb
1050
- - test/TC_FXList.rb
1040
+ - test/TC_FXComboBox.rb
1051
1041
  - test/TC_FXShell.rb
1052
- - test/TC_FXRadioButton.rb
1053
- - test/TC_FXDCPrint.rb
1054
- - test/TC_FXTableItem.rb
1055
- - test/TC_FXIconDict.rb
1056
- - test/TC_FXXBMImage.rb
1057
- - test/TC_FXVec4f.rb
1058
- - test/TC_FXId.rb
1059
- - test/TC_FXQuatf.rb
1060
- - test/TC_FXTable.rb
1061
- - test/TC_FXSize.rb
1062
- - test/TC_FXVec3f.rb
1063
- - test/TC_FXViewport.rb
1064
- - test/TC_FXUndoList.rb
1065
- - test/TC_FXText.rb
1066
- - test/TC_FXMessageBox.rb
1067
- - test/TC_FXScrollArea.rb
1068
- - test/TC_FXTreeList.rb
1069
- - test/TC_FXVec2d.rb
1070
- - test/TC_FXSettings.rb
1042
+ - test/TC_FXRangef.rb
1043
+ - test/TC_FXTreeListBox.rb
1044
+ - test/TC_Misc.rb
1045
+ - test/TC_FXMaterial.rb
1046
+ - test/TC_FXMenuCommand.rb
1071
1047
  - test/TC_FXRectangle.rb
1048
+ - test/TC_FXGLShape.rb
1049
+ - test/TC_FXTreeList.rb
1072
1050
  - test/TC_FXGradientBar.rb
1073
- - test/TC_FXMaterial.rb
1051
+ - test/TC_FXUndoList.rb
1074
1052
  - test/TC_FXImage.rb
1075
- - test/TC_FXScrollWindow.rb
1076
- - test/TC_FXFileStream.rb
1077
- - test/TC_FXFoldingList.rb
1053
+ - test/TC_FXTableItem.rb
1054
+ - test/TC_FXVec3f.rb
1055
+ - test/TC_FXIconDict.rb
1056
+ - test/TC_FXStream.rb
1057
+ - test/TC_FXBMPImage.rb
1058
+ - test/TC_FXGLGroup.rb
1059
+ - test/TC_FXRanged.rb
1078
1060
  - test/TC_FXTopWindow.rb
1061
+ - test/TC_FXHiliteStyle.rb
1062
+ - test/TC_FXHeader.rb
1063
+ - test/TC_FXPoint.rb
1064
+ - test/TC_FXRegistry.rb
1065
+ - test/TC_FXFileStream.rb
1079
1066
  - test/TC_FXXBMIcon.rb
1080
- - test/TC_FXMenuCommand.rb
1081
- - test/TC_FXRegion.rb
1082
- - test/TC_FXRanged.rb
1083
- - test/TC_FXListBox.rb
1067
+ - test/TC_FXScrollArea.rb
1068
+ - test/TC_FXSettings.rb
1069
+ - test/TC_FXSize.rb
1070
+ - test/TC_FXApp.rb
1071
+ - test/TC_FXVec3d.rb
1072
+ - test/TC_FXExtentd.rb
1073
+ - test/TC_FXDC.rb
1074
+ - test/TC_FXMenuCheck.rb
1084
1075
  - test/TC_FXDCWindow.rb
1085
- - test/TC_FXSegment.rb
1076
+ - test/TC_FXFont.rb
1077
+ - test/TC_FXTable.rb
1078
+ - test/TC_FXMenuRadio.rb
1079
+ - test/TC_FXExtentf.rb
1080
+ - test/TC_FXFontDesc.rb
1081
+ - test/TC_FXGLViewer.rb
1082
+ - test/TC_FXViewport.rb
1086
1083
  - test/TC_FXArc.rb
1084
+ - test/TC_FXText.rb
1085
+ - test/TC_FXId.rb
1086
+ - test/TC_FXXPMImage.rb
1087
+ - test/TC_FXMessageBox.rb
1088
+ - test/TC_FXLight.rb
1089
+ - test/TC_FXVec2f.rb
1090
+ - test/TC_downcast.rb
1091
+ - test/TC_FXQuatf.rb
1092
+ - test/TC_FXRadioButton.rb
1093
+ - test/TC_FXDCPrint.rb
1094
+ - test/TC_FXRegion.rb
1095
+ - test/TC_FXFoldingList.rb
1087
1096
  - test/TC_FXMat4f.rb
1088
- - test/TC_FXCheckButton.rb
1089
- - test/TC_FXPoint.rb
1090
- - test/TC_FXRegistry.rb
1091
- - test/TC_FXDC.rb
1097
+ - test/TC_FXAccelTable.rb
1092
1098
  - test/TC_FXButton.rb
1099
+ - test/TC_FXList.rb
1100
+ - test/TC_FXDialogBox.rb
1101
+ - test/TC_FXBMPIcon.rb
1102
+ - test/TC_FXMainWindow.rb
1103
+ - test/TC_FXXBMImage.rb
1093
1104
  - test/TC_FXFileAssoc.rb
1094
- - test/TC_FXGLGroup.rb
1095
- - test/TC_FXBMPImage.rb
1105
+ - test/TC_FXScrollWindow.rb
1096
1106
  - test/TC_FXDirList.rb
1097
- - test/TC_FXBMPIcon.rb
1098
- - test/TC_FXGLViewer.rb
1099
- - test/TC_FXExtentf.rb
1100
- - test/TC_FXHeader.rb
1101
- - test/TC_FXGLShape.rb
1102
- - test/TC_FXXPMIcon.rb
1103
- - test/TC_FXFontDesc.rb
1104
- - test/TC_FXRangef.rb
1105
- - test/TC_FXXPMImage.rb
1106
- - test/TC_FXApp.rb
1107
1107
  - test/TC_FXDataTarget.rb