colorplane
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@ -72,11 +72,12 @@ namespace ams
 | 
				
			|||||||
        void clear();
 | 
					        void clear();
 | 
				
			||||||
        void setall(amspixel color);
 | 
					        void setall(amspixel color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					        amsbitplane get_colorplane(int Ncp);
 | 
				
			||||||
 | 
					        int set_colorplane(int Ncp, const amsbitplane *bp);
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        //todo
 | 
					        //todo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        int get_colorplane(int Ncp, amsbitplane* bp);
 | 
					 | 
				
			||||||
        int set_colorplane(int Ncp, const amsbitplane* bp);
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        //applies image with alpha blending
 | 
					        //applies image with alpha blending
 | 
				
			||||||
        int apply_image(int I0, int J0, amsimage *img);
 | 
					        int apply_image(int I0, int J0, amsimage *img);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -583,4 +583,53 @@ namespace ams
 | 
				
			|||||||
        return;
 | 
					        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