Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
, regionRegionPrepare
.
Synopsis
- newtype Region = Region (ManagedPtr Region)
- class (GObject o, IsDescendantOf Region o) => IsRegion o
- toRegion :: (MonadIO m, IsRegion o) => o -> m Region
- regionCopy :: (HasCallStack, MonadIO m, IsRegion a, IsRegion b) => a -> b -> Rect -> Int32 -> Int32 -> m Region
- regionEqualsregion :: (HasCallStack, MonadIO m, IsRegion a, IsRegion b) => a -> b -> m Int32
- regionNew :: (HasCallStack, MonadIO m, IsImage a) => a -> m Region
- regionRegionBlack :: (HasCallStack, MonadIO m, IsRegion a) => a -> m ()
- regionRegionBuffer :: (HasCallStack, MonadIO m, IsRegion a) => a -> Rect -> m Int32
- regionRegionFetch :: (HasCallStack, MonadIO m, IsRegion a) => a -> Int32 -> Int32 -> Int32 -> Int32 -> Word64 -> m Word8
- regionRegionHeight :: (HasCallStack, MonadIO m, IsRegion a) => a -> m Int32
- regionRegionImage :: (HasCallStack, MonadIO m, IsRegion a) => a -> Rect -> m Int32
- regionRegionInvalidate :: (HasCallStack, MonadIO m, IsRegion a) => a -> m ()
- regionRegionPaint :: (HasCallStack, MonadIO m, IsRegion a) => a -> Rect -> Int32 -> m ()
- regionRegionPaintPel :: (HasCallStack, MonadIO m, IsRegion a) => a -> Rect -> Word8 -> m ()
- regionRegionPosition :: (HasCallStack, MonadIO m, IsRegion a) => a -> Int32 -> Int32 -> m Int32
- regionRegionPrepare :: (HasCallStack, MonadIO m, IsRegion a) => a -> Rect -> m Int32
- regionRegionPrepareTo :: (HasCallStack, MonadIO m, IsRegion a, IsRegion b) => a -> b -> Rect -> Int32 -> Int32 -> m (Int32, Region)
- regionRegionRegion :: (HasCallStack, MonadIO m, IsRegion a, IsRegion b) => a -> b -> Rect -> Int32 -> Int32 -> m Int32
- regionRegionWidth :: (HasCallStack, MonadIO m, IsRegion a) => a -> m Int32
- regionShrinkMethod :: (HasCallStack, MonadIO m, IsRegion a, IsRegion b) => a -> b -> Rect -> RegionShrink -> m (Int32, Region)
Exported types
Memory-managed wrapper type.
Instances
Eq Region Source # | |
GObject Region Source # | |
Defined in GI.Vips.Objects.Region | |
ManagedPtrNewtype Region Source # | |
Defined in GI.Vips.Objects.Region toManagedPtr :: Region -> ManagedPtr Region | |
TypedObject Region Source # | |
Defined in GI.Vips.Objects.Region | |
HasParentTypes Region Source # | |
Defined in GI.Vips.Objects.Region | |
IsGValue (Maybe Region) Source # | Convert |
Defined in GI.Vips.Objects.Region gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Region -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Region) | |
type ParentTypes Region Source # | |
Defined in GI.Vips.Objects.Region |
class (GObject o, IsDescendantOf Region o) => IsRegion o Source #
Instances
(GObject o, IsDescendantOf Region o) => IsRegion o Source # | |
Defined in GI.Vips.Objects.Region |
Methods
Click to display all available methods, including inherited ones
Methods
argumentIsset, argumentNeedsstring, bindProperty, bindPropertyFull, build, copy, equalsregion, forceFloating, freezeNotify, getv, isFloating, localCb, notify, notifyByPspec, preclose, printDump, printName, printSummary, ref, refSink, regionBlack, regionBuffer, regionFetch, regionHeight, regionImage, regionInvalidate, regionPaint, regionPaintPel, regionPosition, regionPrepare, regionPrepareTo, regionRegion, regionWidth, rewind, runDispose, sanity, shrinkMethod, stealData, stealQdata, thawNotify, unref, unrefOutputs, watchClosure.
Getters
getArgumentFlags, getArgumentPriority, getArgumentToString, getData, getDescription, getQdata.
Setters
setArgumentFromString, setData, setDataFull, setFromString, setRequired, setStatic.
copy
:: (HasCallStack, MonadIO m, IsRegion a, IsRegion b) | |
=> a |
|
-> b |
|
-> Rect |
|
-> Int32 |
|
-> Int32 |
|
-> 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: regionRegionPaint
.
equalsregion
:: (HasCallStack, MonadIO m, IsRegion a, IsRegion b) | |
=> a |
|
-> b |
|
-> 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.
new
:: (HasCallStack, MonadIO m, IsImage a) | |
=> a |
|
-> m Region |
Create a region. Region
s start out empty, you need to call
regionRegionPrepare
to fill them with pixels.
See also: regionRegionPrepare
.
regionBlack
:: (HasCallStack, MonadIO m, IsRegion a) | |
=> a |
|
-> m () |
Paints 0 into the valid part of reg
.
See also: regionRegionPaint
.
regionBuffer
:: (HasCallStack, MonadIO m, IsRegion a) | |
=> a |
|
-> Rect |
|
-> 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.
regionFetch
:: (HasCallStack, MonadIO m, IsRegion a) | |
=> a | |
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> 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 regionRegionPrepare
, followed by a memcpy. It is
convenient for language bindings.
regionHeight
:: (HasCallStack, MonadIO m, IsRegion a) | |
=> a |
|
-> m Int32 | Returns: Height of the pixels held in region. |
No description available in the introspection data.
regionImage
:: (HasCallStack, MonadIO m, IsRegion a) | |
=> a |
|
-> Rect |
|
-> 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.
regionInvalidate
regionRegionInvalidate Source #
:: (HasCallStack, MonadIO m, IsRegion a) | |
=> a |
|
-> m () |
Mark a region as containing invalid pixels. Calling this function means
that the next time regionRegionPrepare
is called, the region will be
recalculated.
This is faster than calling imageImageInvalidateAll
, but obviously only
affects a single region.
See also: imageImageInvalidateAll
, regionRegionPrepare
.
regionPaint
:: (HasCallStack, MonadIO m, IsRegion a) | |
=> a |
|
-> Rect |
|
-> Int32 |
|
-> 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: regionRegionBlack
.
regionPaintPel
:: (HasCallStack, MonadIO m, IsRegion a) | |
=> a |
|
-> Rect |
|
-> Word8 |
|
-> 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: regionRegionPaint
.
regionPosition
:: (HasCallStack, MonadIO m, IsRegion a) | |
=> a |
|
-> Int32 |
|
-> Int32 |
|
-> 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.
regionPrepare
:: (HasCallStack, MonadIO m, IsRegion a) | |
=> a |
|
-> Rect |
|
-> m Int32 | Returns: 0 on success, or -1 on error. |
regionRegionPrepare
fills reg
with pixels. After calling,
you can address at least the area r
with VIPS_REGION_ADDR()
and get
valid pixels.
regionRegionPrepare
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()
,
regionRegionPrepareTo
.
regionPrepareTo
regionRegionPrepareTo Source #
:: (HasCallStack, MonadIO m, IsRegion a, IsRegion b) | |
=> a |
|
-> b |
|
-> Rect |
|
-> Int32 |
|
-> Int32 |
|
-> m (Int32, Region) | Returns: 0 on success, or -1 on error |
Like regionRegionPrepare
: fill reg
with the pixels in area r
.
Unlike regionRegionPrepare
, rather than writing the result to reg
, the
pixels are written into dest
at offset x
, y
.
Also unlike regionRegionPrepare
, dest
is not set up for writing for
you with regionRegionBuffer
. You can
point dest
at anything, and pixels really will be written there.
This makes regionRegionPrepareTo
useful for making the ends of
pipelines.
See also: regionRegionPrepare
, vips_sink_disc()
.
regionRegion
:: (HasCallStack, MonadIO m, IsRegion a, IsRegion b) | |
=> a |
|
-> b |
|
-> Rect |
|
-> Int32 |
|
-> Int32 |
|
-> 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 ).
regionWidth
:: (HasCallStack, MonadIO m, IsRegion a) | |
=> a |
|
-> m Int32 | Returns: Width of the pixels held in region. |
No description available in the introspection data.
shrinkMethod
:: (HasCallStack, MonadIO m, IsRegion a, IsRegion b) | |
=> a |
|
-> b |
|
-> Rect |
|
-> RegionShrink |
|
-> 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
imageImageHasalpha
) shrink with pixels scaled by alpha to avoid fringing.
method
selects the method used to do the 2x2 shrink.
See also: regionCopy
.