colorplane
This commit is contained in:
@ -583,4 +583,53 @@ namespace ams
|
||||
return;
|
||||
}
|
||||
|
||||
amsbitplane amsimage::get_colorplane(int Ncp)
|
||||
{
|
||||
amsbitplane ret;
|
||||
int res;
|
||||
|
||||
res = ret.resize(this->Nx,this->Ny);
|
||||
if(res!=amsimage_success)
|
||||
{
|
||||
printf("amsimage::get_colorplane: error: bitplane failed to resize.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if(Ncp<0 || Ncp>=4)
|
||||
{
|
||||
printf("amsimage::get_colorplane: error: %d is outside indices of valid colorplanes [0,4)\n",Ncp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
imglib4::amsimage_plane_copy(
|
||||
ret.data,
|
||||
0,1,ret.Nx,ret.Ny,
|
||||
this->data,Ncp,4,this->Nx,this->Ny,
|
||||
0,0
|
||||
);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int amsimage::set_colorplane(int Ncp, const amsbitplane *bp)
|
||||
{
|
||||
int ret = amsimage_success;
|
||||
int res;
|
||||
|
||||
if(Ncp<0 || Ncp>=4)
|
||||
{
|
||||
ret = amsimage_failure;
|
||||
printf("amsimage::set_colorplane: error: %d is outside indices of valid colorplanes [0,4)\n",Ncp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
imglib4::amsimage_plane_copy(
|
||||
this->data, Ncp, 4, this->Nx, this->Ny,
|
||||
bp->data, 0, 1, bp->Nx, bp->Ny,
|
||||
0,0
|
||||
);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
};
|
Reference in New Issue
Block a user