AColor#
Represents a 4-component floating point color (RGBA).
Header: | #include <AUI/Common/AColor.h> |
CMake: | aui_link(my_target PUBLIC aui::core) |
Examples#
examples/app/game_of_life/src/main.cpp
Game of Life - Game of Life implementation that uses advanced large dynamic data rendering techniques such as ITexture, AImage to be GPU friendly. The computation is performed in AThreadPool.
}
for (int i = 1; i < mCells->size().y; ++i) {
points << std::make_pair(glm::vec2(0.f, i * SCALE), glm::vec2(getSize().x, i * SCALE));
}
ctx.render.lines(ASolidBrush { AColor::GRAY }, points);
};
drawGrid();
}
void onPointerPressed(const APointerPressedEvent& event) override {
examples/app/minesweeper/src/CellView.cpp
Minesweeper Game - Minesweeper game implementation driven by ass.
if (count) {
AFontStyle fs;
fs.size = getHeight() * 6 / 7;
fs.align = ATextAlign::CENTER;
auto color = AColor::BLACK;
switch (count) {
case 1:
color = 0x0000ffffu;
break;
examples/ui/contacts/src/view/ContactDetailsView.cpp
AUI Contacts - Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.
}) AUI_WITH_STYLE { Opacity(0.5f), FontSize { 32_dp } },
} AUI_WITH_STYLE {
FixedSize { 64_dp },
BorderRadius { 32_dp },
BackgroundGradient { AColor::GRAY.lighter(0.5f), AColor::GRAY, 163_deg },
};
}
template <typename T>
_<AView> viewer(AProperty<T>& property) {
examples/ui/contacts/src/view/common.cpp
AUI Contacts - Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.
using namespace ass;
using namespace declarative;
_<AView> common_views::divider() {
return _new<AView>() AUI_WITH_STYLE { FixedSize { {}, 1_px }, BackgroundSolid { AColor::GRAY } };
}
examples/7guis/flight_booker/src/main.cpp
7GUIs Flight Booker - Flight Booker.
public:
FlightBookerWindow() : AWindow("AUI - 7GUIs - Book Flight", 150_dp, 50_dp) {
setExtraStylesheet(AStylesheet { {
ass::c(".red"),
ass::BackgroundSolid { AColor::RED },
} });
setContents(Centered {
Vertical {
_new<ADropdownList>(AListModel<AString>::make({ "one-way flight", "return flight" })) AUI_LET {
connect(it->selectionId().readProjected([](int selectionId) { return selectionId == 1; }),
examples/7guis/cells/src/main.cpp
7GUIs Cells - Spreadsheet processor (Excel).
for (unsigned row = 0; row < mState->spreadsheet.size().y; ++row) {
views[row + 1][0] = labelTitle("{}"_format(Cell::rowName(row)));
for (unsigned column = 0; column < mState->spreadsheet.size().x; ++column) {
views[row + 1][column + 1] = _new<CellView>(mState, mState->spreadsheet[{ column, row }]) AUI_WITH_STYLE {
BackgroundSolid { AColor::WHITE },
};
}
}
return views;
}())
examples/7guis/circle_drawer/src/main.cpp
7GUIs Circle Drawer - Undo, redo, dialog control.
Public Methods#
AColor#
Construct with hex integer
- Arguments
color
integer representing color in 0xRRGGBBAA
AColor(0xff0000ff)
will represent opaque bright red
Examples#
examples/app/game_of_life/src/main.cpp
Game of Life - Game of Life implementation that uses advanced large dynamic data rendering techniques such as ITexture, AImage to be GPU friendly. The computation is performed in AThreadPool.
}
for (int i = 1; i < mCells->size().y; ++i) {
points << std::make_pair(glm::vec2(0.f, i * SCALE), glm::vec2(getSize().x, i * SCALE));
}
ctx.render.lines(ASolidBrush { AColor::GRAY }, points);
};
drawGrid();
}
void onPointerPressed(const APointerPressedEvent& event) override {
examples/app/minesweeper/src/CellView.cpp
Minesweeper Game - Minesweeper game implementation driven by ass.
if (count) {
AFontStyle fs;
fs.size = getHeight() * 6 / 7;
fs.align = ATextAlign::CENTER;
auto color = AColor::BLACK;
switch (count) {
case 1:
color = 0x0000ffffu;
break;
examples/ui/contacts/src/view/ContactDetailsView.cpp
AUI Contacts - Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.
}) AUI_WITH_STYLE { Opacity(0.5f), FontSize { 32_dp } },
} AUI_WITH_STYLE {
FixedSize { 64_dp },
BorderRadius { 32_dp },
BackgroundGradient { AColor::GRAY.lighter(0.5f), AColor::GRAY, 163_deg },
};
}
template <typename T>
_<AView> viewer(AProperty<T>& property) {
examples/ui/contacts/src/view/common.cpp
AUI Contacts - Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.
using namespace ass;
using namespace declarative;
_<AView> common_views::divider() {
return _new<AView>() AUI_WITH_STYLE { FixedSize { {}, 1_px }, BackgroundSolid { AColor::GRAY } };
}
examples/7guis/flight_booker/src/main.cpp
7GUIs Flight Booker - Flight Booker.
public:
FlightBookerWindow() : AWindow("AUI - 7GUIs - Book Flight", 150_dp, 50_dp) {
setExtraStylesheet(AStylesheet { {
ass::c(".red"),
ass::BackgroundSolid { AColor::RED },
} });
setContents(Centered {
Vertical {
_new<ADropdownList>(AListModel<AString>::make({ "one-way flight", "return flight" })) AUI_LET {
connect(it->selectionId().readProjected([](int selectionId) { return selectionId == 1; }),
examples/7guis/cells/src/main.cpp
7GUIs Cells - Spreadsheet processor (Excel).
for (unsigned row = 0; row < mState->spreadsheet.size().y; ++row) {
views[row + 1][0] = labelTitle("{}"_format(Cell::rowName(row)));
for (unsigned column = 0; column < mState->spreadsheet.size().x; ++column) {
views[row + 1][column + 1] = _new<CellView>(mState, mState->spreadsheet[{ column, row }]) AUI_WITH_STYLE {
BackgroundSolid { AColor::WHITE },
};
}
}
return views;
}())
examples/7guis/circle_drawer/src/main.cpp
7GUIs Circle Drawer - Undo, redo, dialog control.
fromAARRGGBB#
Construct with hex integer
- Arguments
color
integer representing color in 0xAARRGGBB
AColor(0xff0000ff)
will represent opaque bright blue
fromRRGGBB#
Construct with hex integer
- Arguments
color
integer representing color in 0xRRGGBB
AColor(0x00ff00)
will represent opaque bright green
mul#
Multiply all color components except alpha channel (rgb * d, a)
- Arguments
d
multiplier- Returns
- multiplied color
opacify#
Increases the alpha channel by the given value.
transparentize#
Decreases the alpha channel by the given value.