sketchup-api-stubs 0.1.2 → 0.2.0
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.
- checksums.yaml +4 -4
- data/SketchUp/Geom/BoundingBox.rb +17 -20
- data/SketchUp/Geom/Bounds2d.rb +172 -0
- data/SketchUp/Geom/LatLong.rb +31 -16
- data/SketchUp/Geom/OrientedBounds2d.rb +102 -0
- data/SketchUp/Geom/Point2d.rb +365 -0
- data/SketchUp/Geom/Point3d.rb +121 -110
- data/SketchUp/Geom/PolygonMesh.rb +30 -21
- data/SketchUp/Geom/Transformation.rb +8 -4
- data/SketchUp/Geom/Transformation2d.rb +125 -0
- data/SketchUp/Geom/UTM.rb +43 -37
- data/SketchUp/Geom/Vector2d.rb +497 -0
- data/SketchUp/Geom/Vector3d.rb +143 -131
- data/SketchUp/Layout.rb +25 -0
- data/SketchUp/Layout/AngularDimension.rb +569 -0
- data/SketchUp/Layout/AutoTextDefinition.rb +417 -0
- data/SketchUp/Layout/AutoTextDefinitions.rb +186 -0
- data/SketchUp/Layout/ConnectionPoint.rb +70 -0
- data/SketchUp/Layout/Document.rb +458 -0
- data/SketchUp/Layout/Ellipse.rb +29 -0
- data/SketchUp/Layout/Entities.rb +155 -0
- data/SketchUp/Layout/Entity.rb +363 -0
- data/SketchUp/Layout/FormattedText.rb +349 -0
- data/SketchUp/Layout/Grid.rb +131 -0
- data/SketchUp/Layout/Group.rb +261 -0
- data/SketchUp/Layout/Image.rb +86 -0
- data/SketchUp/Layout/Label.rb +371 -0
- data/SketchUp/Layout/Layer.rb +222 -0
- data/SketchUp/Layout/LayerInstance.rb +128 -0
- data/SketchUp/Layout/Layers.rb +232 -0
- data/SketchUp/Layout/LinearDimension.rb +563 -0
- data/SketchUp/Layout/LockedEntityError.rb +10 -0
- data/SketchUp/Layout/LockedLayerError.rb +11 -0
- data/SketchUp/Layout/Page.rb +187 -0
- data/SketchUp/Layout/PageInfo.rb +393 -0
- data/SketchUp/Layout/Pages.rb +216 -0
- data/SketchUp/Layout/Path.rb +326 -0
- data/SketchUp/Layout/Rectangle.rb +174 -0
- data/SketchUp/Layout/SketchUpModel.rb +522 -0
- data/SketchUp/Layout/Style.rb +1520 -0
- data/SketchUp/Layout/Table.rb +290 -0
- data/SketchUp/Layout/TableCell.rb +149 -0
- data/SketchUp/Layout/TableColumn.rb +139 -0
- data/SketchUp/Layout/TableRow.rb +135 -0
- data/SketchUp/Sketchup/Animation.rb +7 -4
- data/SketchUp/Sketchup/ArcCurve.rb +10 -10
- data/SketchUp/Sketchup/AttributeDictionaries.rb +13 -4
- data/SketchUp/Sketchup/AttributeDictionary.rb +12 -12
- data/SketchUp/Sketchup/Color.rb +68 -78
- data/SketchUp/Sketchup/ComponentDefinition.rb +60 -60
- data/SketchUp/Sketchup/ComponentInstance.rb +57 -55
- data/SketchUp/Sketchup/DefinitionList.rb +34 -17
- data/SketchUp/Sketchup/Drawingelement.rb +19 -21
- data/SketchUp/Sketchup/Edge.rb +22 -24
- data/SketchUp/Sketchup/Entities.rb +173 -162
- data/SketchUp/Sketchup/Entity.rb +71 -55
- data/SketchUp/Sketchup/Face.rb +45 -44
- data/SketchUp/Sketchup/Group.rb +47 -49
- data/SketchUp/Sketchup/Image.rb +16 -0
- data/SketchUp/Sketchup/ImageRep.rb +226 -0
- data/SketchUp/Sketchup/InstancePath.rb +13 -13
- data/SketchUp/Sketchup/Layer.rb +15 -17
- data/SketchUp/Sketchup/Material.rb +40 -30
- data/SketchUp/Sketchup/Materials.rb +40 -22
- data/SketchUp/Sketchup/Menu.rb +5 -5
- data/SketchUp/Sketchup/Model.rb +230 -228
- data/SketchUp/Sketchup/Page.rb +32 -0
- data/SketchUp/Sketchup/Pages.rb +3 -4
- data/SketchUp/Sketchup/RenderingOptions.rb +21 -16
- data/SketchUp/Sketchup/SectionPlane.rb +64 -0
- data/SketchUp/Sketchup/Selection.rb +20 -28
- data/SketchUp/Sketchup/ShadowInfo.rb +14 -14
- data/SketchUp/Sketchup/Text.rb +24 -26
- data/SketchUp/Sketchup/Texture.rb +28 -12
- data/SketchUp/Sketchup/Vertex.rb +14 -11
- data/SketchUp/Sketchup/View.rb +126 -116
- data/SketchUp/UI/Command.rb +17 -17
- data/SketchUp/UI/HtmlDialog.rb +8 -5
- data/SketchUp/UI/Notification.rb +1 -1
- data/SketchUp/UI/Toolbar.rb +13 -14
- data/SketchUp/UI/WebDialog.rb +55 -59
- data/SketchUp/_top_level.rb +139 -27
- data/SketchUp/{Array.rb → array.rb} +167 -30
- data/SketchUp/{Geom.rb → geom.rb} +9 -7
- data/SketchUp/{LanguageHandler.rb → languagehandler.rb} +15 -15
- data/SketchUp/{Length.rb → length.rb} +15 -15
- data/SketchUp/{Numeric.rb → numeric.rb} +19 -19
- data/SketchUp/sketchup.rb +167 -156
- data/SketchUp/{SketchupExtension.rb → sketchupextension.rb} +27 -27
- data/SketchUp/{String.rb → string.rb} +1 -1
- data/SketchUp/ui.rb +113 -87
- metadata +46 -9
data/SketchUp/Sketchup/Group.rb
CHANGED
@@ -25,10 +25,10 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
25
25
|
# group.entities.add_line([0,0,0],[100,100,100])
|
26
26
|
# status = group.add_observer observer
|
27
27
|
#
|
28
|
-
# @param observer
|
28
|
+
# @param [Object] observer
|
29
29
|
# An observer.
|
30
30
|
#
|
31
|
-
# @return true if successful, false if unsuccessful.
|
31
|
+
# @return [Boolean] true if successful, false if unsuccessful.
|
32
32
|
#
|
33
33
|
# @version SketchUp 6.0
|
34
34
|
def add_observer(observer)
|
@@ -43,7 +43,7 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
43
43
|
# group.entities.add_line([0,0,0],[100,100,100])
|
44
44
|
# group2 = group.copy
|
45
45
|
#
|
46
|
-
# @return
|
46
|
+
# @return [Sketchup::Group] a new Group object
|
47
47
|
#
|
48
48
|
# @version SketchUp 6.0
|
49
49
|
def copy
|
@@ -56,7 +56,7 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
56
56
|
# group = Sketchup.active_model.entities.add_group
|
57
57
|
# definition = group.definition
|
58
58
|
#
|
59
|
-
# @return
|
59
|
+
# @return [Sketchup::ComponentDefinition] a ComponentDefinition object if
|
60
60
|
# successful
|
61
61
|
#
|
62
62
|
# @version SketchUp 2015
|
@@ -86,7 +86,7 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
86
86
|
# group.description = "This is a Group with a 2d Face"
|
87
87
|
# description = group.description
|
88
88
|
#
|
89
|
-
# @return
|
89
|
+
# @return [String] a string description if successful
|
90
90
|
#
|
91
91
|
# @version SketchUp 6.0
|
92
92
|
def description
|
@@ -121,10 +121,10 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
121
121
|
# UI.messagebox "Failure"
|
122
122
|
# end
|
123
123
|
#
|
124
|
-
# @param description
|
124
|
+
# @param [String] description
|
125
125
|
# A string description.
|
126
126
|
#
|
127
|
-
# @return
|
127
|
+
# @return [String] the new description if successful
|
128
128
|
#
|
129
129
|
# @version SketchUp 6.0
|
130
130
|
def description=(description)
|
@@ -158,7 +158,7 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
158
158
|
# UI.messagebox "Failure"
|
159
159
|
# end
|
160
160
|
#
|
161
|
-
# @return
|
161
|
+
# @return [Sketchup::Entities] an Entities object if successful
|
162
162
|
#
|
163
163
|
# @version SketchUp 6.0
|
164
164
|
def entities
|
@@ -173,11 +173,10 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
173
173
|
# group2 = entities[1]
|
174
174
|
# status = group1.equals?(group2)
|
175
175
|
#
|
176
|
-
# @param group
|
176
|
+
# @param [Sketchup::Group] group
|
177
177
|
# The group to compare this group with.
|
178
178
|
#
|
179
|
-
# @return
|
180
|
-
# equivalent. Otherwise false.
|
179
|
+
# @return [Boolean]
|
181
180
|
#
|
182
181
|
# @return [Boolean]
|
183
182
|
#
|
@@ -199,7 +198,7 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
199
198
|
# UI.messagebox "Failure"
|
200
199
|
# end
|
201
200
|
#
|
202
|
-
# @return An array of entity objects if successful, false if
|
201
|
+
# @return [Array<Sketchup::Drawingelement>] An array of entity objects if successful, false if
|
203
202
|
# unsuccessful.
|
204
203
|
#
|
205
204
|
# @version SketchUp 6.0
|
@@ -215,7 +214,7 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
215
214
|
# group.entities.add_line([0,0,0],[100,100,100])
|
216
215
|
# guid = group.guid
|
217
216
|
#
|
218
|
-
# @return
|
217
|
+
# @return [String] a unique 22 character string
|
219
218
|
#
|
220
219
|
# @version SketchUp 2014
|
221
220
|
def guid
|
@@ -231,10 +230,10 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
231
230
|
# group2 = entities[1]
|
232
231
|
# result = group1.intersect(group2)
|
233
232
|
#
|
234
|
-
# @param group
|
233
|
+
# @param [Sketchup::Group, Sketchup::ComponentInstance] group
|
235
234
|
# The group to intersect this group with.
|
236
235
|
#
|
237
|
-
# @return
|
236
|
+
# @return [Sketchup::Group, nil] The resultant group if the two objects
|
238
237
|
# (this and arg) represent manifold solids and the
|
239
238
|
# operation succeeds. Otherwise nil is returned.
|
240
239
|
#
|
@@ -260,7 +259,7 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
260
259
|
# group.transform! transformation
|
261
260
|
# local_bounds_2 = group.local_bounds
|
262
261
|
#
|
263
|
-
# @return
|
262
|
+
# @return [Geom::BoundingBox] a BoundingBox object
|
264
263
|
#
|
265
264
|
# @version SketchUp 7.0
|
266
265
|
def local_bounds
|
@@ -276,7 +275,7 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
276
275
|
#
|
277
276
|
# @param [Boolean] lock
|
278
277
|
#
|
279
|
-
# @return
|
278
|
+
# @return [Boolean] true if the group is locked, false if not
|
280
279
|
#
|
281
280
|
# @version SketchUp 6.0
|
282
281
|
def locked=(lock)
|
@@ -300,7 +299,7 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
300
299
|
# status = group.locked?
|
301
300
|
# UI.messagebox status
|
302
301
|
#
|
303
|
-
# @return
|
302
|
+
# @return [Boolean]
|
304
303
|
#
|
305
304
|
# @return [Boolean]
|
306
305
|
#
|
@@ -325,7 +324,7 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
325
324
|
# puts "This should not happen since we made the groups unique"
|
326
325
|
# end
|
327
326
|
#
|
328
|
-
# @return
|
327
|
+
# @return [Sketchup::Group] the unique group
|
329
328
|
#
|
330
329
|
# @version SketchUp 6.0
|
331
330
|
def make_unique
|
@@ -340,8 +339,7 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
340
339
|
# group = entities.add_instance(definition, transformation)
|
341
340
|
# status = group.manifold?
|
342
341
|
#
|
343
|
-
# @return
|
344
|
-
# false if the group is not manifold.
|
342
|
+
# @return [Boolean]
|
345
343
|
#
|
346
344
|
# @return [Boolean]
|
347
345
|
#
|
@@ -385,10 +383,10 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
385
383
|
# UI.messagebox "Failure"
|
386
384
|
# end
|
387
385
|
#
|
388
|
-
# @param transform
|
386
|
+
# @param [Geom::Transformation] transform
|
389
387
|
# A Transformation object.
|
390
388
|
#
|
391
|
-
# @return
|
389
|
+
# @return [Sketchup::Group] the transformed Group object if successful
|
392
390
|
#
|
393
391
|
# @version SketchUp 6.0
|
394
392
|
def move!(transform)
|
@@ -403,7 +401,7 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
403
401
|
# group.name = "A Line"
|
404
402
|
# name = group.name
|
405
403
|
#
|
406
|
-
# @return
|
404
|
+
# @return [String] The name of the group if successful
|
407
405
|
#
|
408
406
|
# @version SketchUp 6.0
|
409
407
|
def name
|
@@ -418,10 +416,10 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
418
416
|
# group.name = "A Line"
|
419
417
|
# name = group.name
|
420
418
|
#
|
421
|
-
# @param name
|
419
|
+
# @param [String] name
|
422
420
|
# A string name.
|
423
421
|
#
|
424
|
-
# @return
|
422
|
+
# @return [String] a new name if successful
|
425
423
|
#
|
426
424
|
# @version SketchUp 6.0
|
427
425
|
def name=(name)
|
@@ -437,10 +435,10 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
437
435
|
# group2 = entities[1]
|
438
436
|
# result = group1.outer_shell(group2)
|
439
437
|
#
|
440
|
-
# @param group
|
438
|
+
# @param [Sketchup::Group, Sketchup::ComponentInstance] group
|
441
439
|
# The group to outer shell this group with.
|
442
440
|
#
|
443
|
-
# @return
|
441
|
+
# @return [Sketchup::Group, nil] The resultant group if the two objects
|
444
442
|
# (this and arg) represent manifold solids and the
|
445
443
|
# operation succeeds otherwise nil is returned.
|
446
444
|
#
|
@@ -459,10 +457,10 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
459
457
|
# end
|
460
458
|
# end
|
461
459
|
#
|
462
|
-
# @param observer
|
460
|
+
# @param [Object] observer
|
463
461
|
# An observer.
|
464
462
|
#
|
465
|
-
# @return true if successful, false if unsuccessful.
|
463
|
+
# @return [Boolean] true if successful, false if unsuccessful.
|
466
464
|
#
|
467
465
|
# @version SketchUp 6.0
|
468
466
|
def remove_observer(observer)
|
@@ -486,14 +484,14 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
486
484
|
# group2 = entities[1]
|
487
485
|
# status = group1.show_differences(group2, true)
|
488
486
|
#
|
489
|
-
# @param group
|
487
|
+
# @param [Sketchup::Group, Sketchup::ComponentInstance] group
|
490
488
|
# The group to be compared with.
|
491
489
|
#
|
492
|
-
# @param verbose
|
490
|
+
# @param [Boolean] verbose
|
493
491
|
# A boolean flag indicating whether to display a textural
|
494
492
|
# report of the found differences to the Ruby console.
|
495
493
|
#
|
496
|
-
# @return
|
494
|
+
# @return [Boolean] true if the groups are geometrically
|
497
495
|
# equivalent. Otherwise false.
|
498
496
|
#
|
499
497
|
# @version SketchUp 8.0
|
@@ -511,11 +509,11 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
511
509
|
# group2 = entities[1]
|
512
510
|
# result = group1.split(group2)
|
513
511
|
#
|
514
|
-
# @param group
|
512
|
+
# @param [Sketchup::Group, Sketchup::ComponentInstance] group
|
515
513
|
# The group to split this group with.
|
516
514
|
#
|
517
|
-
# @return
|
518
|
-
#
|
515
|
+
# @return [Array(Sketchup::Group, Sketchup::Group, Sketchup::Group), nil] A vector (array) of the three resultant groups
|
516
|
+
# If the two objects (this and arg) represent manifold
|
519
517
|
# solids and the operation succeeds otherwise nil is
|
520
518
|
# returned. The 3 groups are as follows:
|
521
519
|
# The intersection of volume 1 & volume 2,
|
@@ -536,10 +534,10 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
536
534
|
# group2 = entities[1]
|
537
535
|
# result = group1.subtract(group2)
|
538
536
|
#
|
539
|
-
# @param group
|
537
|
+
# @param [Sketchup::Group, Sketchup::ComponentInstance] group
|
540
538
|
# The group to subtract this group from.
|
541
539
|
#
|
542
|
-
# @return
|
540
|
+
# @return [Sketchup::Group, nil] The resultant group if the two objects
|
543
541
|
# (this and arg) represent manifold solids and the
|
544
542
|
# operation succeeds. Otherwise nil is returned.
|
545
543
|
#
|
@@ -558,7 +556,7 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
558
556
|
# # change the group to a component instance
|
559
557
|
# group.to_component
|
560
558
|
#
|
561
|
-
# @return
|
559
|
+
# @return [Sketchup::ComponentInstance] the new ComponentInstance object
|
562
560
|
#
|
563
561
|
# @version SketchUp 6.0
|
564
562
|
def to_component
|
@@ -596,10 +594,10 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
596
594
|
# UI.messagebox "Failure"
|
597
595
|
# end
|
598
596
|
#
|
599
|
-
# @param transform
|
597
|
+
# @param [Geom::Transformation] transform
|
600
598
|
# A Transformation object.
|
601
599
|
#
|
602
|
-
# @return
|
600
|
+
# @return [Sketchup::Group] a transformed group object if successful
|
603
601
|
#
|
604
602
|
# @version SketchUp 6.0
|
605
603
|
def transform!(transform)
|
@@ -615,7 +613,7 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
615
613
|
#
|
616
614
|
# trans = group.transformation
|
617
615
|
#
|
618
|
-
# @return
|
616
|
+
# @return [Geom::Transformation] a Transformation object if successful
|
619
617
|
#
|
620
618
|
# @version SketchUp 6.0
|
621
619
|
def transformation
|
@@ -632,10 +630,10 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
632
630
|
# new_transform = Geom::Transformation.new([100,0,0])
|
633
631
|
# group.transformation = new_transform
|
634
632
|
#
|
635
|
-
# @param transform
|
633
|
+
# @param [Geom::Transformation] transform
|
636
634
|
# The Transformation object to apply
|
637
635
|
#
|
638
|
-
# @return
|
636
|
+
# @return [Geom::Transformation] the applied transformation
|
639
637
|
#
|
640
638
|
# @version SketchUp 6.0
|
641
639
|
def transformation=(transform)
|
@@ -652,10 +650,10 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
652
650
|
# group2 = entities[1]
|
653
651
|
# result = group1.trim(group2)
|
654
652
|
#
|
655
|
-
# @param group
|
653
|
+
# @param [Sketchup::Group, Sketchup::ComponentInstance] group
|
656
654
|
# The group to trim this group against.
|
657
655
|
#
|
658
|
-
# @return
|
656
|
+
# @return [Sketchup::Group, nil] The resultant group if the two objects
|
659
657
|
# (this and arg) represent manifold solids and the
|
660
658
|
# operation succeeds otherwise nil is returned.
|
661
659
|
#
|
@@ -673,10 +671,10 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
673
671
|
# group2 = entities[1]
|
674
672
|
# result = group1.union(group2)
|
675
673
|
#
|
676
|
-
# @param group
|
674
|
+
# @param [Sketchup::Group, Sketchup::ComponentInstance] group
|
677
675
|
# The group to union this group with.
|
678
676
|
#
|
679
|
-
# @return
|
677
|
+
# @return [Sketchup::Group, nil] The resultant group if the two objects
|
680
678
|
# (this and arg) represent manifold solids and the
|
681
679
|
# operation succeeds. Otherwise nil is returned.
|
682
680
|
#
|
@@ -694,7 +692,7 @@ class Sketchup::Group < Sketchup::Drawingelement
|
|
694
692
|
# group = entities.add_instance(definition, transformation)
|
695
693
|
# volume = group.volume
|
696
694
|
#
|
697
|
-
# @return
|
695
|
+
# @return [Float] If the group represents a manifold volume,
|
698
696
|
# volume will be a positive value. If volume is negative,
|
699
697
|
# the group is not manifold.
|
700
698
|
#
|
data/SketchUp/Sketchup/Image.rb
CHANGED
@@ -81,6 +81,22 @@ class Sketchup::Image < Sketchup::Drawingelement
|
|
81
81
|
def height=(height)
|
82
82
|
end
|
83
83
|
|
84
|
+
# The {#image_rep} method returns a copy of a {Sketchup::ImageRep} object
|
85
|
+
# representing the pixel data.
|
86
|
+
#
|
87
|
+
# @example
|
88
|
+
# model = Sketchup.active_model
|
89
|
+
# path = "Plugins/su_dynamiccomponents/images"
|
90
|
+
# image_file = Sketchup.find_support_file("report_tool.png", path)
|
91
|
+
# image = model.active_entities.add_image(image_file, ORIGIN, 300)
|
92
|
+
# image_rep = image.image_rep
|
93
|
+
#
|
94
|
+
# @return [Sketchup::ImageRep]
|
95
|
+
#
|
96
|
+
# @version SketchUp 2018
|
97
|
+
def image_rep
|
98
|
+
end
|
99
|
+
|
84
100
|
# The normal method is used to retrieve the 3D Vector that is perpendicular to
|
85
101
|
# the plane of the image.
|
86
102
|
#
|
@@ -0,0 +1,226 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# References an image representation object.
|
5
|
+
#
|
6
|
+
# @version SketchUp 2018
|
7
|
+
class Sketchup::ImageRep
|
8
|
+
|
9
|
+
# Instance Methods
|
10
|
+
|
11
|
+
# The {#bits_per_pixel} method gets the number of bits per pixel in the
|
12
|
+
# image.
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# image_rep = Sketchup::ImageRep.new
|
16
|
+
# image_rep.load_file("/path/to/image.jpg")
|
17
|
+
# bpp = image_rep.bits_per_pixel
|
18
|
+
#
|
19
|
+
# @return [Integer]
|
20
|
+
#
|
21
|
+
# @version SketchUp 2018
|
22
|
+
def bits_per_pixel
|
23
|
+
end
|
24
|
+
|
25
|
+
# The {#color_at_uv} method returns a color corresponding to the UV texture
|
26
|
+
# coordinates
|
27
|
+
#
|
28
|
+
# @example
|
29
|
+
# image_rep = Sketchup::ImageRep.new
|
30
|
+
# image_rep.load_file("/path/to/image.jpg")
|
31
|
+
# color = image_rep.color_at_uv(0.7, 0.5, false)
|
32
|
+
#
|
33
|
+
# @param [Float] v
|
34
|
+
# The V texture coordinate.
|
35
|
+
#
|
36
|
+
# @param [Boolean] bilinear
|
37
|
+
# Use bilinear texture filtering. This
|
38
|
+
# interpolates the colors instead of picking
|
39
|
+
# the nearest neighbor.
|
40
|
+
#
|
41
|
+
# @param [Float] u
|
42
|
+
# The U texture coordinate.
|
43
|
+
#
|
44
|
+
# @return [Sketchup::Color, nil]
|
45
|
+
#
|
46
|
+
# @version SketchUp 2018
|
47
|
+
def color_at_uv(u, v, bilinear = false)
|
48
|
+
end
|
49
|
+
|
50
|
+
# The {#colors} method returns an array of {Sketchup::Color} for each pixel in
|
51
|
+
# the image.
|
52
|
+
#
|
53
|
+
# @example
|
54
|
+
# image_rep = Sketchup::ImageRep.new
|
55
|
+
# image_rep.load_file("/path/to/image.jpg")
|
56
|
+
# colors = image_rep.colors
|
57
|
+
#
|
58
|
+
# @return [Array<Sketchup::Color>, nil]
|
59
|
+
#
|
60
|
+
# @version SketchUp 2018
|
61
|
+
def colors
|
62
|
+
end
|
63
|
+
|
64
|
+
# The {#data} method gets the pixel data for an image in a string of bytes.
|
65
|
+
#
|
66
|
+
# @example
|
67
|
+
# image_rep = Sketchup::ImageRep.new
|
68
|
+
# image_rep.load_file("/path/to/image.jpg")
|
69
|
+
# byte_string = image_rep.data
|
70
|
+
# byte_string.each_byte { |byte| puts byte, ' ' }
|
71
|
+
#
|
72
|
+
# @return [String, nil]
|
73
|
+
#
|
74
|
+
# @version SketchUp 2018
|
75
|
+
def data
|
76
|
+
end
|
77
|
+
|
78
|
+
# The {#height} method returns the height of an image.
|
79
|
+
#
|
80
|
+
# @example
|
81
|
+
# image_rep = Sketchup::ImageRep.new
|
82
|
+
# image_rep.load_file("/path/to/image.jpg")
|
83
|
+
# image_rep.height
|
84
|
+
#
|
85
|
+
# @return [Integer]
|
86
|
+
#
|
87
|
+
# @version SketchUp 2018
|
88
|
+
def height
|
89
|
+
end
|
90
|
+
|
91
|
+
# The {#initialize} method creates a new image object. The image object will
|
92
|
+
# have no data if a path to the image is not provided.
|
93
|
+
#
|
94
|
+
# @example Default constructor
|
95
|
+
# image_rep = Sketchup::ImageRep.new
|
96
|
+
#
|
97
|
+
# @example Construct from file
|
98
|
+
# image_rep = Sketchup::ImageRep.new("/path/to/image.jpg")
|
99
|
+
#
|
100
|
+
# @overload initialize(filepath)
|
101
|
+
#
|
102
|
+
# @param [String] filepath
|
103
|
+
#
|
104
|
+
# @overload initialize
|
105
|
+
#
|
106
|
+
#
|
107
|
+
# @raise [ArgumentError] if the file path or image is invalid.
|
108
|
+
#
|
109
|
+
# @return [Sketchup::ImageRep]
|
110
|
+
#
|
111
|
+
# @version SketchUp 2018
|
112
|
+
def initialize(*args)
|
113
|
+
end
|
114
|
+
|
115
|
+
# The {#load_file} method loads image data from the specified file.
|
116
|
+
#
|
117
|
+
# @example
|
118
|
+
# image_rep = Sketchup::ImageRep.new
|
119
|
+
# image_rep.load_file("/path/to/image.jpg")
|
120
|
+
#
|
121
|
+
# @param [String] filepath
|
122
|
+
#
|
123
|
+
# @raise [ArgumentError] if the filepath or image is invalid.
|
124
|
+
#
|
125
|
+
# @version SketchUp 2018
|
126
|
+
def load_file(filepath)
|
127
|
+
end
|
128
|
+
|
129
|
+
# The {#row_padding} method returns the size of the row padding of an image
|
130
|
+
# in bytes.
|
131
|
+
#
|
132
|
+
# @example
|
133
|
+
# image_rep = Sketchup::ImageRep.new
|
134
|
+
# image_rep.load_file("/path/to/image.jpg")
|
135
|
+
# image_rep.row_padding
|
136
|
+
#
|
137
|
+
# @return [Integer]
|
138
|
+
#
|
139
|
+
# @version SketchUp 2018
|
140
|
+
def row_padding
|
141
|
+
end
|
142
|
+
|
143
|
+
# The {#save_file} method saves an image data object to an image file
|
144
|
+
# specified by a path.
|
145
|
+
#
|
146
|
+
# @example
|
147
|
+
# image_rep = Sketchup::ImageRep.new
|
148
|
+
# image_rep.load_file("/path/to/image1.jpg")
|
149
|
+
# # do stuff with the image representation
|
150
|
+
# image_rep.save_file("/path/to/save/image2.jpg")
|
151
|
+
#
|
152
|
+
# @param [String] filepath
|
153
|
+
#
|
154
|
+
# @version SketchUp 2018
|
155
|
+
def save_file(filepath)
|
156
|
+
end
|
157
|
+
|
158
|
+
# The {#set_data} method sets the pixel data of the {Sketchup::ImageRep}.
|
159
|
+
#
|
160
|
+
# @example Setting new data
|
161
|
+
# image_rep = Sketchup::ImageRep.new
|
162
|
+
# image_rep.load_file("/path/to/image.jpg")
|
163
|
+
# new_image_rep = image_rep.set_data(800, 600, 24, 0, pixel_data)
|
164
|
+
#
|
165
|
+
# @note The encoding of the pixel_data {String} parameter should be ASCII-8BIT.
|
166
|
+
# Any other encoding could corrupt the binary data.
|
167
|
+
#
|
168
|
+
# @param [Integer] height
|
169
|
+
# The height of the pixel data.
|
170
|
+
# Must be greater than 0.
|
171
|
+
#
|
172
|
+
# @param [Integer] width
|
173
|
+
# The width of the pixel data. Must be greater than 0.
|
174
|
+
#
|
175
|
+
# @param [Integer] row_padding
|
176
|
+
# The row padding for the pixel data which is
|
177
|
+
# sized in bytes. Row padding is used to pad each row with zeros so that each
|
178
|
+
# scanline on the pixel data will end on the data-type boundry.
|
179
|
+
#
|
180
|
+
# @param [Integer] bits_per_pixel
|
181
|
+
# The bits per pixel for the pixel data.
|
182
|
+
# Must be either 8/24/32.
|
183
|
+
#
|
184
|
+
# @param [String] pixel_data
|
185
|
+
# The binary string containing the pixel data
|
186
|
+
# representing the new image.
|
187
|
+
#
|
188
|
+
# @raise [TypeError] If width, height, bits_per_pixel or pixel_data are wrong
|
189
|
+
# data types.
|
190
|
+
#
|
191
|
+
# @raise [ArgumentError] If width, height, bits_per_pixel or pixel_data are
|
192
|
+
# invalid.
|
193
|
+
#
|
194
|
+
# @return [Sketchup::ImageRep]
|
195
|
+
#
|
196
|
+
# @version SketchUp 2018
|
197
|
+
def set_data(width, height, bits_per_pixel, row_padding, pixel_data)
|
198
|
+
end
|
199
|
+
|
200
|
+
# The {#size} method gets the total size of the image data in bytes.
|
201
|
+
#
|
202
|
+
# @example
|
203
|
+
# image_rep = Sketchup::ImageRep.new
|
204
|
+
# image_rep.load_file("/path/to/image.jpg")
|
205
|
+
# data_size = image_rep.size
|
206
|
+
#
|
207
|
+
# @return [Integer]
|
208
|
+
#
|
209
|
+
# @version SketchUp 2018
|
210
|
+
def size
|
211
|
+
end
|
212
|
+
|
213
|
+
# The {#width} method returns the width of an image.
|
214
|
+
#
|
215
|
+
# @example
|
216
|
+
# image_rep = Sketchup::ImageRep.new
|
217
|
+
# image_rep.load_file("/path/to/image.jpg")
|
218
|
+
# image_rep.width
|
219
|
+
#
|
220
|
+
# @return [Integer]
|
221
|
+
#
|
222
|
+
# @version SketchUp 2018
|
223
|
+
def width
|
224
|
+
end
|
225
|
+
|
226
|
+
end
|