コード例 #1
0
ファイル: Image3unorm8.cpp プロジェクト: elfprince13/G3D10
void Image3unorm8::copyArray(const Color4* src, int w, int h) {
    resize(w, h);
    int N = w * h;

    Color3unorm8* dst = getCArray();
    for (int i = 0; i < N; ++i) {
        dst[i] = Color3unorm8(src[i].rgb());
    }
}
コード例 #2
0
void Image1uint8::copyArray(const Color1* src, int w, int h) {
    resize(w, h);
    int N = w * h;

    Color1uint8* dst = getCArray();
    for (int i = 0; i < N; ++i) {
        dst[i] = Color1uint8(src[i]);
    }
}
コード例 #3
0
ファイル: Image1unorm8.cpp プロジェクト: jackpoz/G3D-backup
void Image1unorm8::copyArray(const Color4unorm8* ptr, int w, int h) {
    resize(w, h);
    int N = w * h;

    Color1unorm8* dst = getCArray();
    for (int i = 0; i < N; ++i) {
        dst[i].value = (ptr[i].r + ptr[i].g + ptr[i].b) / 3;
    }
}
コード例 #4
0
ファイル: Image3unorm8.cpp プロジェクト: elfprince13/G3D10
void Image3unorm8::copyArray(const Color1* src, int w, int h) {
    resize(w, h);
    int N = w * h;

    Color3unorm8* dst = getCArray();
    for (int i = 0; i < N; ++i) {
        dst[i].r = dst[i].g = dst[i].b = Color1unorm8(src[i]).value;
    }
}
コード例 #5
0
void Image4uint8::copyArray(const Color3* src, int w, int h) {
    resize(w, h);
    int N = w * h;

    Color4uint8* dst = getCArray();
    for (int i = 0; i < N; ++i) {
        dst[i] = Color4uint8(Color4(src[i], 1.0f));
    }
}
コード例 #6
0
void Image1uint8::copyArray(const Color4* src, int w, int h) {
    resize(w, h);
    int N = w * h;

    Color1uint8* dst = getCArray();
    for (int i = 0; i < N; ++i) {
        dst[i] = Color1uint8(Color1(src[i].rgb().average()));
    }
}
コード例 #7
0
ファイル: Image1.cpp プロジェクト: Cryptoh/server
void Image1::copyArray(const Color3* src, int w, int h) {
    resize(w, h);
    int N = w * h;

    Color1* dst = getCArray();
    for (int i = 0; i < N; ++i) {
        dst[i] = Color1(src[i].average());
    }
}
コード例 #8
0
void Image1uint8::copyArray(const Color3uint8* src, int w, int h) {
    resize(w, h);
    int N = w * h;

    Color1uint8* dst = getCArray();
    for (int i = 0; i < N; ++i) {
        dst[i].value = (src[i].r + src[i].g + src[i].b) / 3;
    }
}
コード例 #9
0
ファイル: Image3unorm8.cpp プロジェクト: elfprince13/G3D10
void Image3unorm8::copyArray(const Color4unorm8* ptr, int w, int h) {
    resize(w, h);
    
    int N = w * h;

    Color3unorm8* dst = getCArray();
    for (int i = 0; i < N; ++i) {
        dst[i] = Color3unorm8(ptr[i].r, ptr[i].g, ptr[i].b);
    }
}
コード例 #10
0
void Image4uint8::copyArray(const Color1* src, int w, int h) {
    resize(w, h);
    int N = w * h;

    Color4uint8* dst = getCArray();
    for (int i = 0; i < N; ++i) {
        dst[i].r = dst[i].g = dst[i].b = Color1uint8(src[i]).value;
        dst[i].a = 255;
    }
}
コード例 #11
0
ファイル: Image4.cpp プロジェクト: jackpoz/G3D-backup
void Image4::copyArray(const Color1* src, int w, int h) {
    resize(w, h);
    int N = w * h;

    Color4* dst = getCArray();
    for (int i = 0; i < N; ++i) {
        dst[i].r = dst[i].g = dst[i].b = src[i].value;
        dst[i].a = 1.0f;
    }
}
コード例 #12
0
ファイル: Image3unorm8.cpp プロジェクト: elfprince13/G3D10
shared_ptr<class Image1unorm8> Image3unorm8::getChannel(int c) const {
    debugAssert(c >= 0 && c <= 2);

    shared_ptr<Image1unorm8> dst = Image1unorm8::createEmpty(width(), height(), wrapMode());
    const Color3unorm8* srcArray = getCArray();
    Color1unorm8* dstArray = dst->getCArray();

    const int N = width() * height();
    for (int i = 0; i < N; ++i) {
        dstArray[i] = Color1unorm8(srcArray[i][c]);
    }

    return dst;
}
コード例 #13
0
ReferenceCountedPointer<class Image1uint8> Image4uint8::getChannel(int c) const {
    debugAssert(c >= 0 && c <= 3);

    Image1uint8Ref dst = Image1uint8::createEmpty(width(), height(), wrapMode());
    const Color4uint8* srcArray = getCArray();
    Color1uint8* dstArray = dst->getCArray();

    const int N = width() * height();
    for (int i = 0; i < N; ++i) {
        dstArray[i] = Color1uint8(srcArray[i][c]);
    }

    return dst;
}
コード例 #14
0
/** Saves in any of the formats supported by G3D::GImage. */
void Image4uint8::save(const std::string& filename, GImage::Format fmt) {
    GImage im(width(), height(), 4);
    System::memcpy(im.byte(), getCArray(), width() * height() * 4);
    im.save(filename, fmt);
}
コード例 #15
0
ファイル: Image3unorm8.cpp プロジェクト: elfprince13/G3D10
/** Saves in any of the formats supported by G3D::GImage. */
void Image3unorm8::save(const String& filename) {
    shared_ptr<CPUPixelTransferBuffer> buffer = CPUPixelTransferBuffer::create(width(), height(),  format(), MemoryManager::create());
    System::memcpy(buffer->buffer(), getCArray(), (size_t)width() * height() * format()->cpuBitsPerPixel / 8);
    shared_ptr<Image> image = Image::fromPixelTransferBuffer(buffer);
    image->save(filename);
}
コード例 #16
0
ファイル: Image3uint8.cpp プロジェクト: Jekls/PhantomCore
void Image3uint8::copyArray(const Color4uint8* ptr, int w, int h) {
    resize(w, h);
    
    // Copy 3/4 bytes
    GImage::RGBAtoRGB((const uint8*)ptr, (uint8*)getCArray(), w * h);
}
コード例 #17
0
void Image4uint8::copyArray(const Color3uint8* ptr, int w, int h) {
    resize(w, h);
    
    GImage::RGBtoRGBA((const g3d_uint8*)ptr, (g3d_uint8*)getCArray(), w * h);
}
コード例 #18
0
void Image4uint8::copyArray(const Color4uint8* ptr, int w, int h) {
    resize(w, h);
    System::memcpy(getCArray(), ptr, w * h * 4);
}
コード例 #19
0
ファイル: Image3unorm8.cpp プロジェクト: elfprince13/G3D10
void Image3unorm8::copyArray(const Color3unorm8* ptr, int w, int h) {
    resize(w, h);
    System::memcpy(getCArray(), ptr, w * h * 3);
}
コード例 #20
0
ファイル: Image1.cpp プロジェクト: Cryptoh/server
void Image1::copyArray(const Color1* src, int w, int h) {
    resize(w, h);
    System::memcpy(getCArray(), src, w * h * sizeof(Color1));
}