gi-vips-8.0.3: libvips GObject bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Vips.Objects.Region

Description

A small part of a Image. valid holds the left/top/width/height of the area of pixels that are available from the region.

See also: VIPS_REGION_ADDR(), regionNew, regionPrepare.

Synopsis

Exported types

newtype Region Source #

Memory-managed wrapper type.

Constructors

Region (ManagedPtr Region) 

Instances

Instances details
Eq Region Source # 
Instance details

Defined in GI.Vips.Objects.Region

Methods

(==) :: Region -> Region -> Bool #

(/=) :: Region -> Region -> Bool #

GObject Region Source # 
Instance details

Defined in GI.Vips.Objects.Region

ManagedPtrNewtype Region Source # 
Instance details

Defined in GI.Vips.Objects.Region

Methods

toManagedPtr :: Region -> ManagedPtr Region

TypedObject Region Source # 
Instance details

Defined in GI.Vips.Objects.Region

Methods

glibType :: IO GType

HasParentTypes Region Source # 
Instance details

Defined in GI.Vips.Objects.Region

IsGValue (Maybe Region) Source #

Convert Region to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Vips.Objects.Region

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe Region -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe Region)

type ParentTypes Region Source # 
Instance details

Defined in GI.Vips.Objects.Region

type ParentTypes Region = '[Object, Object]

class (GObject o, IsDescendantOf Region o) => IsRegion o Source #

Type class for types which can be safely cast to Region, for instance with toRegion.

Instances

Instances details
(GObject o, IsDescendantOf Region o) => IsRegion o Source # 
Instance details

Defined in GI.Vips.Objects.Region

toRegion :: (MonadIO m, IsRegion o) => o -> m Region Source #

Cast to Region, for types for which this is known to be safe. For general casts, use castTo.

Methods

black

regionBlack Source #

Arguments

:: (HasCallStack, MonadIO m, IsRegion a) 
=> a

reg: region to operate upon

-> m () 

Paints 0 into the valid part of reg.

See also: regionPaint.

buffer

regionBuffer Source #

Arguments

:: (HasCallStack, MonadIO m, IsRegion a) 
=> a

reg: region to operate upon

-> Rect

r: Rect of pixels you need to be able to address

-> m Int32

Returns: 0 on success, or -1 for error.

The region is transformed so that at least r pixels are available as a memory buffer that can be written to.

copy

regionCopy Source #

Arguments

:: (HasCallStack, MonadIO m, IsRegion a, IsRegion b) 
=> a

reg: source region

-> b

dest: destination region

-> Rect

r: Rect of pixels you need to copy

-> Int32

x: postion of r in dest

-> Int32

y: postion of r in dest

-> m Region 

Copy from one region to another. Copy area r from inside reg to dest, positioning the area of pixels at x, y. The two regions must have pixels which are the same size.

See also: regionPaint.

equalsregion

regionEqualsregion Source #

Arguments

:: (HasCallStack, MonadIO m, IsRegion a, IsRegion b) 
=> a

reg1: region to test

-> b

reg2: region to test

-> m Int32

Returns: non-zero on equality.

Do two regions point to the same piece of image? ie.

	VIPS_REGION_ADDR( reg1, x, y ) == VIPS_REGION_ADDR( reg2, x, y ) &&
	*VIPS_REGION_ADDR( reg1, x, y ) ==
		*VIPS_REGION_ADDR( reg2, x, y ) for all x, y, reg1, reg2.

fetch

regionFetch Source #

Arguments

:: (HasCallStack, MonadIO m, IsRegion a) 
=> a

region: region to fetch pixels from

-> Int32

left: area of pixels to fetch

-> Int32

top: area of pixels to fetch

-> Int32

width: area of pixels to fetch

-> Int32

height: area of pixels to fetch

-> Word64 
-> m Word8

Returns: A copy of the pixel data.

Generate an area of pixels and return a copy. The result must be freed with free. The requested area must be completely inside the image.

This is equivalent to regionPrepare, followed by a memcpy. It is convenient for language bindings.

height

regionHeight Source #

Arguments

:: (HasCallStack, MonadIO m, IsRegion a) 
=> a

region: fetch height from this

-> m Int32

Returns: Height of the pixels held in region.

No description available in the introspection data.

image

regionImage Source #

Arguments

:: (HasCallStack, MonadIO m, IsRegion a) 
=> a

reg: region to operate upon

-> Rect

r: Rect of pixels you need to be able to address

-> m Int32

Returns: 0 on success, or -1 for error.

The region is transformed so that at least r pixels are available to be read from the image. The image needs to be a memory buffer or represent a file on disc that has been mapped or can be mapped.

invalidate

regionInvalidate Source #

Arguments

:: (HasCallStack, MonadIO m, IsRegion a) 
=> a

reg: region to invalidate

-> m () 

Mark a region as containing invalid pixels. Calling this function means that the next time regionPrepare is called, the region will be recalculated.

This is faster than calling imageInvalidateAll, but obviously only affects a single region.

See also: imageInvalidateAll, regionPrepare.

new

regionNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsImage a) 
=> a

image: image to create this region on

-> m Region 

Create a region. Region s start out empty, you need to call regionPrepare to fill them with pixels.

See also: regionPrepare.

paint

regionPaint Source #

Arguments

:: (HasCallStack, MonadIO m, IsRegion a) 
=> a

reg: region to operate upon

-> Rect

r: area to paint

-> Int32

value: value to paint

-> m () 

Paints value into reg covering rectangle r. r is clipped against reg->valid.

For int images, value is passed to memset(), so it usually needs to be 0 or 255. For float images, value is cast to a float and copied in to each band element.

r is clipped against reg->valid.

See also: regionBlack.

paintPel

regionPaintPel Source #

Arguments

:: (HasCallStack, MonadIO m, IsRegion a) 
=> a

reg: region to operate upon

-> Rect

r: area to paint

-> Word8

ink: value to paint

-> m () 

Paints ink into reg covering rectangle r. r is clipped against reg->valid.

ink should be a byte array of the same size as an image pixel containing the binary value to write into the pixels.

See also: regionPaint.

position

regionPosition Source #

Arguments

:: (HasCallStack, MonadIO m, IsRegion a) 
=> a

reg: region to operate upon

-> Int32

x: position to move to

-> Int32

y: position to move to

-> m Int32

Returns: 0 on success, or -1 for error.

Set the position of a region. This only affects reg->valid, ie. the way pixels are addressed, not reg->data, the pixels which are addressed. Clip against the size of the image. Do not allow negative positions, or positions outside the image.

prepare

regionPrepare Source #

Arguments

:: (HasCallStack, MonadIO m, IsRegion a) 
=> a

reg: region to prepare

-> Rect

r: Rect of pixels you need to be able to address

-> m Int32

Returns: 0 on success, or -1 on error.

regionPrepare fills reg with pixels. After calling, you can address at least the area r with VIPS_REGION_ADDR() and get valid pixels.

regionPrepare runs in-line, that is, computation is done by the calling thread, no new threads are involved, and computation blocks until the pixels are ready.

Use vips_sink_screen() to calculate an area of pixels in the background.

See also: vips_sink_screen(), regionPrepareTo.

prepareTo

regionPrepareTo Source #

Arguments

:: (HasCallStack, MonadIO m, IsRegion a, IsRegion b) 
=> a

reg: region to prepare

-> b

dest: region to write to

-> Rect

r: Rect of pixels you need to be able to address

-> Int32

x: postion of r in dest

-> Int32

y: postion of r in dest

-> m Int32

Returns: 0 on success, or -1 on error

Like regionPrepare: fill reg with the pixels in area r.

Unlike regionPrepare, rather than writing the result to reg, the pixels are written into dest at offset x, y.

Also unlike regionPrepare, dest is not set up for writing for you with regionBuffer. You can point dest at anything, and pixels really will be written there. This makes regionPrepareTo useful for making the ends of pipelines.

See also: regionPrepare, vips_sink_disc().

region

regionRegion Source #

Arguments

:: (HasCallStack, MonadIO m, IsRegion a, IsRegion b) 
=> a

reg: region to operate upon

-> b

dest: region to connect to

-> Rect

r: Rect of pixels you need to be able to address

-> Int32

x: postion of r in dest

-> Int32

y: postion of r in dest

-> m Int32

Returns: 0 on success, or -1 for error.

Make VIPS_REGION_ADDR() on reg go to dest instead.

r is the part of reg which you want to be able to address (this effectively becomes the valid field), (x, y) is the top LH corner of the corresponding area in dest.

Performs all clipping necessary to ensure that reg->valid is indeed valid.

If the region we attach to is moved or destroyed, we can be left with dangling pointers! If the region we attach to is on another image, the two images must have the same sizeof( pel ).

shrinkMethod

regionShrinkMethod Source #

Arguments

:: (HasCallStack, MonadIO m, IsRegion a, IsRegion b) 
=> a

from: source region

-> b

to: destination region

-> Rect

target: Rect of pixels you need to copy

-> RegionShrink

method: method to use when generating target pixels

-> m (Int32, Region) 

Write the pixels target in to from the x2 larger area in from. Non-complex uncoded images and LABQ only. Images with alpha (see imageHasalpha) shrink with pixels scaled by alpha to avoid fringing.

method selects the method used to do the 2x2 shrink.

See also: regionCopy.

width

regionWidth Source #

Arguments

:: (HasCallStack, MonadIO m, IsRegion a) 
=> a

region: fetch width from this

-> m Int32

Returns: Width of the pixels held in region.

No description available in the introspection data.