Copied poke255_uc implementation from gtk3 into master
This commit is contained in:
@@ -84,26 +84,16 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext
|
||||
unsigned char *dst;
|
||||
#pragma omp for schedule(static,10)
|
||||
|
||||
for (unsigned int i = 0; i < (unsigned int)(h); i++) {
|
||||
for (unsigned int i = 0; i < (unsigned int)(h); ++i) {
|
||||
src = data + i * w * 3;
|
||||
dst = previewImage->get_data() + i * w * 4;
|
||||
|
||||
for (unsigned int j = 0; j < (unsigned int)(w); j++) {
|
||||
for (unsigned int j = 0; j < (unsigned int)(w); ++j) {
|
||||
unsigned char r = *(src++);
|
||||
unsigned char g = *(src++);
|
||||
unsigned char b = *(src++);
|
||||
|
||||
#if __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__
|
||||
*(dst++) = b;
|
||||
*(dst++) = g;
|
||||
*(dst++) = r;
|
||||
*(dst++) = 0;
|
||||
#else
|
||||
*(dst++) = 0;
|
||||
*(dst++) = r;
|
||||
*(dst++) = g;
|
||||
*(dst++) = b;
|
||||
#endif
|
||||
poke255_uc(dst, r, g, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,17 +168,8 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext
|
||||
unsigned char r = *(src++);
|
||||
unsigned char g = *(src++);
|
||||
unsigned char b = *(src++);
|
||||
#if __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__
|
||||
*(dst++) = b;
|
||||
*(dst++) = g;
|
||||
*(dst++) = r;
|
||||
*(dst++) = 0;
|
||||
#else
|
||||
*(dst++) = 0;
|
||||
*(dst++) = r;
|
||||
*(dst++) = g;
|
||||
*(dst++) = b;
|
||||
#endif
|
||||
|
||||
poke255_uc(dst, r, g, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#define _PREVIEWIMAGE_
|
||||
|
||||
#include <gtkmm.h>
|
||||
#include "cairomm/cairomm.h"
|
||||
#include <cairomm/cairomm.h>
|
||||
|
||||
namespace rtengine
|
||||
{
|
||||
|
@@ -29,6 +29,51 @@ using namespace std;
|
||||
namespace rtengine
|
||||
{
|
||||
|
||||
void poke255_uc(unsigned char* &dest, unsigned char r, unsigned char g, unsigned char b)
|
||||
{
|
||||
#if __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__
|
||||
*(dest++) = b;
|
||||
*(dest++) = g;
|
||||
*(dest++) = r;
|
||||
*(dest++) = 0;
|
||||
#else
|
||||
*(dest++) = 0;
|
||||
*(dest++) = r;
|
||||
*(dest++) = g;
|
||||
*(dest++) = b;
|
||||
#endif
|
||||
}
|
||||
|
||||
void poke01_d(unsigned char* &dest, double r, double g, double b)
|
||||
{
|
||||
#if __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__
|
||||
*(dest++) = (unsigned char)(b * 255.);
|
||||
*(dest++) = (unsigned char)(g * 255.);
|
||||
*(dest++) = (unsigned char)(r * 255.);
|
||||
*(dest++) = 0;
|
||||
#else
|
||||
*(dest++) = 0;
|
||||
*(dest++) = (unsigned char)(r * 255.);
|
||||
*(dest++) = (unsigned char)(g * 255.);
|
||||
*(dest++) = (unsigned char)(b * 255.);
|
||||
#endif
|
||||
}
|
||||
|
||||
void poke01_f(unsigned char* &dest, float r, float g, float b)
|
||||
{
|
||||
#if __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__
|
||||
*(dest++) = (unsigned char)(b * 255.f);
|
||||
*(dest++) = (unsigned char)(g * 255.f);
|
||||
*(dest++) = (unsigned char)(r * 255.f);
|
||||
*(dest++) = 0;
|
||||
#else
|
||||
*(dest++) = 0;
|
||||
*(dest++) = (unsigned char)(r * 255.f);
|
||||
*(dest++) = (unsigned char)(g * 255.f);
|
||||
*(dest++) = (unsigned char)(b * 255.f);
|
||||
#endif
|
||||
}
|
||||
|
||||
void bilinearInterp (const unsigned char* src, int sw, int sh, unsigned char* dst, int dw, int dh)
|
||||
{
|
||||
|
||||
|
@@ -22,6 +22,13 @@
|
||||
namespace rtengine
|
||||
{
|
||||
|
||||
// update a point of a Cairo::Surface by accessing the raw data
|
||||
void poke255_uc(unsigned char* &dest, unsigned char r, unsigned char g, unsigned char b);
|
||||
// update a point of a Cairo::Surface by accessing the raw data
|
||||
void poke01_d(unsigned char* &dest, double r, double g, double b);
|
||||
// update a point of a Cairo::Surface by accessing the raw data
|
||||
void poke01_f(unsigned char* &dest, float r, float g, float b);
|
||||
|
||||
void bilinearInterp (const unsigned char* src, int sw, int sh, unsigned char* dst, int dw, int dh);
|
||||
void nearestInterp (const unsigned char* src, int sw, int sh, unsigned char* dst, int dw, int dh);
|
||||
void rotate (unsigned char* img, int& w, int& h, int deg);
|
||||
|
Reference in New Issue
Block a user