提交 8463f568 编写于 作者: O openharmony_ci 提交者: Gitee

!228 添加图片圆形裁剪接口

Merge pull request !228 from pssea/master
......@@ -938,6 +938,7 @@ bool UIView::GetBitmap(ImageInfo& bitmap)
newBufferInfo.width = bufferWidth;
newBufferInfo.height = bufferHeight;
newBufferInfo.mode = bufferInfo->mode;
newBufferInfo.stride = bufferWidth * DrawUtils::GetByteSizeByColorMode(bitmap.header.colorMode);
RootView::GetInstance()->SaveDrawContext();
RootView::GetInstance()->UpdateBufferInfo(&newBufferInfo);
......
......@@ -17,6 +17,7 @@
#include <cstdlib>
#include "draw/clip_utils.h"
#include "draw/draw_arc.h"
#include "draw/draw_curve.h"
#include "draw/draw_line.h"
......@@ -79,6 +80,15 @@ void BaseGfxEngine::DrawTransform(BufferInfo& dst,
opacity, transMap, dataInfo);
}
void BaseGfxEngine::ClipCircle(const ImageInfo* info, float x, float y, float radius)
{
ClipPath path;
path.Circle({x, y}, radius);
ClipImageBlitter blitter(info);
ClipUtils clip;
clip.PerformScan(path, blitter);
}
void BaseGfxEngine::Blit(BufferInfo& dst,
const Point& dstPos,
const BufferInfo& src,
......
......@@ -106,6 +106,9 @@ public:
const TransformMap& transMap,
const TransformDataInfo& dataInfo);
// x/y: center of a circle
virtual void ClipCircle(const ImageInfo* info, float x, float y, float radius);
virtual void Blit(BufferInfo& dst,
const Point& dstPos,
const BufferInfo& src,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册