📄 image.cpp
字号:
*pVal = oImage->baseColumns(); return S_OK;}STDMETHODIMP CImage::get_BaseRows(unsigned int *pVal){ // TODO: Add your implementation code here *pVal = oImage->baseRows(); return S_OK;}STDMETHODIMP CImage::get_ColorFuzz(double *pVal){ // TODO: Add your implementation code here *pVal = oImage->colorFuzz(); return S_OK;}STDMETHODIMP CImage::put_ColorFuzz(double newVal){ // TODO: Add your implementation code here oImage->colorFuzz(newVal); return S_OK;}STDMETHODIMP CImage::get_Density(BSTR *pVal){ // TODO: Add your implementation code here USES_CONVERSION; string strDensity = oImage->density(); CComBSTR cstrDensity = A2OLE(strDensity.c_str()); *pVal = cstrDensity; return S_OK;}STDMETHODIMP CImage::put_Density(BSTR newVal){ // TODO: Add your implementation code here USES_CONVERSION; oImage->density(newVal ? OLE2A(newVal) : ""); return S_OK;}STDMETHODIMP CImage::get_GIFDisposeMethod(unsigned int *pVal){ // TODO: Add your implementation code here *pVal = oImage->gifDisposeMethod(); return S_OK;}STDMETHODIMP CImage::put_GIFDisposeMethod(unsigned int newVal){ // TODO: Add your implementation code here // Probably should check to see if it's 0-4 oImage->gifDisposeMethod(newVal); return S_OK;}STDMETHODIMP CImage::get_Magick(BSTR *pVal){ // TODO: Add your implementation code here USES_CONVERSION; string strMagick = oImage->magick(); CComBSTR cstrMagick = A2OLE(strMagick.c_str()); *pVal = cstrMagick; return S_OK;}STDMETHODIMP CImage::put_Magick(BSTR newVal){ // TODO: Add your implementation code here USES_CONVERSION; oImage->magick(newVal ? OLE2A(newVal) : ""); return S_OK;}STDMETHODIMP CImage::get_Matte(VARIANT_BOOL *pVal){ // TODO: Add your implementation code here *pVal = oImage->matte(); return S_OK;}STDMETHODIMP CImage::put_Matte(VARIANT_BOOL newVal){ // TODO: Add your implementation code here oImage->matte(newVal); return S_OK;}STDMETHODIMP CImage::get_Monochrome(VARIANT_BOOL *pVal){ // TODO: Add your implementation code here *pVal = oImage->monochrome(); return S_OK;}STDMETHODIMP CImage::put_Monochrome(VARIANT_BOOL newVal){ // TODO: Add your implementation code here oImage->monochrome(newVal); return S_OK;}STDMETHODIMP CImage::get_NormalizedMaxError(double *pVal){ // TODO: Add your implementation code here *pVal = oImage->normalizedMaxError(); return S_OK;}STDMETHODIMP CImage::get_NormalizedMeanError(double *pVal){ // TODO: Add your implementation code here *pVal = oImage->normalizedMeanError(); return S_OK;}STDMETHODIMP CImage::get_QuantizedColors(unsigned int *pVal){ // TODO: Add your implementation code here *pVal = oImage->quantizeColors(); return S_OK;}STDMETHODIMP CImage::put_QuantizedColors(unsigned int newVal){ // TODO: Add your implementation code here oImage->quantizeColors(newVal); return S_OK;}STDMETHODIMP CImage::get_QuantizeDither(VARIANT_BOOL *pVal){ // TODO: Add your implementation code here *pVal = oImage->quantizeDither(); return S_OK;}STDMETHODIMP CImage::put_QuantizeDither(VARIANT_BOOL newVal){ // TODO: Add your implementation code here oImage->quantizeDither(newVal); return S_OK;}STDMETHODIMP CImage::get_QuantizeTreeDepth(unsigned int *pVal){ // TODO: Add your implementation code here *pVal = oImage->quantizeTreeDepth(); return S_OK;}STDMETHODIMP CImage::put_QuantizeTreeDepth(unsigned int newVal){ // TODO: Add your implementation code here oImage->quantizeTreeDepth(newVal); return S_OK;}STDMETHODIMP CImage::get_Scene(unsigned int *pVal){ // TODO: Add your implementation code here *pVal = oImage->scene(); return S_OK;}STDMETHODIMP CImage::put_Scene(unsigned int newVal){ // TODO: Add your implementation code here oImage->scene(newVal); return S_OK;}STDMETHODIMP CImage::get_StrokeAntiAlias(VARIANT_BOOL *pVal){ // TODO: Add your implementation code here *pVal = oImage->strokeAntiAlias(); return S_OK;}STDMETHODIMP CImage::put_StrokeAntiAlias(VARIANT_BOOL newVal){ // TODO: Add your implementation code here oImage->strokeAntiAlias(newVal); return S_OK;}STDMETHODIMP CImage::get_StrokeDashOffset(unsigned int *pVal){ // TODO: Add your implementation code here *pVal = oImage->strokeDashOffset(); return S_OK;}STDMETHODIMP CImage::put_StrokeDashOffset(unsigned int newVal){ // TODO: Add your implementation code here oImage->strokeDashOffset(newVal); return S_OK;}STDMETHODIMP CImage::get_StrokeMiterLimit(unsigned int *pVal){ // TODO: Add your implementation code here *pVal = oImage->strokeMiterLimit(); return S_OK;}STDMETHODIMP CImage::put_StrokeMiterLimit(unsigned int newVal){ // TODO: Add your implementation code here oImage->strokeMiterLimit(newVal); return S_OK;}STDMETHODIMP CImage::get_StrokeWidth(double *pVal){ // TODO: Add your implementation code here *pVal = oImage->strokeWidth(); return S_OK;}STDMETHODIMP CImage::put_StrokeWidth(double newVal){ // TODO: Add your implementation code here oImage->strokeWidth(newVal); return S_OK;}STDMETHODIMP CImage::get_SubImage(unsigned int *pVal){ // TODO: Add your implementation code here *pVal = oImage->subImage(); return S_OK;}STDMETHODIMP CImage::put_SubImage(unsigned int newVal){ // TODO: Add your implementation code here oImage->subImage(newVal); return S_OK;}STDMETHODIMP CImage::get_SubRange(unsigned int *pVal){ // TODO: Add your implementation code here *pVal = oImage->subRange(); return S_OK;}STDMETHODIMP CImage::put_SubRange(unsigned int newVal){ // TODO: Add your implementation code here oImage->subRange(newVal); return S_OK;}STDMETHODIMP CImage::get_TotalColors(unsigned long *pVal){ // TODO: Add your implementation code here *pVal = oImage->totalColors(); return S_OK;}STDMETHODIMP CImage::get_XResolution(double *pVal){ // TODO: Add your implementation code here *pVal = oImage->xResolution(); return S_OK;}STDMETHODIMP CImage::get_YResolution(double *pVal){ // TODO: Add your implementation code here *pVal = oImage->yResolution(); return S_OK;}STDMETHODIMP CImage::get_Signature(VARIANT_BOOL Force, BSTR *pVal){ // TODO: Add your implementation code here USES_CONVERSION; string strSig = oImage->signature(Force); CComBSTR cstrSig = A2OLE(strSig.c_str()); *pVal = cstrSig; return S_OK;}STDMETHODIMP CImage::get_Label(BSTR *pVal){ // TODO: Add your implementation code here USES_CONVERSION; string strLabel = oImage->label(); CComBSTR cstrLabel = A2OLE(strLabel.c_str()); *pVal = cstrLabel; return S_OK;}STDMETHODIMP CImage::put_Label(BSTR newVal){ // TODO: Add your implementation code here USES_CONVERSION; oImage->label(newVal ? OLE2A(newVal) : ""); return S_OK;}STDMETHODIMP CImage::Border(BSTR cGeometry, VARIANT_BOOL *pVal){ // TODO: Add your implementation code here try { USES_CONVERSION; oImage->border(cGeometry ? OLE2A(cGeometry) : ""); *pVal = true; } catch( Exception &error_ ) { string ErrorG = error_.what(); CImage::SetErrorMessage(ErrorG.c_str()); *pVal = false; } return S_OK;}STDMETHODIMP CImage::AddNoise(int nNoiseType, VARIANT_BOOL *pVal){ // TODO: Add your implementation code here // See \Magick-x.x.x\Magick\Classify.h for enums try { oImage->addNoise(static_cast<NoiseType>(nNoiseType)); } catch ( Exception &error_ ) { string ErrorG = error_.what(); CImage::SetErrorMessage(ErrorG.c_str()); *pVal = false; } return S_OK;}STDMETHODIMP CImage::Channel(int nChannelType, VARIANT_BOOL *pVal){ // TODO: Add your implementation code here // See \Magick-x.x.x\Magick\Classify.h for enums try { oImage->channel(static_cast<ChannelType>(nChannelType)); } catch ( Exception &error_ ) { string ErrorG = error_.what(); CImage::SetErrorMessage(ErrorG.c_str()); *pVal = false; } return S_OK;}STDMETHODIMP CImage::Chop(BSTR cGeometry, VARIANT_BOOL *pVal){ // TODO: Add your implementation code here try { USES_CONVERSION; oImage->chop(cGeometry ? OLE2A(cGeometry) : ""); } catch ( Exception &error_ ) { string ErrorG = error_.what(); CImage::SetErrorMessage(ErrorG.c_str()); *pVal = false; } return S_OK;}STDMETHODIMP CImage::CycleColormap(int nAmount, VARIANT_BOOL *pVal){ // TODO: Add your implementation code here try { oImage->cycleColormap(nAmount); } catch ( Exception &error_ ) { string ErrorG = error_.what(); CImage::SetErrorMessage(ErrorG.c_str()); *pVal = false; } return S_OK;}STDMETHODIMP CImage::Frame(unsigned int width, unsigned int height, int InnerBevel, int OuterBevel, VARIANT_BOOL *pVal){ // TODO: Add your implementation code here try { oImage->frame(width, height, InnerBevel, OuterBevel); } catch ( Exception &error_ ) { string ErrorG = error_.what(); CImage::SetErrorMessage(ErrorG.c_str()); *pVal = false; } return S_OK;}STDMETHODIMP CImage::Ping(BSTR cFilename, VARIANT_BOOL *pVal){ // TODO: Add your implementation code here try { USES_CONVERSION; oImage->ping(cFilename ? OLE2A(cFilename) : ""); } catch ( Exception &error_ ) { string ErrorG = error_.what(); CImage::SetErrorMessage(ErrorG.c_str()); *pVal = false; } return S_OK;}STDMETHODIMP CImage::Raise(BSTR cGeometry, VARIANT_BOOL RaisedFlag, VARIANT_BOOL *pVal){ // TODO: Add your implementation code here try { USES_CONVERSION; oImage->raise(cGeometry ? OLE2A(cGeometry) : ""); } catch ( Exception &error_ ) { string ErrorG = error_.what(); CImage::SetErrorMessage(ErrorG.c_str()); *pVal = false; } return S_OK;}STDMETHODIMP CImage::ReduceNoise(int Order, VARIANT_BOOL *pVal){ // TODO: Add your implementation code here try { oImage->reduceNoise(Order); } catch ( Exception &error_ ) { string ErrorG = error_.what(); CImage::SetErrorMessage(ErrorG.c_str()); *pVal = false; } return S_OK;}STDMETHODIMP CImage::Segment(double ClusterThreshold, double SmoothingThreshold, VARIANT_BOOL *pVal){ // TODO: Add your implementation code here try { oImage->segment(ClusterThreshold, SmoothingThreshold); } catch ( Exception &error_ ) { string ErrorG = error_.what(); CImage::SetErrorMessage(ErrorG.c_str()); *pVal = false; } return S_OK;}STDMETHODIMP CImage::Shave(BSTR cGeometry, VARIANT_BOOL *pVal){ // TODO: Add your implementation code here try { USES_CONVERSION; oImage->shave(cGeometry ? OLE2A(cGeometry) : ""); } catch ( Exception &error_ ) { string ErrorG = error_.what(); CImage::SetErrorMessage(ErrorG.c_str()); *pVal = false; } return S_OK;}STDMETHODIMP CImage::ShowMessage(long uiMsg){ // Sample code to test the idea of passing // the address of the underlying C++ class // when using COM. if(uiMsg > 0) { CImageControl* pImageControl = 0 ; pImageControl = reinterpret_cast<CImageControl*>(uiMsg); pImageControl->SampleMessage(); } return S_OK;}//IImageCollection **pVal)STDMETHODIMP CImage::get_Images(IImageCollection **pVal){ IImageCollection *pImageCollection; HRESULT hrImage = 0; // TODO: Add your implementation code here hrImage = this->QueryInterface(IID_IImageCollection, (void **)&pImageCollection); if (FAILED(hrImage)) { *pVal = NULL; } else { *pVal = pImageCollection; } return S_OK;}STDMETHODIMP CImage::GetImageAddress(long *pVal){ // NOTE: The technique used here of getting the image address is not // really a valid way to use a COM object. It's definitely in // realm of a "hack". These objects must be in the same address // space, and this definitely won't work under DCOM. //const long uiMem = reinterpret_cast<const long>(&oImage); const long uiMem = reinterpret_cast<const long>(oImage); *pVal = uiMem; return S_OK;}STDMETHODIMP CImage::TestAddress(const Magick::Image &pImage){ char buffer[20]; _itoa((long) &pImage, buffer, 10); MessageBox(NULL, buffer, "MagickCOM TestAddress", MB_OK); return 0;}STDMETHODIMP CImage::Composite(IImage *pImage, BSTR cGeometry, int CompositeOp, VARIANT_BOOL *pVal){ long uiMem = 0; // Using the object reference to another image passed in, call it's // GetImageAddress method. We can then cast that back into an // image pointer. pImage->GetImageAddress(&uiMem); Magick::Image* pAltImage = 0; pAltImage = reinterpret_cast<Magick::Image*>(uiMem); try { USES_CONVERSION; //int xOff = 0; //int yOff = 0; //oImage->composite(*pAltImage, xOff, yOff, (CompositeOperator) CompositeOp); oImage->composite(*pAltImage, cGeometry ? OLE2A(cGeometry) : "", (CompositeOperator) CompositeOp); *pVal = true; } catch ( Exception &error_ ) { string ErrorG = error_.what(); CImage::SetErrorMessage(ErrorG.c_str()); *pVal = false; } return S_OK;}STDMETHODIMP CImage::Stegano(IImage *pImage, VARIANT_BOOL *pVal){ // TODO: Add your implementation code here long uiMem = 0; pImage->GetImageAddress(&uiMem); Magick::Image* pAltImage = 0; pAltImage = reinterpret_cast<Magick::Image*>(uiMem); try { oImage->stegano(*pAltImage); *pVal = true; } catch ( Exception &error_ ) { string ErrorG = error_.what(); CImage::SetErrorMessage(ErrorG.c_str()); *pVal = false; } return S_OK;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -