Skip to content

Commit

Permalink
Update website docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gezhaoyou committed Feb 3, 2024
1 parent 11de9d4 commit d4a5578
Show file tree
Hide file tree
Showing 36 changed files with 500 additions and 27 deletions.
163 changes: 148 additions & 15 deletions docs/docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,158 @@ export default defineConfig({
title: "GPUPixel",
titleTemplate: ':title - GPUPixel',
description: "Cross-Platform AI Beauty Effects Library, Achieving Commercial-Grade Beauty Effects. Written in C++11, Based on OpenGL/ES and VNN.",
head: [['link', { rel: 'icon', href: 'image/favicon/favicon.ico' }]],

locales: {
root: {
label: '简体中文',
lang: 'zh-CN',
link: '/'
},
en: {
label: 'English',
lang: 'en-US',
link: '/en/',
themeConfig: {
nav: nav_en(),
docFooter: {
prev: 'Previous Page',
next: 'Next Page'
},
outlineTitle: 'On this page',
editLink: {
pattern: 'https://github.com/pixpark/gpupixel/docs/docs/en/:path',
text: 'Edit this page on GitHub'
},
darkModeSwitchLabel: 'Appearance',
sidebarMenuLabel: 'Menu',
returnToTopLabel: 'Return to top',
langMenuLabel: 'Change Language',
lastUpdatedText: 'Last Updated'
}
}
},

appearance: true,
lastUpdated: true,
ignoreDeadLinks: true,
markdown: {
// theme: 'material-theme-palenight',
lineNumbers: false
},

themeConfig: {
// https://vitepress.dev/reference/default-theme-config,
nav: [
{ text: 'Home', link: '/' },
{ text: 'Docs', link: '/markdown-examples' }
],
logo: '/image/logo.png',
sidebar: [
{
text: 'Docs',
items: [
{ text: 'Markdown Examples', link: '/markdown-examples' },
{ text: 'Runtime API Examples', link: '/api-examples' }
]
i18nRouting: true,
lastUpdatedText: '最近更新时间',
outline: 'deep',
outlineTitle: '本页目录',
editLink: {
pattern: 'https://github.com/pixpark/gpupixel/docs/docs/:path',
text: '在 GitHub 上编辑此页'
},
search: {
provider: 'local',
options: {
locales: {
root: {
translations: {
button: {
buttonText: '搜索文档',
buttonAriaLabel: '搜索文档'
},
modal: {
noResultsText: '无法找到相关结果',
resetButtonTitle: '清除查询条件',
footer: {
selectText: '选择',
navigateText: '切换',
closeText: '关闭'
}
}
}
}
}
}
],
},
// https://vitepress.dev/reference/default-theme-config,


nav: nav(),

sidebar: {
'/': sidebarDocs()
},

footer: {
message: '基于 MIT License 发布',
copyright: 'Copyright © 2023-present @PixPark'
},
docFooter: {
prev: '上一页',
next: '下一页'
},

socialLinks: [
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' }
{ icon: 'github', link: 'https://github.com/pixpark/gpupixel' },
{ icon: 'youtube', link: 'https://www.youtube.com/@pixpark' },
{ icon: 'x', link: 'https://pixpark.net' }
]
}
})
})

function nav() {
return [
{ text: '主页', link: '/' },
{ text: '文档', link: '/intro' },
// { text: '1.1.x',
// items: [
// { text: '变更日志', link: 'https://github.com/vuejs/vitepress/blob/main/CHANGELOG.md' },
// { text: '贡献', link: 'https://github.com/vuejs/vitepress/blob/main/.github/contributing.md' }
// ]
// }
]
}

function nav_en() {
return [
{ text: 'Guide', link: '/en/guide/what-is-vitepress' },
{ text: 'Reference', link: '/en/reference/site-config' },
{ text: '1.0.0-beta.1',
items: [
{ text: 'Changelog', link: 'https://github.com/vuejs/vitepress/blob/main/CHANGELOG.md' },
{ text: 'Contributing', link: 'https://github.com/vuejs/vitepress/blob/main/.github/contributing.md' }
]
}
]
}

function sidebarDocs() {
return [
{
text: '快速开始',
collapsed: false,
items: [
{ text: '简介', link: '/intro' },
{ text: '源码编译', link: '/how-to-build' },
{ text: 'SDK集成', link: '/how-to-use' }
]
},
{
text: '滤镜',
collapsed: true,
items: [
{ text: '内建滤镜', link: '/in-buiding' },
{ text: '自定义滤镜', link: '/in-buiding' },
]
},
{
text: '源码分析',
collapsed: true,
items: [
{ text: '架构', link: '/in-buiding' },
{ text: '流程', link: '/in-buiding' },
]
}
]
}
19 changes: 19 additions & 0 deletions docs/docs/.vitepress/theme/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* .vitepress/theme/custom.css colors */
:root {
--vp-c-brand: #646cff;
--vp-c-brand-light: #747bff;
--vp-c-brand-lighter: #9499ff;
--vp-c-brand-lightest: #bcc0ff;
--vp-c-brand-dark: #535bf2;
--vp-c-brand-darker: #454ce1;
--vp-c-brand-dim: rgba(100,108,255,0.08);
}

/* .vitepress/theme/custom.css home */

:root {
--vp-home-hero-image-background-image: linear-gradient( -45deg, #bd34fe 50%, #47caff 50% );
--vp-home-hero-image-filter: blur( 40px );
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient( 120deg, #bd34fe 30%, #41d1ff );
}
7 changes: 7 additions & 0 deletions docs/docs/.vitepress/theme/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// .vitepress/theme/index.js
import DefaultTheme from 'vitepress/theme';
import './custom.css';
export default DefaultTheme;



File renamed without changes.
25 changes: 25 additions & 0 deletions docs/docs/en/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
# https://vitepress.dev/reference/default-theme-home-page
layout: home

hero:
name: "GPUPixel"
text: "Real-Time AI Image Beauty Filter Library"
tagline: Achieving Commercial-Grade Beauty Effects
actions:
- theme: brand
text: Markdown Examples
link: /markdown-examples
- theme: alt
text: API Examples
link: /api-examples

features:
- title: Feature A
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature B
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature C
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
---

File renamed without changes.
85 changes: 85 additions & 0 deletions docs/docs/how-to-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
outline: deep
---

# 编译
::: tip
从 v1.1.0 版本开始,源码使用CMake编译,请自行搜索如何安装和配置CMake
生成的库和应用程序将位于项目根文件夹下的"output"目录中
:::

## iOS

```shell
cd src
mkdir build
cd build

# 生成工程
## for iOS arm64
cmake -G Xcode -DCMAKE_TOOLCHAIN_FILE=../../toolchain/ios.toolchain.cmake -DPLATFORM=OS64 ..

# 编译
cmake --build . --config Debug
```

## Mac

```shell
cd src
mkdir build
cd build

# 生成工程
## for Mac Apple Silicon
cmake -G Xcode -DCMAKE_TOOLCHAIN_FILE=../../toolchain/ios.toolchain.cmake -DPLATFORM=MAC_ARM64 ..
## for Mac Intel
cmake -G Xcode -DCMAKE_TOOLCHAIN_FILE=../../toolchain/ios.toolchain.cmake -DPLATFORM=MAC ..

# 编译
cmake --build . --config Debug
```

## Android

使用Android Studio打开目录 `src/android/java`,安卓的工程

## Windows

你需要自己安装和配置 Cmake 以及 MinGW64.

```shell
cd src
mkdir build
cd build

# 生成工程
cmake -G "MinGW Makefiles" ..

# 编译
mingw32-make
```

## Linux (只测试了ubuntu)

```shell
# 安装cmake
sudo apt-get install cmake pkg-config
# 安装依赖
sudo apt-get install mesa-utils libglu1-mesa-dev freeglut3-dev mesa-common-dev libglfw3-dev

# start build
cd src
mkdir build
cd build

# 生成工程
cmake ..

# 编译
make
```

---

###
78 changes: 78 additions & 0 deletions docs/docs/how-to-use.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
outline: deep
---

# 简单的调用说明
**声明filters**

```c++
// video data input
std::shared_ptr<SourceRawDataInput> source_raw_input_;
// beauty filter
std::shared_ptr<BeautyFaceFilter> beauty_face_filter_;
// video data output
std::shared_ptr<TargetRawDataOutput> target_raw_output_;
```

**Create and link filters**

```c++
gpupixel::GPUPixelContext::getInstance()->runSync([&] {
// Create filter
source_raw_input_ = SourceRawDataInput::create();
target_raw_output_ = TargetRawDataOutput::create();
// Face Beauty Filter
beauty_face_filter_ = BeautyFaceFilter::create();

// Add filter
source_raw_input_->addTarget(beauty_face_filter_)
->addTarget(target_raw_output_);
}
```
**输入 YUV420P 或 RGBA数据**
```c++
// ...
// YUVI420
source_raw_input_->uploadBytes(width,
height,
bufferY,
strideY,
bufferU,
strideU,
bufferV,
strideV);
// ...
// bytes: RGBA data
source_raw_input_->uploadBytes(bytes,
width,
height,
stride);
```

**设置输出数据 YUV或RGB回调**

```c++
// I420 callback
target_raw_output_->setI420Callbck([=](const uint8_t *data,
int width,
int height,
int64_t ts) {
size_t y_size = width * height;
const uint8_t *uData = data + y_size;
const uint8_t *vData = data + y_size + y_size / 4;
// Do something you want
});

// RGBA callback->
target_raw_output_->setPixelsCallbck([=](const uint8_t *data,
int width,
int height,
int64_t ts) {
size_t rgba_size = width * height*4;
// Do something you want
});

// Output data callbck
```
Binary file added docs/docs/image/arch-en.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/image/arch-zh.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/image/beauty-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/image/beauty-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/image/beauty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/image/bigeye.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/image/blusher.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/image/describe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/image/favicon/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d4a5578

Please sign in to comment.