亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? image.cpp

?? ncbi源碼
?? CPP
字號:
/* * =========================================================================== * PRODUCTION $Log: image.cpp,v $ * PRODUCTION Revision 1000.2  2004/06/01 19:41:18  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.6 * PRODUCTION * =========================================================================== *//*  $Id: image.cpp,v 1000.2 2004/06/01 19:41:18 gouriano Exp $ * =========================================================================== * *                            PUBLIC DOMAIN NOTICE *               National Center for Biotechnology Information * *  This software/database is a "United States Government Work" under the *  terms of the United States Copyright Act.  It was written as part of *  the author's official duties as a United States Government employee and *  thus cannot be copyrighted.  This software/database is freely available *  to the public for use. The National Library of Medicine and the U.S. *  Government have not placed any restriction on its use or reproduction. * *  Although all reasonable efforts have been taken to ensure the accuracy *  and reliability of the software and data, the NLM and the U.S. *  Government do not and cannot warrant the performance or results that *  may be obtained by using this software or data. The NLM and the U.S. *  Government disclaim all warranties, express or implied, including *  warranties of performance, merchantability or fitness for any particular *  purpose. * *  Please cite the author in any work or product based on this material. * * =========================================================================== * * Authors:  Mike DiCuccio * * File Description: *    CImage -- interface for manipulating image data */#include <ncbi_pch.hpp>#include <util/image/image.hpp>#include <util/image/image_exception.hpp>BEGIN_NCBI_SCOPECImage::CImage()    : m_Width(0),      m_Height(0),      m_Depth(3){    return;}CImage::CImage(size_t width, size_t height, size_t depth)    : m_Width(0),      m_Height(0),      m_Depth(3){    Init(width, height, depth);}void CImage::Init(size_t width, size_t height, size_t depth){    _TRACE("CImage::Init(): " << width << ", " << height << ", " << depth);    switch (depth) {    case 3:    case 4:        m_Data.resize(width * height * depth);        break;    default:        {{             string msg("CImage::Init(): depth = ");             msg += NStr::IntToString(depth);             msg += " not implemented";             NCBI_THROW(CImageException, eInvalidDimension, msg);        }}    }    m_Width  = width;    m_Height = height;    m_Depth  = depth;}const unsigned char* CImage::GetData(void) const{    _ASSERT(m_Data.size());    return &(m_Data[0]);}unsigned char* CImage::SetData(void){    _ASSERT(m_Data.size());    return &(m_Data[0]);}//// GetAspectRatio()// This computes the aspect ratio for the image (width / height)//float CImage::GetAspectRatio(void) const{    return float (m_Width) / float (m_Height);}//// set the alpha channel to a given value.  The red channel is channel 3.// This will optionnally add the channel if it doesn't exist.//void CImage::SetAlpha(unsigned char val, bool add_if_unavailable){    if (GetDepth() == 3) {        if (add_if_unavailable) {            SetDepth(4);        } else {            NCBI_THROW(CImageException, eInvalidDimension,                       "CImage::SetAlpha(): attempt to set alpha in "                       "24-bit image");        }    }    SetChannel(eAlpha, val);}//// SetDepth()// This will force the image to be 24-bit or 32-bit//void CImage::SetDepth(size_t depth){    if ( !m_Data.size() ) {        return;    }    switch (depth) {    case 3:        if (m_Depth == 4) {            // squash our data.  we can do this without explicitly reallocating            // our buffer - we just have junk on the end            TImageStrip::const_iterator from_data = m_Data.begin();            TImageStrip::iterator       to_data   = m_Data.begin();            for ( ;  from_data != m_Data.end();  ) {                *to_data++ = *from_data++;                *to_data++ = *from_data++;                *to_data++ = *from_data++;                // skip the alpha channel                ++from_data;            }            m_Data.resize(m_Width * m_Height * 3);            m_Depth = 3;        }        break;    case 4:        if (m_Depth == 3) {            // expand our data.            // we do this by expanding in-place            m_Data.resize(m_Width * m_Height * 4);            m_Depth = 4;            // now we need to expand our data            // we can do this by marching backwares through the data            TImageStrip::const_reverse_iterator from_data(m_Data.end());            TImageStrip::const_reverse_iterator end_data (m_Data.begin());            TImageStrip::reverse_iterator       to_data  (m_Data.end());            // march to the actual end of the data            from_data += m_Width * m_Height;            for ( ;  from_data != end_data;  ) {                // insert an alpha channel - this is the first because we're                // marching backwards                *to_data++ = 255;                // copy (in reverse order) BGR data                *to_data++ = *from_data++;                *to_data++ = *from_data++;                *to_data++ = *from_data++;            }        }        break;            default:        {{            string msg("CImage::SetDepth(): invalid depth: ");            msg += NStr::IntToString(depth);            NCBI_THROW(CImageException, eInvalidDimension, msg);        }}    }}//// SetChannel()// Sets a given channel to a certain value//void CImage::SetChannel(size_t channel, unsigned char val){    if ( !m_Data.size() ) {        return;    }    if (channel > 3) {        NCBI_THROW(CImageException, eInvalidDimension,                   "CImage::SetChannel(): channel out of bounds");    }    TImageStrip::iterator data = m_Data.begin() + channel;    TImageStrip::iterator end  =        m_Data.begin() + m_Width * m_Height * m_Depth + channel;    for ( ;  data != end;  data += m_Depth) {        *data = val;    }}//// GetSubImage()// This function returns a new image that is a subimage of the current image// the width and height will be clamped to the left / bottom margins; the x and// y positions must be valid.//CImage* CImage::GetSubImage(size_t x, size_t y, size_t w, size_t h) const{    if ( !m_Data.size() ) {        NCBI_THROW(CImageException, eInvalidImage,                   "CImage::GetSubImage(): image is empty");    }    if (x >= m_Width  ||  y >= m_Height) {        string msg("CImage::GetSubImage(): invalid starting pos: ");        msg += NStr::IntToString(x);        msg += ", ";        msg += NStr::IntToString(y);        NCBI_THROW(CImageException, eInvalidImage, msg);    }    if (x + w >= m_Width) {        LOG_POST(Warning << "CImage::GetSubImage(): clamping width to " << w);        w = m_Width - x;    }    if (y + h >= m_Width) {        LOG_POST(Warning << "CImage::GetSubImage(): clamping width to " << w);        h = m_Height - y;    }    CRef<CImage> image(new CImage(w, h, m_Depth));    const unsigned char* from_data = GetData() +                                     y * m_Width * m_Depth + x * m_Depth;    unsigned char*       to_data   = image->SetData();    size_t from_stride = m_Width * m_Depth;    size_t to_stride   = w * m_Depth;    for (size_t i = 0;  i < h;  ++i) {        memcpy(to_data, from_data, w * m_Depth);        to_data   += to_stride;        from_data += from_stride;    }    return image.Release();}void CImage::Flip(void){    if ( !m_Data.size() ) {        return;    }    unsigned char* from = SetData();    unsigned char* to   = from + (m_Height - 1) * m_Width * m_Depth;    size_t stride = m_Width * m_Depth;    while (to > from) {        for (size_t pos = 0;  pos < stride;  ++pos) {            std::swap(from[pos], to[pos]);        }        from += stride;        to   -= stride;    }}END_NCBI_SCOPE/* * =========================================================================== * $Log: image.cpp,v $ * Revision 1000.2  2004/06/01 19:41:18  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.6 * * Revision 1.6  2004/05/17 21:07:58  gorelenk * Added include of PCH ncbi_pch.hpp * * Revision 1.5  2003/12/16 15:49:35  dicuccio * Large re-write of image handling.  Added improved error-handling and support * for streams-based i/o (via hooks into each client library). * * Revision 1.4  2003/10/02 15:37:33  ivanov * Get rid of compilation warnings * * Revision 1.3  2003/06/12 19:49:56  dicuccio * Added Flip() to flip an image along the y-axis * * Revision 1.2  2003/06/09 19:27:53  dicuccio * Added GetAspectRatio() * * Revision 1.1  2003/06/03 15:17:13  dicuccio * Initial revision of image library * * =========================================================================== */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久影院午夜片一区| 国产欧美日韩另类一区| 94色蜜桃网一区二区三区| 国模无码大尺度一区二区三区| 日本欧美加勒比视频| 日韩精品乱码免费| 日本午夜一本久久久综合| 日韩av一区二区三区| 日本在线不卡一区| 色欲综合视频天天天| 99国产精品久久| 在线观看亚洲a| 欧美日韩高清一区二区不卡| 欧美一区二区人人喊爽| 欧美第一区第二区| 久久综合九色综合97婷婷| 国产日韩亚洲欧美综合| 国产精品视频一区二区三区不卡| 亚洲国产精品av| 亚洲免费成人av| 天堂在线亚洲视频| 九色综合狠狠综合久久| 国产suv精品一区二区三区| 成人高清视频在线| 在线观看精品一区| 91精品国产91综合久久蜜臀| 精品福利在线导航| 国产精品国产三级国产三级人妇| 亚洲精品乱码久久久久| 香蕉久久夜色精品国产使用方法| 免费成人性网站| 国产一区二三区| 波多野结衣的一区二区三区| 欧美日韩久久一区二区| 久久精品一区二区三区不卡 | 精品国一区二区三区| 久久蜜桃av一区二区天堂| 国产精品青草综合久久久久99| 中文字幕日本乱码精品影院| 视频一区中文字幕国产| 国产一二精品视频| 色欧美片视频在线观看在线视频| 日韩一区二区三区视频| 欧美国产丝袜视频| 日韩高清在线一区| 成人美女视频在线观看| 555夜色666亚洲国产免| 国产精品欧美综合在线| 亚洲一区中文日韩| 国产黄人亚洲片| 欧美色图在线观看| 久久婷婷综合激情| 亚洲午夜视频在线观看| 欧美日韩一区小说| 国产欧美精品在线观看| 天天综合色天天综合色h| 成人免费看的视频| 日韩一区二区影院| 亚洲综合自拍偷拍| 国产成人啪午夜精品网站男同| 精品视频在线视频| 中文字幕在线一区二区三区| 亚洲精品国产无天堂网2021| 一区二区三区四区在线免费观看| 老汉av免费一区二区三区| 91丝袜国产在线播放| 精品国产一区二区三区久久久蜜月| 亚洲欧洲日本在线| 精品亚洲国产成人av制服丝袜| 91久久精品一区二区三区| 久久久久久黄色| 久久精品av麻豆的观看方式| 欧美日韩激情一区二区| 亚洲欧美在线另类| 国产精品一区久久久久| 日韩一区二区免费电影| 亚洲中国最大av网站| 成人福利视频在线看| 精品电影一区二区三区| 亚洲二区视频在线| 91一区二区三区在线播放| 久久久久99精品一区| 久久精品免费看| 日韩午夜中文字幕| 婷婷久久综合九色国产成人| 色哟哟国产精品| 国产精品国产馆在线真实露脸| 国产在线精品一区二区不卡了| 欧美精品自拍偷拍动漫精品| 亚洲精品国产第一综合99久久| 高清国产午夜精品久久久久久| 久久色在线观看| 久久99最新地址| 日韩欧美成人一区| 蜜桃在线一区二区三区| 欧美一区二视频| 午夜在线电影亚洲一区| 欧美日本国产视频| 亚洲成人综合在线| 欧美日本韩国一区| 日韩av午夜在线观看| 日韩西西人体444www| 久久国产精品区| 亚洲精品在线电影| 国产一区二区三区免费看| 久久美女高清视频| 成人性生交大片免费看在线播放| 久久久精品综合| 成人精品gif动图一区| 国产精品久久久久久久岛一牛影视 | 欧美一级日韩不卡播放免费| 亚洲超碰97人人做人人爱| 欧美精品久久久久久久多人混战| 亚洲二区视频在线| 日韩色视频在线观看| 国产一区二区三区免费看 | 亚洲丰满少妇videoshd| 69堂精品视频| 九九久久精品视频| 久久精品一区二区| 91视频一区二区三区| 一区二区欧美精品| 69久久夜色精品国产69蝌蚪网| 免费观看成人av| 国产日产欧美一区| 一本久久a久久精品亚洲| 亚洲高清在线视频| 日韩精品资源二区在线| 国产成人av电影| 亚洲男同性视频| 91麻豆精品国产自产在线观看一区| 麻豆成人久久精品二区三区红| 国产亚洲一二三区| 色天使久久综合网天天| 日韩av一级电影| 中文字幕成人在线观看| 欧美在线观看视频一区二区| 美女视频网站久久| 中文字幕免费不卡| 欧美亚洲一区二区三区四区| 毛片一区二区三区| 国产精品成人一区二区三区夜夜夜| 欧美午夜精品理论片a级按摩| 男女激情视频一区| 国产精品久久久久婷婷二区次| 在线观看日韩毛片| 国产一区二区三区国产| 一区二区三区影院| 2017欧美狠狠色| 欧美在线综合视频| 国产福利91精品一区| 亚洲第一福利一区| 国产欧美一区二区三区网站| 欧美亚州韩日在线看免费版国语版| 亚洲免费伊人电影| 激情欧美一区二区三区在线观看| av中文一区二区三区| 免费观看在线色综合| 国产精品美女一区二区在线观看| 欧美日韩激情一区二区三区| 高潮精品一区videoshd| 日韩电影在线看| 亚洲女人的天堂| 久久久一区二区| 777xxx欧美| 91麻豆精品一区二区三区| 日本二三区不卡| 国产suv一区二区三区88区| 日韩国产精品大片| 亚洲乱码国产乱码精品精的特点| 精品蜜桃在线看| 日本黄色一区二区| 国产69精品一区二区亚洲孕妇| 午夜精品久久一牛影视| 中文字幕在线观看不卡视频| 精品国产91洋老外米糕| 欧美日韩久久久一区| 白白色 亚洲乱淫| 国产激情视频一区二区三区欧美| 秋霞成人午夜伦在线观看| 一区二区三区**美女毛片| 中文字幕日韩欧美一区二区三区| 久久婷婷国产综合国色天香| 91精品欧美福利在线观看| 欧美三级韩国三级日本三斤| 99精品热视频| av综合在线播放| 丰满白嫩尤物一区二区| 精品综合久久久久久8888| 午夜精品成人在线| 亚洲一区二区偷拍精品| 亚洲黄色免费电影| 亚洲黄色av一区| 亚洲男女一区二区三区| 亚洲视频中文字幕| 国产精品久久久久久久午夜片| 久久精品视频免费| 国产日韩精品一区二区浪潮av| 欧美xingq一区二区| 精品国产a毛片|