struct

CrImage::Math::Fixed::Int26_6

Inherits Struct / Value / Object

Int26_6 is a signed 26.6 fixed-point number.

Format: 26 bits for integer part, 6 bits for fractional part

  • Integer range: -33554432 to 33554431
  • Fractional precision: 1/64 (0.015625)

Used for sub-pixel positioning in font rendering and graphics.

Example:

# One and a quarter: 1 + 16/64 = 1.25
value = CrImage::Math::Fixed::Int26_6[1 << 6 + 1 << 4]
puts value.to_s # => "1:16"

Class methods

[](value : Number)
Source
from_i(i : Int)

returns the integer value i as in Int26_6

Source

Instance methods

%(y : Int26_6)
Source
%(y : Number)
Source
*(y : Int26_6)
Source
*(y : Int32)
Source
*(y : Number)
Source
+(y : self)
Source
+(y : Number)
Source
-(y : Int26_6)
Source
-(y : Number)
Source
/(y : Int32)
Source
//(y : Int26_6)
Source
//(y : Number)
Source
<(y : Int26_6)
Source
<=(y : Int26_6)
Source
==(y : Int26_6)
Source
==(y : Number)
Source
>(y : Int26_6)
Source
>=(y : Int26_6)
Source
ceil

ceil returns the least integer value less than or equal to @val.

Its return is Int32, not Int26_6

Source
floor

floor returns the greatest integer value less than or equal to @val.

Its return is Int32, not Int26_6

Source
round

round returns the nearest integer value to @val.

Its return is Int32, not Int26_6

Source
to_i
Source
to_s(io : IO) : Nil

Same as #inspect(io).

Source
to_s

returns human-readable representation of 26.6 fixed-point number. For example, the number one-and-a-quarter becomes &quot;1:16&quot;.

Source