From e05494c0ff789c8840f8ce188d04ce2e4d546e4b Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Tue, 11 Jul 2023 15:37:32 +0800 Subject: [PATCH] added PutPixel/GetPixel in Bitmap<> --- inc/hgl/2d/Bitmap.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/inc/hgl/2d/Bitmap.h b/inc/hgl/2d/Bitmap.h index 2e2fdd2..0dae33b 100644 --- a/inc/hgl/2d/Bitmap.h +++ b/inc/hgl/2d/Bitmap.h @@ -159,6 +159,40 @@ namespace hgl delete[] temp; } + + void PutPixel(int x,int y,const T *color) + { + if(!data||!color)return; + + if(x<0||y<0||x>=width||y>=height)return; + + T *p=data+(y*width+x)*CHANNELS; + + for(uint i=0;i=width||y>=height)return(false); + + T *p=data+(y*width+x)*CHANNELS; + + for(uint i=0;i class Bitmap using BitmapR8 =Bitmap;