NXWidgets: NXWidgets::CScaledBitmap Class Reference

NXWidgets 1.19

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
NXWidgets::CScaledBitmap Class Reference

`#include <cscaledbitmap.hxx>`

Inheritance diagram for NXWidgets::CScaledBitmap:

## Public Member Functions
| CScaledBitmap (IBitmap *bitmap, struct nxgl_size_s &newSize)
| ~CScaledBitmap (void)
const uint8_t | getColorFormat (void) const
const uint8_t | getBitsPerPixel (void) const
const nxgl_coord_t | getWidth (void) const
const nxgl_coord_t | getHeight (void) const
const size_t | getStride (void) const
void | setSelected (bool selected)
bool | getRun (nxgl_coord_t x, nxgl_coord_t y, nxgl_coord_t width, FAR void *data)
Public Member Functions inherited from NXWidgets::IBitmap
virtual | ~IBitmap (void)

## Protected Member Functions
bool | cacheRows (unsigned int row)
bool | scaleColor (FAR const struct rgbcolor_s &incolor1, FAR const struct rgbcolor_s &incolor2, b16_t fraction, FAR struct rgbcolor_s &outcolor)
bool | rowColor (FAR uint8_t *row, b16_t column, FAR struct rgbcolor_s &outcolor)
| CScaledBitmap (const CScaledBitmap &bitmap)

## Protected Attributes
FAR IBitmap * | m_bitmap
struct nxgl_size_s | m_size
FAR uint8_t * | m_rowCache [2]
unsigned int | m_row
b16_t | m_xScale
b16_t | m_yScale

## Detailed Description

Class for scaling layer for any bitmap that inherits from IBitMap

Definition at line 72 of file cscaledbitmap.hxx.

## Constructor & Destructor Documentation

## ◆ CScaledBitmap() [1/2]

NXWidgets::CScaledBitmap::CScaledBitmap | ( | const CScaledBitmap & | bitmap | ) |
| inlineprotected

Copy constructor is protected to prevent usage.

Definition at line 121 of file cscaledbitmap.hxx.

## ◆ CScaledBitmap() [2/2]

CScaledBitmap::CScaledBitmap | ( | IBitmap * | bitmap,
|  | struct nxgl_size_s & | newSize
| ) |  |

Constructor.

Parameters

  bitmap | The bitmap structure being scaled. The new, scaled size of the image

Definition at line 67 of file cscaledbitmap.cxx.

## ◆ ~CScaledBitmap()

CScaledBitmap::~CScaledBitmap | ( | void |  | ) |

Destructor.

Definition at line 102 of file cscaledbitmap.cxx.

## Member Function Documentation

## ◆ cacheRows()

bool CScaledBitmap::cacheRows | ( | unsigned int | row | ) |
| protected

Read two rows into the row cache

Parameters

  row | - The row number of the first row to cache

Definition at line 363 of file cscaledbitmap.cxx.

## ◆ getBitsPerPixel()

const uint8_t CScaledBitmap::getBitsPerPixel | ( | void |  | ) | const
| virtual

Get the bitmap's color format.

Returns
  The bitmap's pixel depth.

Get the bitmap's color format.

Returns
  The bitmap's color format.

Implements NXWidgets::IBitmap.

Definition at line 141 of file cscaledbitmap.cxx.

## ◆ getColorFormat()

const uint8_t CScaledBitmap::getColorFormat | ( | void |  | ) | const
| virtual

Get the bitmap's color format.

Returns
  The bitmap's color format.

Get the bitmap's color format.

Returns
  The bitmap's width.

Implements NXWidgets::IBitmap.

Definition at line 130 of file cscaledbitmap.cxx.

## ◆ getHeight()

const nxgl_coord_t CScaledBitmap::getHeight | ( | void |  | ) | const
| virtual

Get the bitmap's height (in rows).

Returns
  The bitmap's height (in rows).

Implements NXWidgets::IBitmap.

Definition at line 163 of file cscaledbitmap.cxx.

## ◆ getRun()

bool CScaledBitmap::getRun | ( | nxgl_coord_t | x,
|  | nxgl_coord_t | y,
|  | nxgl_coord_t | width,
|  | FAR void * | data
| ) |  |
| virtual

Get one row from the bit map image.

Parameters

  x | The offset into the row to get
  y | The row number to get
  width | The number of pixels to get from the row
  data | The memory location provided by the caller in which to return the data. This should be at least (getWidth()*getBitsPerPixl() + 7)/8 bytes in length and properly aligned for the pixel color format.
  True | if the run was returned successfully.

Get one row from the bit map image.

REVISIT: This algorithm is really intended to expand images. Hence, for example, interpolation is between row and row+1 and column and column+1 in the original, unscaled image. You would the interpolation differently if you really wanted to sub-sample well.

Parameters

  x | The offset into the row to get
  y | The row number to get
  width | The number of pixels to get from the row
  data | The memory location provided by the caller in which to return the data. This should be at least (getWidth()*getBitsPerPixl() + 7)/8 bytes in length and properly aligned for the pixel color format.
  True | if the run was returned successfully.

Implements NXWidgets::IBitmap.

Definition at line 197 of file cscaledbitmap.cxx.

## ◆ getStride()

const size_t CScaledBitmap::getStride | ( | void |  | ) | const
| virtual

Get the bitmap's width (in bytes).

Returns
  The bitmap's width (in bytes).

Implements NXWidgets::IBitmap.

Definition at line 174 of file cscaledbitmap.cxx.

## ◆ getWidth()

const nxgl_coord_t CScaledBitmap::getWidth | ( | void |  | ) | const
| virtual

Get the bitmap's width (in pixels/columns).

Returns
  The bitmap's width (in pixels/columns).

Get the bitmap's width (in pixels/columns).

Returns
  The bitmap's pixel depth.

Implements NXWidgets::IBitmap.

Definition at line 152 of file cscaledbitmap.cxx.

## ◆ rowColor()

bool CScaledBitmap::rowColor | ( | FAR uint8_t * | row,
|  | b16_t | column,
|  | FAR struct rgbcolor_s & | outcolor
| ) |  |
| protected

Given an image row and a non-integer column offset, return the interpolated RGB color value corresponding to that position

Parameters

  row | - The pointer to the row in the row cache to use
  column | - The non-integer column offset
  outcolor | - The returned, interpolated color

Definition at line 490 of file cscaledbitmap.cxx.

## ◆ scaleColor()

bool CScaledBitmap::scaleColor | ( | FAR const struct rgbcolor_s & | incolor1,
|  | FAR const struct rgbcolor_s & | incolor2,
|  | b16_t | fraction,
|  | FAR struct rgbcolor_s & | outcolor
| ) |  |
| protected

Given an two RGB colors and a fractional value, return the scaled value between the two colors.

Parameters

  incolor1 | - The first color to be used
  incolor2 | - The second color to be used
  fraction | - The fractional value
  outcolor | - The returned, scaled color

Definition at line 446 of file cscaledbitmap.cxx.

## ◆ setSelected()

void NXWidgets::CScaledBitmap::setSelected | ( | bool | selected | ) |
| inlinevirtual

Use the colors associated with a selected image.

Parameters

  selected. | true: Use colors for a selected widget, false: Use normal (default) colors.

Implements NXWidgets::IBitmap.

Definition at line 187 of file cscaledbitmap.hxx.

## Member Data Documentation

## ◆ m_bitmap

FAR IBitmap* NXWidgets::CScaledBitmap::m_bitmap
| protected

The bitmap that is being scaled

Definition at line 75 of file cscaledbitmap.hxx.

## ◆ m_row

unsigned int NXWidgets::CScaledBitmap::m_row
| protected

Row number of the first cached row

Definition at line 78 of file cscaledbitmap.hxx.

## ◆ m_rowCache

FAR uint8_t* NXWidgets::CScaledBitmap::m_rowCache[2]
| protected

Two cached rows of the image

Definition at line 77 of file cscaledbitmap.hxx.

## ◆ m_size

struct nxgl_size_s NXWidgets::CScaledBitmap::m_size
| protected

Scaled size of the image

Definition at line 76 of file cscaledbitmap.hxx.

## ◆ m_xScale

b16_t NXWidgets::CScaledBitmap::m_xScale
| protected

X scale factor

Definition at line 79 of file cscaledbitmap.hxx.

## ◆ m_yScale

b16_t NXWidgets::CScaledBitmap::m_yScale
| protected

Y scale factor

Definition at line 80 of file cscaledbitmap.hxx.

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

- cscaledbitmap.hxx
- cscaledbitmap.cxx