← 블로그 목록

[Core2026] ETC - Clipping

Core2026 › Engine › CPU Engine › ETC

@Nor-s
  • #ThorVG
  • #Core
  • #CPU
  • #Clipping
목차

Overview

Paint::clip(Shape* clipper)

One avatar example follows Paint::clip, Paint::Impl::clipper, the shared SwShapeTask, photo and badge RLE intersections, and final drawing. The API section shows inputs and ownership; output appears only in Draw.
0:00
Image and clip RLE intersection.
0:00
Sequential clipping of image RLE.
0:00
코드 보기: 클리핑 예제와 소스

둥근 클리퍼의 RLE를 사진과 배지의 렌더 영역에 적용합니다.

// photoPixels: decoded 16 × 12 pixels in ABGR8888.
auto background = Shape::gen();
background->appendRect(0, 0, 16, 12);
background->fill(232, 238, 241);

auto avatar = Scene::gen();
auto photo = Picture::gen();
photo->load(photoPixels, 16, 12, ColorSpace::ABGR8888, true);
auto badge = Shape::gen();
badge->appendCircle(12, 8.5, 2, 2);
badge->fill(35, 160, 100);
avatar->add(photo);
avatar->add(badge);

auto roundClip = Shape::gen();
roundClip->appendCircle(8, 5.5, 5, 5);
avatar->clip(roundClip);  // Paint::clip(Shape*)

canvas->add(background);
canvas->add(avatar);
canvas->update();
canvas->draw(true);
canvas->sync();

Mask · Viewport