From c19d0fffe725eddd04e623d53c36b0400c16aa4a Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Tue, 11 Jul 2023 20:19:51 +0800 Subject: [PATCH] added BlendBitmap<> --- inc/hgl/2d/Bitmap.h | 6 ++++++ inc/hgl/2d/Blend.h | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/inc/hgl/2d/Bitmap.h b/inc/hgl/2d/Bitmap.h index fa30195..bbc6812 100644 --- a/inc/hgl/2d/Bitmap.h +++ b/inc/hgl/2d/Bitmap.h @@ -48,6 +48,12 @@ namespace hgl return (x<0||x>=width||y<0||y>=height)?nullptr:data+(y*width+x); } + const T *GetData()const{return data;} + const T *GetData(int x,int y)const + { + return (x<0||x>=width||y<0||y>=height)?nullptr:data+(y*width+x); + } + bool Create(uint w,uint h) { if(!w||!h)return(false); diff --git a/inc/hgl/2d/Blend.h b/inc/hgl/2d/Blend.h index 3b16ad0..618ec91 100644 --- a/inc/hgl/2d/Blend.h +++ b/inc/hgl/2d/Blend.h @@ -1,6 +1,7 @@ -#pragma once +#pragma once #include +#include namespace hgl { @@ -18,5 +19,15 @@ namespace hgl return src; } };//template struct BlendColor + + /** + * 位图混合处理模板 + */ + template class BlendBitmap + { + public: + + void operator ()(const Bitmap *src,Bitmap
*dst,const float alpha)const; + };//template class BlendBitmap }//namespace bitmap -}//namespace hgl \ No newline at end of file +}//namespace hgl