# OHOS

## Overview

Related Modules:

Description:

Declares functions in the CameraConfig class.

Since:

1.0

Version:

1.0

## Data Structures

Data Structure Name

Description

Ability

Declares ability-related functions, including ability lifecycle callbacks and functions for connecting to or disconnecting from AAs.

AbilityContext

Provides functions for starting and stopping an ability.

AbilityEventHandler

Declares functions for performing operations during inter-thread communication, including running and quitting the event loop of the current thread and posting tasks to an asynchronous thread.

Declares functions for registering the class names of Ability and AbilitySlice with the ability management framework.

AbilitySlice

Provides ability slice-related functions, including ability slice lifecycle callbacks and functions for connecting to or disconnecting from ability slices.

Defines the base class for adapters. You can derive AbstractAdapter based on actual requirements and use the GetView() and GetCount() functions to implement adapters of different data types. For details, see TextAdapter.

Animator

Represents an animator.

AnimatorCallback

Represents the animator callback.

AnimatorManager

Represents the animator manager.

struct BinHeader for font refer to ui_font.h

ButtonStyle

Stores styles of a button in its different states.

CancelEvent

Defines a cancel event, which usually occurs when the target view changes due to user sliding. For example, this event is triggered if you, after pressing a button, does not release the button but slides.

ClickEvent

Defines a click event, which indicates that a finger is pressed on the screen and then lifted within 1 second.

Color

Converts colors in different formats and defines common colors.

Color16

Defines the color attribute when the color depth is 16.

Color24

Defines the color attribute when the color depth is 24.

Color32

Defines the color attribute when the color depth is 32.

DragEvent

Defines a drag event, which indicates a certain movement (more than 10 pixels) after a view is pressed.

EasingEquation

Defines functions for specifying the velocity of an animation.

Event

Defines the base class of a user input event and provides functions to record information such as the event position and timestamp.

FlexLayout

Defines a flexible layout container. You can perform simple adaptive layout on child views that the container holds, for example, to evenly arrange all child views in the same row or column.

struct GlyphHeader for font, font tool using, not for bin file refer to ui_font.h

GlyphNode

struct GlyphNode for font refer to ui_font.h

GridLayout

Defines a grid layout container. You can perform simple grid layout on child views that the container holds.

IBufferConsumerListener

Defines the consumer listener used to notify consumers when the surface status is updated.

Image

Represents basic image attributes, including the image type and path.

ImageAnimatorInfo

ImageInfo

Defines image information.

Interpolation

Calculates the Bezier interpolation.

KernNode

struct KernNode for kerning of font refer to ui_font.h

KeyEvent

Defines a key event, which indicates that a physical button is pressed or released.

struct LangBinHeader for font refer to ui_font.h

struct LangFontBinHeader for font refer to ui_font.h

struct LangTexsTableHeader for font refer to ui_font.h

LangTexsUtf8Param

struct LangTexsUtf8Param for font refer to ui_font.h

Layout

Defines the base class of the layout, which indicates the basic data types and operations that may be used in the layout.

Line

Defines a line, which consists of the start and end points.

List

Defines a linked list template class, which implements the data structure of bidirectional linked list and provides basic functions such as adding, deleting, inserting, clearing, popping up, and obtaining the size of the linked list.

ListNode

Stores linked list data and contains pointers to the previous node and the next node.

ListScrollListener

Represents a listener that contains a callback to be invoked when the scroll state changes or when a new child view is selected at the preset position as this list scrolls. The scroll state can be SCROLL_STATE_STOP or SCROLL_STATE_MOVE.

LongPressEvent

Defines a long-press event, which indicates that the finger is not raised or moved within 1 second after a view is pressed.

Matrix3

Defines a 3 x 3 matrix.

Paint

Defines the basic styles of graphs drawn on canvases.

Point

Defines a point.

Polygon

Defines a polygon, including vertex coordinates and the maximum number of vertices (defined by MAX_VERTEX_NUM).

PressEvent

Defines a touch event, which indicates that the touchscreen or mouse is pressed.

RawEvent

struct of raw event

Rect

Defines a rectangle, including the position data of the four boundaries of the rectangle, and provides functions for rectangle inclusion, intersection, and aggregation.

ReleaseEvent

Defines a release event, which indicates that the touchscreen or mouse is released.

RootView

Defines the functions related to a root view which contains its child views and represents the root node in a tree structure.

StyleDefault

Define some default style for UIView.

Surface

Defines the consumer listener used to notify consumers when the surface status is updated.

SurfaceBuffer

Provides functions such as setting the virtual address, size, and additional attributes of shared memory.

SysInfo

Obtains the system information. Currently, the FPS information can be obtained. To enable the FPS feature, enable the ENABLE_FPS_SUPPORT macro.

Text

Represents the base class of Text, providing the text attribute setting and text drawing capabilities for components that require font display.

Defines a text adapter, which implements UILabel instance construction and supports text data and continuous integer data.

TextFormatter

Defines a text formatter. You can inherit this class and implement the Format() function.

ThemeManager

Declares the singleton class used to manage the current screen theme of an application.

TransformMap

Transforms a rectangle, including rotation and scaling.

UIAbstractClock

An abstract class that contains functions for converting units of time (hour, minute, and second), setting and obtaining the time.

UIAbstractProgress

Represents the abstract base class which provides functions related to the progress bar.

UIAbstractScroll

Defines the attributes of a scroll, including the scroll direction, blank size of a scroll view, velocity and effects of a scroll animation.

UIAnalogClock

Provides the functions related to an analog clock.

UIArcLabel

Defines functions related to an arc label.

UIAxis

Represents the coordinate axis base class, which defines the basic attributes of coordinate axis, sets whether a coordinate axis is visible, and sets the number of scales on a coordinate axis. This class is used in UIChart.

UIBoxProgress

Represents a linear progress bar.

UIButton

Represents a button.

UICanvas

Defines a canvas, which is used to draw multiple types of 2D graphs.

UIChart

Defines the chart class and provides functions such as adding and deleting data sets to display a chart.

UIChartDataSerial

Defines a data set and provides functions such as adding and deleting data points.

UIChartPillar

Provides special functions for implementing a bar chart.

UIChartPolyline

Provides special functions for implementing a polyline.

UICheckBox

Represents a check box.

UICircleProgress

Represents a circular progress bar.

UIDialog

Represents a dialog box.

UIDigitalClock

Displays time digitally.

UIDumpDomTree

Provides functions for exporting information about a specified DOM node or information about the DOM tree starting from a specified DOM node.

UIImageAnimatorView

Represents an image animator.

UIImageView

Defines the functions related to an image view.

UILabel

Defines the functions for presenting a label in a specified area, setting the style and background color of a label, and setting the display mode of a long label text.

UILabelButton

Provides the functions related to a label button.

UIList

Represents a scrollable list which is used with the adapter AbstractAdapter to implement scrolling, inertial scrolling, automatic alignment, and invoking of a callback when a child view is selected at the preset position as this list scrolls.

UIPicker

Defines a picker. Multiple texts or numbers can be put into a sliding list for selection. The selected text or numbers are highlighted.

UIRepeatButton

Represents a repeat button.

UIScrollView

Supports horizontal or vertical scroll of child views. This class is inherited from UIAbstractScroll.

UISlider

Represents a slider.

UISnapShot

Represents the UISnapShot class.

UISwipeView

Represents a swipe view.

UITextureMapper

Rotates and scales images.

UITimePicker

Defines the time picker. The time is in the format of “hour:minute” or “hour:minute:second”. The selected time is highlighted.

UIToggleButton

Represents a toggle button.

UIView

Defines the base class of a view, providing basic view attributes and operations. All views are derived from this class.

UIViewGroup

Represents a view group that consists of its child views.

UIXAxis

Defines the unique attributes and functions for the x-axis. This class is used in UIChart.

UIYAxis

Defines the unique attributes and functions for the y-axis. This class is used in UIChart.

Vector2

Defines the two-dimensional vector, and provides basic mathematical operations such as vector assignment, scalar product, cross product, addition, and subtraction.

Vector3

Defines the 3-dimensional vector, and provides basic operators such as [] and ==.

VirtualDeviceEvent

Defines a virtual device event, which is used to receive a customized input event and call back the listening function registered.

Window

Provides a drawing canvas for the RootView, which represents the root node of a view tree.

WindowConfig

Sets the attributes for this window.

## Typedefs

Typedef Name

Description

EasingFunc) (int16_t startPos, int16_t endPos, uint16_t curTime, uint16_t durationTime)

typedef int16_t(*

Calculates the value for the current time of an animation.

## Enumerations

Enumeration Name

Description

{ OPA_TRANSPARENT = 0, OPA_OPAQUE = 255 }

Enumerates opacity values.

Enumerates text alignment modes.

UITextLanguageDirect : uint8_t { TEXT_DIRECT_LTR = 0, TEXT_DIRECT_RTL }

Enumerates text directions.

ColorMode : uint8_t {   ARGB8888 = 0, RGB888, RGB565, ARGB1555,   ARGB4444, AL44, AL88, L1,   L2, L4, L8, A1,   A2, A4, A8, UNKNOW }

colormode of image and font.

Enumerates keys of styles.

Enumerates shared memory usage scenarios, including physically contiguous memory and virtual memory.

Enumerates a pixel format.

Enumerates the pixel formats of this window.

## Functions

Function Name

Description

GetTextLangFontsTable (uint8_t langFontId)

UITextLanguageFontParam

Get the Text Lang Fonts Table.

uint8_t

Get the Total Lang Id.

uint8_t

Get the Total Font Id.

uint16_t

Get the Total Text Id.

LangTextParam

Get the Lang Text default param table.

Intersect (const Line &a, const Line &b, Vector2< int16_t > &out)

bool

Checks whether line segment a and line segment b intersect, and returns the intersection point (if available).

IsIntersect (const Line &a, const Line &b)

bool

Chekcs whether line segment a and line segment b intersect.

Clip (Polygon &poly, const Line &line)

void

Clips a polygon by using a line segment.

SuthHodgClip (const Rect &clipRect, const Polygon &polygon)

Implements Sutherland-Hodgman, an algorithm used for clipping polygons.

Clip (const Line &line, const Polygon &poly, Vector2< int16_t > pOut, uint8_t pNum)

void

Clips a polygon by using a line segment and obtains the intersections.

ImageCacheMalloc (ImageInfo &info)

void

Applies for the image cache memory. You can customize the memory area when loading image resources.

ImageCacheFree (ImageInfo &info)

void

Releases the image cache memory.

UIMalloc (uint32_t size)

void

Applies for memory for the graphics module. You can implement this function to override the malloc and new functions.

UIFree (void *buffer)

void

Releases memory for the graphics module. You can implement this function to override the free and delete functions.

Rotate (const Vector2< int16_t > &point, int16_t angle, const Vector2< int16_t > &pivot, Vector2< int16_t > &out)

void

Rotates a point around the pivot by a certain angle.

Rotate (const Line &origLine, int16_t angle, const Vector2< int16_t > &pivot, Line &out)

void

Rotates a line around the pivot by a certain angle.

Rotate (const Rect &origRect, int16_t angle, const Vector2< int16_t > &pivot, Polygon &out)

void

Rotates a rectangle around the pivot by a certain angle.

std::string

Obtains the version number of the graphics module.

std::string

Obtains the library description of the graphics module.

## InputDevType

enum[OHOS::InputDevType](\$api-api-SmartVision-Devices-OHOS.md#ac4e2abaf935793b876fbe5905d560e92)

Enumerator

Description

INDEV_TYPE_KEY

Touchscreen

INDEV_TYPE_KEYBOARD

Physical key

INDEV_TYPE_MOUSE

Keyboard

INDEV_TYPE_BUTTON

Mouse

INDEV_TYPE_CROWN

Virtual button

INDEV_TYPE_ENCODER

Watch crown

INDEV_TYPE_UNKNOWN

Customized type of a specific function or event

## GetLangTextDefaultParamTable()

LangTextParam* OHOS::GetLangTextDefaultParamTable()

Description:

Get the Lang Text default param table.

Returns:

LangTextParam* the param table, definition is in font tool

## GetTextLangFontsTable()

UITextLanguageFontParam* OHOS::GetTextLangFontsTable(uint8_t langFontId)

Description:

Get the Text Lang Fonts Table.

Parameters:

Name

Description

uint8_tlangFontId [in] the font id

Returns:

UITextLanguageFontParam* the font table, definition is in font tool

## GetTotalFontId()

uint8_t OHOS::GetTotalFontId()

Description:

Get the Total Font Id.

Returns:

uint8_t the total font id, definition is in font tool

## GetTotalLangId()

uint8_t OHOS::GetTotalLangId()

Description:

Get the Total Lang Id.

Returns:

uint8_t the total Lang id, definition is in font tool

## GetTotalTextId()

uint16_t OHOS::GetTotalTextId()

Description:

Get the Total Text Id.

Returns:

uint8_t the total text id, definition is in font tool