Skip to content

Commit

Permalink
docs: use Dimension and Size types in place of redundant custom types
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtcoolguy committed Dec 12, 2019
1 parent 6eef6c5 commit f906edd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 61 deletions.
34 changes: 5 additions & 29 deletions apidoc/Titanium/Blob.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,11 @@ methods:
since: {android: "3.0.0"}
parameters:
- name: options
summary: Image cropping options.
type: Dictionary<ImageAsCroppedDict>
summary: |
Image cropping options. <Dimension> properties are all optional for this use case.
Defaults will be to use the current image's `height`/`width` and to center the cropped rectangle horizontally/vertically on the original image (`x`/`y`).
type: Dimension
returns:
type: Titanium.Blob
summary: Cropped image as a blob.
Expand Down Expand Up @@ -237,30 +240,3 @@ methods:
returns:
type: Titanium.Blob
summary: The image with a transparent border in a blob, or `null` if this blob is not an image.
---
name: ImageAsCroppedDict
summary: Simple object used to specify options for [imageAsCropped](Titanium.Blob.imageAsCropped).
properties:
- name: width
type: Number
summary: Width to crop this image to.
optional: true
default: Current image width.

- name: height
type: Number
summary: Height to crop this image to.
optional: true
default: Current image height.

- name: x
type: Number
summary: Left coordinate of the cropped rectangle within the source image.
optional: true
default: Cropped rectangle is centered horizontally on the original image.

- name: y
type: Number
summary: Top coordinate of the cropped rectangle within the source image.
optional: true
default: Cropped rectangle is centered vertically on the original image.
38 changes: 6 additions & 32 deletions apidoc/Titanium/Media/Media.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1899,6 +1899,7 @@ properties:
summary: Whether or not the predicate is for an exact match. The
default is `true`.
type: Boolean
default: true

# Camera options pseudo-type
---
Expand Down Expand Up @@ -2108,11 +2109,12 @@ properties:
summary: The type of media, either `MEDIA_TYPE_PHOTO`, `MEDIA_TYPE_LIVEPHOTO` or `MEDIA_TYPE_VIDEO` defined in <Titanium.Media>.
type: String
- name: cropRect
summary: Simple object defining the user's selected crop rectangle, or `null` if the user has not edited the photo.
type: CropRectType
summary: Simple object defining the user's selected crop rectangle, or `null` if the user has not edited the photo. `width`/`height` values are assumed to be in pixels.
type: Dimension
optional: true
- name: previewRect
summary: Simple object defining the preview image size.
type: PreviewRectType
summary: Simple object defining the preview image size. This will be undefined when custom camera overlay is not used. Values are assumed to be in pixels.
type: Size
platforms: [android]
- name: success
summary: Indicates if the operation succeeded. Returns `true`.
Expand All @@ -2137,34 +2139,6 @@ properties:
since: "5.2.0"
osver: {ios: {min: "9.1"}}

# Arguably we might need a global Rect pseudotype. For now, define locally
---
name: CropRectType
summary: Simple object for describing the crop rectangle for an image.
properties:
- name: x
summary: X coordinate of the crop rectangle's upper-left corner.
type: Number
- name: y
summary: Y coordinate of the crop rectangle's upper-left corner.
type: Number
- name: width
summary: Width of the crop rectangle, in pixels.
type: Number
- name: height
summary: Height of the crop rectangle, in pixels.
type: Number
---
name: PreviewRectType
summary: |
Simple object for describing the preview image rectangle. This will be undefined when custom camera overlay is not used.
properties:
- name: width
summary: Width preview image, in pixels.
type: Number
- name: height
summary: Height preview image, in pixels.
type: Number
---
name: PreviewImageOptions
summary: Options passed to <Titanium.Media.previewImage>.
Expand Down

0 comments on commit f906edd

Please sign in to comment.