//-------------------------------------------------------------------// // RefreshImages() // //-------------------------------------------------------------------// // This is called during palette changes to reload images. //-------------------------------------------------------------------// void OleListCtrl::RefreshImages() { RemoveImageList( LVSIL_NORMAL ); ObjectImages.DeleteImageList(); RemoveImageList( LVSIL_SMALL ); SmallObjectImages.DeleteImageList(); AddImages(); Invalidate(); }
//-------------------------------------------------------------------// // Initialize() // //-------------------------------------------------------------------// // Similar to the tree control situation, we were not able to find a // built-in init function, so we were forced to add one of our own, // which must be called manually by the object containing this one. // This function sets up the image list. Note that we can compile // with this code in PreSubclassWindow(), but the images are not // loaded. Therefore, we need an Initialize() function. //-------------------------------------------------------------------// void OleListCtrl::Initialize() { // Call the base class to set up the correct styles. inherited::Initialize(); // Add images. AddImages(); // TO DO // If you want to be able to do this, you should add dwInitialDisplayStyle // as a constructor param, so we can still use a generic Initialize() // function that carries through base and derived classes. /* // Set the requested style type. if ( dwInitialDisplayStyle != 0 ) { ModifyStyle( LVS_SMALLICON | LVS_REPORT | LVS_ICON | LVS_LIST | LVS_SHOWSELALWAYS, dwInitialDisplayStyle ); } */ // Load accelerators. See MSJ July 97 C++ Q&A. Thanks again Paul. m_hAccel = ::LoadAccelerators( AfxGetInstanceHandle(), MAKEINTRESOURCE( IDA_OLE_LIST_ACCELERATORS ) ); ASSERT( m_hAccel ); UpdateAfterDrop(); }
int main(int argv, char** argc) { std::string fInPath; fInPath += argc[1]; int length = atoi(argc[2]); int width = atoi(argc[3]); unsigned char **origImage = (unsigned char **)malloc(sizeof(unsigned char *)*length); for(int i = 0; i<length; i++) { origImage[i] = (unsigned char *)malloc(sizeof(unsigned char)*width); for(int j = 0; j<width; j++) origImage[i][j] = 0; } //Import Image importImage(fInPath, origImage, length, width); printf("Importing image\n"); //Copy Image for Horz and Vertical Sobels unsigned char **horizImage = (unsigned char **)malloc(sizeof(unsigned char *)*length); for(int i = 0; i<length; i++) { horizImage[i] = (unsigned char *)malloc(sizeof(unsigned char)*width); for(int j = 0; j<width; j++) horizImage[i][j] = 0; } unsigned char **vertiImage = (unsigned char **)malloc(sizeof(unsigned char *)*length); for(int i = 0; i<length; i++) { vertiImage[i] = (unsigned char *)malloc(sizeof(unsigned char)*width); for(int j = 0; j<width; j++) vertiImage[i][j] = 0; } printf("coping images to horizImage and vertiImage\n"); copyImage(origImage, length, width, horizImage); copyImage(origImage, length, width, vertiImage); printf("getting horiz\n"); //Apply Horiz Sobel HorizSobel(horizImage, length, width); std::string horizPath; horizPath += fInPath; horizPath += "_Horiz"; saveImage(horizPath, horizImage, length, width); viewImage(horizPath, length, width); printf("getting verti\n"); //Apply Vertical Sobel VertiSobel(vertiImage, length, width); std::string vertiPath; vertiPath += fInPath; vertiPath += "_Verti"; saveImage(vertiPath, vertiImage, length, width); viewImage(vertiPath, length, width); //Add together unsigned char **sobelImage = (unsigned char **)malloc(sizeof(unsigned char *)*length); for(int i = 0; i<length; i++) { sobelImage[i] = (unsigned char *)malloc(sizeof(unsigned char)*width); for(int j = 0; j<width; j++) sobelImage[i][j] = 0; } AddImages(sobelImage, horizImage, length, width); AddImages(sobelImage, vertiImage, length, width); //Save and View Image std::string fOutPath; fOutPath += fInPath; fOutPath += "_Sobel"; saveImage(fOutPath, sobelImage, length, width); viewImage(fOutPath, length, width); /**/ }