Beispiel #1
0
/**
 * \copydoc PixelFilter::filter
 */
void Hq4xFilter::filter(
    const uint32_t* src,
    int src_width,
    int src_height,
    uint32_t* dst) const {

  hq4x_32(const_cast<uint32_t*>(src), dst, src_width, src_height);
}
Beispiel #2
0
JNIEXPORT void JNICALL
Java_org_ebookdroid_common_bitmaps_RawBitmap_nativeHq4x(JNIEnv* env, jclass classObject, jintArray srcArray,
                                                          jintArray dstArray, jint width, jint height)
{

    jint* src;
    jint* dst;

    src = (*env)->GetIntArrayElements(env, srcArray, 0);
    dst = (*env)->GetIntArrayElements(env, dstArray, 0);

    hq4x_32(src, dst, width, height);

    (*env)->ReleaseIntArrayElements(env, srcArray, src, 0);
    (*env)->ReleaseIntArrayElements(env, dstArray, dst, 0);
}
Beispiel #3
0
bool Image::scaleHq4x(void)
{
	if (_pixels.size() == 0)
	{
		return false;
	}

	int newWidth = _width * 4;
	int newHeight = _height * 4;

	std::vector<Color> newPixels(newWidth * newHeight);

	hq4x_32((uint32_t*)&_pixels.front(), (uint32_t*)&newPixels.front(), _width, _height);

	_pixels.resize(newWidth * newHeight);
	std::copy(newPixels.begin(), newPixels.end(), _pixels.begin());
	_width = newWidth;
	_height = newHeight;

    return true;
}
Beispiel #4
0
void SDL::render()
{
  SDL_FillRect(Gfx::getCanvas(), nullptr, 0x00000000);
  gvm->draw();
  
#ifndef HQXFILTER
  SDL_Surface *canvas = Gfx::getCanvas();
  SDL_UpdateTexture(screen, nullptr, canvas->pixels, canvas->pitch);  
#else
  SDL_Surface *canvas = Gfx::getCanvas();
  //Gfx::lock(canvas);
  //Gfx::lock(filter);
  hq4x_32(static_cast<u32*>(canvas->pixels), static_cast<u32*>(filter->pixels), WIDTH, HEIGHT);
  //Gfx::unlock(canvas);
  //Gfx::unlock(filter);
  SDL_UpdateTexture(screen, nullptr, filter->pixels, filter->pitch);
  
#endif
  
  SDL_RenderClear(renderer);
  SDL_RenderCopy(renderer, screen, nullptr, nullptr);
  SDL_RenderPresent(renderer);
}