Platforms to show: All Mac Windows Linux Cross-Platform

Back to CGRectMBS class.

CGRectMBS.ApplyAffineTransform(a as CGAffineTransformMBS) as CGRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 9.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Applies an affine transform to the rectangle and returns the result.
Example
dim af as CGAffineTransformMBS = CGAffineTransformMBS.Identity

MsgBox str(af.A)+" "+str(af.b)+" "+str(af.c)+" "+str(af.d)+" "+str(af.tx)+" "+str(af.ty)

af = af.Scale( 1, -1 )

MsgBox str(af.A)+" "+str(af.b)+" "+str(af.c)+" "+str(af.d)+" "+str(af.tx)+" "+str(af.ty)

af = af.Translate( 0, 100 )

MsgBox str(af.A)+" "+str(af.b)+" "+str(af.c)+" "+str(af.d)+" "+str(af.tx)+" "+str(af.ty)

dim r1 as CGRectMBS
dim r2 as CGRectMBS

r1=CGMakeRectMBS(100,100,100,100)

r2=r1.ApplyAffineTransform(af)

MsgBox "("+str(r1.Left)+", "+str(r1.top)+", "+str(r1.width)+", "+str(r1.height)+") => ("+str(r2.Left)+", "+str(r2.top)+", "+str(r2.width)+", "+str(r2.height)+")"

Returns nil on any error.

CGRectMBS.Binary as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the internal data of the object as a CGRect for use on Toolbox calls.
Example
dim c as CGRectMBS
dim m as MemoryBlock

c=CGMakeRectMBS(10,20,30,40)

m=c.Binary

MsgBox str(m.Size) // 16
MsgBox str(m.doubleValue( 0)) // 10
MsgBox str(m.doubleValue( 4)) // 20
MsgBox str(m.doubleValue( 8)) // 30
MsgBox str(m.doubleValue(12)) // 40

CGRectMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
The constructor to create a zero rectangle.

See also:

CGRectMBS.Constructor(p as Ptr)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 17.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a new instance using data at the pointer.

Make sure the pointer is valid and has the right data and size.

See also:

CGRectMBS.Constructor(source as CGRectMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a new CGRectMBS object by copying the values.

See also:

CGRectMBS.Constructor(x as Double, y as Double, width as Double, height as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a new CGRectMBS object with the given values.

See also:

CGRectMBS.ContainsPoint(r as CGPointMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return true if 'point' is contained in the rect, false otherwise.

CGRectMBS.ContainsRect(r as CGRectMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return true if 'rect2' is contained in 'rect1', false otherwise.

'rect2' is contained in 'rect1' if the union of 'rect1' and 'rect2' is equal to 'rect1'.
(rect1 is the current rect and rect2 the rect you pass to this function)

CGRectMBS.Divide(byref slice as CGRectMBS, byref remainder as CGRectMBS, amount as Double, edge as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Divides the rectangle.

Make two new rectangles, 'slice' and 'remainder', by dividing the rect with a line that's parallel to one of its sides, specified by 'edge' -- either 'CGRectMinXEdge', 'CGRectMinYEdge', 'CGRectMaxXEdge', or 'CGRectMaxYEdge'. The size of 'slice' is determined by 'amount', which measures the distance from the specified edge.

CGRectMBS.Equal(r as CGRectMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns true if both rectangles are equal.

CGRectMBS.Inset(dx as Double, dy as Double) as CGRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Inset the rect by '(dx, dy)' -- i.e., offset its origin by '(dx, dy)', and decrease its size by '(2*dx, 2*dy)'

CGRectMBS.Integral as CGRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Expand the rect to the smallest rect containing it with integral origin and size.

CGRectMBS.Intersection(r as CGRectMBS) as CGRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the intersection of both rectangles.

This may return a null rect.

CGRectMBS.IntersectsRect(r as CGRectMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return true if 'rect1' intersects 'rect2', false otherwise.

'rect1' intersect 'rect2' if the intersection of 'rect1' and 'rect2' is not the null rect.

CGRectMBS.IsEmpty as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return true if the rect is empty -- i.e., if it has zero width or height.

A null rect is defined to be empty.

CGRectMBS.IsInfinite as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns whether a rectangle is infinite.

Returns true if the specified rectangle is infinite, false otherwise.

An infinite rectangle is one that has no defined bounds. Infinite rectangles can be created as output from a tiling filter. For example, the Core Image framework perspective tile filter creates an image whose extent is described by an infinite rectangle.

CGRectMBS.IsNull as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return true if the rect is null -- e.g., the result of intersecting two disjoint rectangles is a null rect.

CGRectMBS.MaxX as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the rightmost x-value of the rect.
Example
dim r as CGRectMBS = CGMakeRectMBS(10, 20, 30, 40)
MsgBox str(r.MaxX) // 40

CGRectMBS.MaxY as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the topmost y-value of the rect.
Example
dim r as CGRectMBS = CGMakeRectMBS(10, 20, 30, 40)
MsgBox str(r.MaxY) // 60

CGRectMBS.MidX as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the midpoint x-value of the rect.
Example
dim r as CGRectMBS = CGMakeRectMBS(10, 20, 30, 40)
MsgBox str(r.MidX) // 25

CGRectMBS.MidY as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the midpoint y-value of the rect.
Example
dim r as CGRectMBS = CGMakeRectMBS(10, 20, 30, 40)
MsgBox str(r.MidY) // 40

CGRectMBS.MinX as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the leftmost x-value of the rect.
Example
dim r as CGRectMBS = CGMakeRectMBS(10, 20, 30, 40)
MsgBox str(r.MinX) // 10

CGRectMBS.MinY as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the bottommost y-value of the rect.
Example
dim r as CGRectMBS = CGMakeRectMBS(10, 20, 30, 40)
MsgBox str(r.MinY) // 20

CGRectMBS.Offset(dx as Double, dy as Double) as CGRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Offset the rect by '(dx, dy)'.

CGRectMBS.Standardize as CGRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Standardize the rect -- i.e., convert it to an equivalent rect which has positive width and height.
Example
dim r as CGRectMBS = CGRectMBS.Make(5, 6, -3, -2)
MsgBox str(r.Left)+" "+str(R.Top)+" "+str(R.Width)+" "+str(r.Height)
r = r.Standardize
MsgBox str(r.Left)+" "+str(R.Top)+" "+str(R.Width)+" "+str(r.Height)

CGRectMBS.Union(r as CGRectMBS) as CGRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 3.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the union of both rectangles.
Example
dim r as CGRectMBS = CGRectMBS.Infinite
MsgBox str(r.Left)+" "+str(R.Top)+" "+str(R.Width)+" "+str(r.Height)

The items on this page are in the following plugins: MBS MacCG Plugin.


The biggest plugin in space...