14 #include <kApi/Data/kImage.x.h>
154 #define kImage_AttachT(kImage_image, TPtr_pixels, kType_pixelType, kSize_width, kSize_height, kSize_stride) \
155 xkImage_AttachT(kImage_image, TPtr_pixels, kType_pixelType, kSize_width, kSize_height, kSize_stride, sizeof(*TPtr_pixels))
188 obj->format = format;
269 #define kImage_SetPixelT(kImage_image, kSize_x, kSize_y, TPtr_pixel) \
270 xkImage_SetPixelT(kImage_image, kSize_x, kSize_y, TPtr_pixel, sizeof(*TPtr_pixel))
303 #define kImage_PixelT(kImage_image, kSize_x, kSize_y, TPtr_pixel) \
304 xkImage_PixelT(kImage_image, kSize_x, kSize_y, TPtr_pixel, sizeof(*TPtr_pixel))
321 #define kImage_SetAsT(kImage_image, kSize_x, kSize_y, T_value, T) \
322 (kPointer_WriteAs(xkImage_AsT(kImage_image, kSize_x, kSize_y, sizeof(T)), T_value, T), (void)0)
338 #define kImage_AsT(kImage_image, kSize_x, kSize_y, T) \
339 kPointer_ReadAs(xkImage_AsT(kImage_image, kSize_x, kSize_y, sizeof(T)), T)
366 #define kImage_DataT(kImage_image, T) \
367 kCast(T*, xkImage_DataT(kImage_image, sizeof(T)))
403 #define kImage_DataAtT(kImage_image, kSSize_x, kSSize_y, T) \
404 kCast(T*, xkImage_DataAtT(kImage_image, kSSize_x, kSSize_y, sizeof(T)))
417 return obj->height * obj->stride;
434 # if !defined(K_FSS_912_DISABLE_BOUNDS_CHECK)
458 #define kImage_AtT(kImage_image, kSize_x, kSize_y, T) \
459 kCast(T*, xkImage_AtT(kImage_image, kSize_x, kSize_y, sizeof(T)))
474 # if !defined(K_FSS_912_DISABLE_BOUNDS_CHECK)
496 #define kImage_RowAtT(kImage_image, kSize_y, T) \
497 kCast(T*, xkImage_RowAtT(kImage_image, kSize_y, sizeof(T)))
510 return obj->pixelType;
524 return obj->pixelSize;
568 return obj->width * obj->height;
596 return obj->dataAlloc;
kStatus kImage_Assign(kImage image, kImage source)
Copies a given source image into this image.
kStatus kImage_SetPixel(kImage image, kSize x, kSize y, const void *pixel)
Sets the value of a pixel.
kStatus kImage_Pixel(kImage image, kSize x, kSize y, void *pixel)
Gets the value of a pixel.
void * kImage_RowAt(kImage image, kSize y)
Returns a pointer to the specified row in the pixel buffer.
Definition: kImage.h:472
kPixelFormat kImage_PixelFormat(kImage image)
Gets the optional pixel format descriptor associated with this image.
Definition: kImage.h:200
kAlloc kImage_DataAlloc(kImage image)
Reports the data allocator that was optionally provided at construction time.
Definition: kImage.h:592
void * kImage_Data(kImage image)
Returns a pointer to the first row in the pixel buffer.
Definition: kImage.h:348
kSize kImage_Area(kImage image)
Returns the area of the image, in pixels.
Definition: kImage.h:564
kSize kImage_PixelSize(kImage image)
Returns the pixel size.
Definition: kImage.h:520
Represents an unsigned integer that can store a pointer address.
Abstract base class for memory allocator types.
kStatus kImage_Construct(kImage *image, kType pixelType, kSize width, kSize height, kAlloc allocator)
Constructs a kImage object.
#define kInlineFx(TYPE)
Inline method declaration helper.
Definition: kApiDef.h:26
void * kImage_DataAt(kImage image, kSSize x, kSSize y)
Calculates an address relative to the start of the pixel buffer.
Definition: kImage.h:380
Represents a single unit (byte) in a UTF-8 character.
kStatus kImage_Import(kImage *image, const kChar *fileName, kAlloc allocator)
Loads an image from file.
kStatus kImage_Export(kImage image, const kChar *fileName)
Saves an image to file.
kSize kImage_DataSize(kImage image)
Reports the size, in bytes, of the pixel buffer.
Definition: kImage.h:413
Represents a signed integer that can store a pointer address.
void * kImage_At(kImage image, kSize x, kSize y)
Returns a pointer to the specified pixel in the pixel buffer.
Definition: kImage.h:432
kStatus kImage_Attach(kImage image, void *pixels, kType pixelType, kSize width, kSize height, kSize stride)
Attaches the image to an external pixel buffer.
kStatus kImage_ConstructEx(kImage *image, kType pixelType, kSize width, kSize height, kAlloc allocator, kAlloc dataAllocator)
Constructs a kImage object using a separate allocator for image array memory.
kStatus kImage_SetCfa(kImage image, kCfa cfa)
Sets the color filter array type associated with this image.
Definition: kImage.h:215
#define kObj(TypeName_T, T_object)
Declares a local "obj" (this-pointer) variable and initializes it from a type-checked object handle...
Definition: kApiDef.h:2921
Core Zen type declarations.
void * kPointer_ByteOffset(const void *pointer, kSSize offset)
Calculates a pointer address from a base address and a byte offset.
Definition: kApiDef.h:278
kType kImage_PixelType(kImage image)
Returns the pixel type.
Definition: kImage.h:506
kStatus kImage_Allocate(kImage image, kType pixelType, kSize width, kSize height)
Reallocates the internal pixel buffer.
kSize kImage_Width(kImage image)
Returns the width of the image, in pixels.
Definition: kImage.h:534
Represents metadata about a type (class, interface, or value).
#define kAssert(EXPRESSION)
Aborts execution if EXPRESSION is kFALSE.
Definition: kApiDef.h:749
Represents a 2D collection of pixels.
#define kOK
Operation successful.
Definition: kApiDef.h:513
kCfa kImage_Cfa(kImage image)
Gets the color filter array type associated with this image.
Definition: kImage.h:231
Represents an error code.
kSize kImage_Height(kImage image)
Returns the height of the image, in pixels.
Definition: kImage.h:548
Image color filter array type.
kStatus kImage_Zero(kImage image)
Sets all pixel bits to zero.
kStatus kImage_SetPixelFormat(kImage image, kPixelFormat format)
Sets the optional pixel format descriptor associated with this image.
Definition: kImage.h:184
kSize kImage_Stride(kImage image)
Returns the size of an image row, including alignment padding bytes, in bytes.
Definition: kImage.h:578