namespace CCL::GraphicsFactory

Overview

Functions for creating graphics objects. More…

namespace GraphicsFactory {

// global functions

int getNumImageFormats ();
const FileType* getImageFormat (int index);
IImage* loadImageFile (UrlRef path);

bool saveImageFile (
    UrlRef path,
    IImage* image,
    const IAttributeList* encoderOptions = nullptr
);

IImage* loadImageStream (IStream& stream, const FileType& format);

bool saveImageStream (
    IStream& stream,
    IImage* image,
    const FileType& format,
    const IAttributeList* encoderOptions = nullptr
);

IImage* createBitmap (
    int width,
    int height,
    IBitmap::PixelFormat format = IBitmap::kRGB,
    float scaleFactor = 1.f
);

IGraphics* createBitmapGraphics (IImage* bitmap);
IBitmapFilter* createBitmapFilter (StringID which);
IBitmapFilter* createBitmapColorizationFilter (Color color);

IImage* createSolidBitmap (
    Color color,
    int width,
    int height,
    IBitmap::PixelFormat format = IBitmap::kRGB,
    float scaleFactor = 1.f
);

IGraphicsPath* createPath (IGraphicsPath::TypeHint type = IGraphicsPath::kPaintPath);
IGradient* createGradient (IGradient::TypeHint type);
IImage* createShapeImage ();
IGraphics* createShapeBuilder (IImage* shapeImage);
IImage* createSolidShapeImage (Color color, int width, int height);
ITextLayout* createTextLayout ();
bool hasGraphicsLayers ();
IGraphicsLayer* createGraphicsLayer (UIDRef cid);
IUIValue* createValue ();
IImage* createFilmstrip (IImage* sourceImage, StringID frames);
IImage* createImagePart (IImage* sourceImage, RectRef partRect);
IImage* createMultiImage (IImage* images [], CString frameNames [], int count);

IImage* createMultiResolutionBitmap (
    IImage* bitmaps [],
    float scaleFactors [],
    int count
);

} // namespace GraphicsFactory

Detailed Documentation

Functions for creating graphics objects.

Global Functions

int getNumImageFormats ()

Get number of supported image formats.

const FileType* getImageFormat (int index)

Get image format by index.

IImage* loadImageFile (UrlRef path)

Load image from file.

bool saveImageFile (
    UrlRef path,
    IImage* image,
    const IAttributeList* encoderOptions = nullptr
)

Save image to file.

IImage* loadImageStream (IStream& stream, const FileType& format)

Load image from stream.

bool saveImageStream (
    IStream& stream,
    IImage* image,
    const FileType& format,
    const IAttributeList* encoderOptions = nullptr
)

Save image to stream.

IImage* createBitmap (
    int width,
    int height,
    IBitmap::PixelFormat format = IBitmap::kRGB,
    float scaleFactor = 1.f
)

Create a new bitmap.

IGraphics* createBitmapGraphics (IImage* bitmap)

Create a graphics device for drawing into a bitmap.

IBitmapFilter* createBitmapFilter (StringID which)

Create bitmap filter.

IBitmapFilter* createBitmapColorizationFilter (Color color)

Create bitmap colorization filter.

IImage* createSolidBitmap (
    Color color,
    int width,
    int height,
    IBitmap::PixelFormat format = IBitmap::kRGB,
    float scaleFactor = 1.f
)

Create bitmap of given color.

IGraphicsPath* createPath (IGraphicsPath::TypeHint type = IGraphicsPath::kPaintPath)

Create an empty graphics path.

IGradient* createGradient (IGradient::TypeHint type)

Create an new gradient.

IImage* createShapeImage ()

Create an empty vector image.

IGraphics* createShapeBuilder (IImage* shapeImage)

Create a graphics device for drawing a vector image.

IImage* createSolidShapeImage (Color color, int width, int height)

Create vector image with a single colored rectangle.

ITextLayout* createTextLayout ()

Create text layout object.

bool hasGraphicsLayers ()

Check if graphics layers are available.

IGraphicsLayer* createGraphicsLayer (UIDRef cid)

Create graphics layer object.

IUIValue* createValue ()

Create value object.

IImage* createFilmstrip (IImage* sourceImage, StringID frames)

Create filmstrip from source image with given frames.

IImage* createImagePart (IImage* sourceImage, RectRef partRect)

Create image part.

IImage* createMultiImage (IImage* images [], CString frameNames [], int count)

Create container image.

IImage* createMultiResolutionBitmap (
    IImage* bitmaps [],
    float scaleFactors [],
    int count
)

Create bitmap with representations for multiple DPI scaling factors.