Kaynağa Gözat

Minor cleanup in img2twit.

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@3530 92316355-f0b4-4df1-b90c-862c8a59935f
master
sam 15 yıl önce
ebeveyn
işleme
8c39330635
1 değiştirilmiş dosya ile 12 ekleme ve 9 silme
  1. +12
    -9
      examples/img2twit.cpp

+ 12
- 9
examples/img2twit.cpp Dosyayı Görüntüle

@@ -494,13 +494,6 @@ static inline void get_point(int index, float *x, float *y, float *r,
}
}

static inline float clip(float x, int modulo)
{
float mul = (float)modulo + 0.9999;
int round = (int)(x * mul);
return (float)round / (float)modulo;
}

static void add_point(float x, float y, float r, float g, float b, float s)
{
set_point(npoints, x, y, r, g, b, s);
@@ -663,8 +656,10 @@ static void render(pipi_image_t *dst,
{
for(x = rx; x < rx + rw; x++)
{
K::Point_2 m((float)x * dw * RANGE_X / p->w + dw * RANGE_X,
(float)y * dh * RANGE_Y / p->h + dh * RANGE_Y);
float myx = (float)x * dw * RANGE_X / p->w;
float myy = (float)y * dh * RANGE_Y / p->h;

K::Point_2 m(myx + dw * RANGE_X, myy + dh * RANGE_Y);
Point_coordinate_vector coords;
CGAL::Triple<
std::back_insert_iterator<Point_coordinate_vector>,
@@ -696,6 +691,14 @@ static void render(pipi_image_t *dst,
//float k = (*it).second * (0.60f + fs);
//float k = pow((*it).second, (1.0f + fs));

// Try to attenuate peak artifacts
//k /= (0.1 * (RANGE_X * RANGE_X + RANGE_Y * RANGE_Y)
// + (myx - fx) * (myx - fx) + (myy - fy) * (myy - fy));

// Cute circles
//k = 1.0 / (0.015 * (RANGE_X * RANGE_X + RANGE_Y * RANGE_Y)
// + (myx - fx) * (myx - fx) + (myy - fy) * (myy - fy));

r += k * fr;
g += k * fg;
b += k * fb;


Yükleniyor…
İptal
Kaydet