FuncDoodle
Loading...
Searching...
No Matches
FuncDoodle::Frame Class Reference

Wraps an ImageArray with higher-level frame editing operations. More...

#include <Frame.h>

Public Member Functions

 Frame ()
 Frame (const Frame &other)=default
 Copies an existing frame.
 Frame (int width, int height, Col bgCol)
 Creates a frame with explicit dimensions and background color.
 Frame (ImageArray arr)
 Creates a frame from an image array copy.
 Frame (const ImageArray *arr)
 Creates a frame from an optional image array pointer.
 ~Frame ()=default
void ReInit (int width, int height, Col bgCol)
 Reinitializes the frame with new dimensions and background color.
Frameoperator= (const Frame &other)
 Copies another frame into this one.
bool operator== (const Frame &other) const
 Returns whether two frames contain identical pixel data.
void SetWidth (int width, bool clear=false)
 Sets the frame width.
void SetHeight (int height, bool clear=false)
 Sets the frame height.
void Rotate (int deg)
 Rotates the frame contents around the frame center.
void RotateSelection (WeakPtr< Selection > sel, int deg)
 Rotates only the selected region.
void DeleteSelection (WeakPtr< Selection > sel, Col bg)
 Replaces the selected region with background color.
void MoveSelection (WeakPtr< Selection > sel, Direction moveDir, Col bg)
 Moves the selected region by one step.
void CopyToClipboard ()
 Copies the frame image to the system clipboard.
void Export (const char *filePath) const
 Writes the frame to an image file.
const ImageArrayPixels () const
 Returns immutable access to the backing pixel array.
ImageArrayPixelsMut ()
 Returns mutable access to the backing pixel array.
void SetPixel (int x, int y, Col px)
 Sets a single frame pixel.
int Width () const
 Returns the frame width in pixels.
int Height () const
 Returns the frame height in pixels.
std::vector< ColData () const
 Returns a copy of the frame pixel buffer.

Static Public Member Functions

static FramePastedFrame ()
 Returns a frame created from clipboard image data.

Private Attributes

ImageArray m_Pixels

Detailed Description

Wraps an ImageArray with higher-level frame editing operations.

Constructor & Destructor Documentation

◆ Frame() [1/5]

FuncDoodle::Frame::Frame ( )
inline

◆ Frame() [2/5]

FuncDoodle::Frame::Frame ( const Frame & other)
default

Copies an existing frame.

Parameters
otherFrame to copy.

◆ Frame() [3/5]

FuncDoodle::Frame::Frame ( int width,
int height,
Col bgCol )
inline

Creates a frame with explicit dimensions and background color.

Parameters
widthFrame width.
heightFrame height.
bgColBackground color.

◆ Frame() [4/5]

FuncDoodle::Frame::Frame ( ImageArray arr)
inline

Creates a frame from an image array copy.

Parameters
arrImage array to copy.

◆ Frame() [5/5]

FuncDoodle::Frame::Frame ( const ImageArray * arr)
inline

Creates a frame from an optional image array pointer.

Parameters
arrImage array pointer to copy when non-null.

◆ ~Frame()

FuncDoodle::Frame::~Frame ( )
default

Member Function Documentation

◆ CopyToClipboard()

void FuncDoodle::Frame::CopyToClipboard ( )

Copies the frame image to the system clipboard.

◆ Data()

std::vector< Col > FuncDoodle::Frame::Data ( ) const
inlinenodiscard

Returns a copy of the frame pixel buffer.

Returns
Pixel buffer copy.

◆ DeleteSelection()

void FuncDoodle::Frame::DeleteSelection ( WeakPtr< Selection > sel,
Col bg )

Replaces the selected region with background color.

Parameters
selSelection to clear.
bgBackground color to write.

◆ Export()

void FuncDoodle::Frame::Export ( const char * filePath) const

Writes the frame to an image file.

Parameters
filePathOutput image path.

◆ Height()

int FuncDoodle::Frame::Height ( ) const
inlinenodiscard

Returns the frame height in pixels.

Returns
Frame height.

◆ MoveSelection()

void FuncDoodle::Frame::MoveSelection ( WeakPtr< Selection > sel,
Direction moveDir,
Col bg )

Moves the selected region by one step.

Parameters
selSelection to move.
moveDirDirection to move in.
bgBackground color used to fill vacated pixels.

◆ operator=()

Frame & FuncDoodle::Frame::operator= ( const Frame & other)

Copies another frame into this one.

Parameters
otherFrame to copy.
Returns
Reference to this frame.

◆ operator==()

bool FuncDoodle::Frame::operator== ( const Frame & other) const

Returns whether two frames contain identical pixel data.

Parameters
otherFrame to compare against.
Returns
Whether the frames match.

◆ PastedFrame()

Frame * FuncDoodle::Frame::PastedFrame ( )
static

Returns a frame created from clipboard image data.

Returns
Newly allocated pasted frame, or nullptr on failure.

◆ Pixels()

const ImageArray * FuncDoodle::Frame::Pixels ( ) const
inlinenodiscard

Returns immutable access to the backing pixel array.

Returns
Pointer to image data.

◆ PixelsMut()

ImageArray * FuncDoodle::Frame::PixelsMut ( )
inline

Returns mutable access to the backing pixel array.

Returns
Pointer to mutable image data.

◆ ReInit()

void FuncDoodle::Frame::ReInit ( int width,
int height,
Col bgCol )
inline

Reinitializes the frame with new dimensions and background color.

Parameters
widthNew frame width.
heightNew frame height.
bgColNew background color.

◆ Rotate()

void FuncDoodle::Frame::Rotate ( int deg)
inline

Rotates the frame contents around the frame center.

Parameters
degRotation angle in degrees.

◆ RotateSelection()

void FuncDoodle::Frame::RotateSelection ( WeakPtr< Selection > sel,
int deg )

Rotates only the selected region.

Parameters
selSelection to rotate.
degRotation angle in degrees.

◆ SetHeight()

void FuncDoodle::Frame::SetHeight ( int height,
bool clear = false )

Sets the frame height.

Parameters
heightNew frame height.
clearWhether to clear contents while resizing.

◆ SetPixel()

void FuncDoodle::Frame::SetPixel ( int x,
int y,
Col px )
inline

Sets a single frame pixel.

Parameters
xPixel X coordinate.
yPixel Y coordinate.
pxNew pixel color.

◆ SetWidth()

void FuncDoodle::Frame::SetWidth ( int width,
bool clear = false )

Sets the frame width.

Parameters
widthNew frame width.
clearWhether to clear contents while resizing.

◆ Width()

int FuncDoodle::Frame::Width ( ) const
inlinenodiscard

Returns the frame width in pixels.

Returns
Frame width.

Member Data Documentation

◆ m_Pixels

ImageArray FuncDoodle::Frame::m_Pixels
private

The documentation for this class was generated from the following files: