/** * gdk_pixbuf_scale: * @src: a #GdkPixbuf * @dest: the #GdkPixbuf into which to render the results * @dest_x: the left coordinate for region to render * @dest_y: the top coordinate for region to render * @dest_width: the width of the region to render * @dest_height: the height of the region to render * @offset_x: the offset in the X direction (currently rounded to an integer) * @offset_y: the offset in the Y direction (currently rounded to an integer) * @scale_x: the scale factor in the X direction * @scale_y: the scale factor in the Y direction * @interp_type: the interpolation type for the transformation. * * Creates a transformation of the source image @src by scaling by * @scale_x and @scale_y then translating by @offset_x and @offset_y, * then renders the rectangle (@dest_x, @dest_y, @dest_width, * @dest_height) of the resulting image onto the destination image * replacing the previous contents. * * Try to use gdk_pixbuf_scale_simple() first, this function is * the industrial-strength power tool you can fall back to if * gdk_pixbuf_scale_simple() isn't powerful enough. **/ void gdk_pixbuf_scale (const GdkPixbuf *src, GdkPixbuf *dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, GdkInterpType interp_type) { g_return_if_fail (src != NULL); g_return_if_fail (dest != NULL); g_return_if_fail (dest_x >= 0 && dest_x + dest_width <= dest->width); g_return_if_fail (dest_y >= 0 && dest_y + dest_height <= dest->height); offset_x = floor (offset_x + 0.5); offset_y = floor (offset_y + 0.5); pixops_scale (dest->pixels + dest_y * dest->rowstride + dest_x * dest->n_channels, dest_x - offset_x, dest_y - offset_y, dest_x + dest_width - offset_x, dest_y + dest_height - offset_y, dest->rowstride, dest->n_channels, dest->has_alpha, src->pixels, src->width, src->height, src->rowstride, src->n_channels, src->has_alpha, scale_x, scale_y, (PixopsInterpType)interp_type); }
void XWindow::PutFrame (uint8_t* frame, uint16_t width, uint16_t height) { if (!_XImage) return; if (width != _imageWidth || height != _imageHeight) { PTRACE (1, "X11\tDynamic switching of resolution not supported\n"); return; } XLockDisplay (_display); if ((_state.curWidth != _XImage->width) || (_state.curHeight!=_XImage->height)) CreateXImage(_state.curWidth, _state.curHeight); _colorConverter->Convert((BYTE*)frame, (BYTE*)_frameBuffer.get ()); pixops_scale ((guchar*) _XImage->data, 0,0, _state.curWidth, _state.curHeight, _state.curWidth * _planes, //dest_rowstride _planes, //dest_channels, FALSE, //dest_has_alpha, (const guchar*) _frameBuffer.get (), width, height, width * _planes, //src_rowstride _planes, //src_channels, FALSE, //src_has_alpha, (double) _state.curWidth / width, (double) _state.curHeight / height, (PixopsInterpType) _scalingAlgorithm); _XImage->data += _outOffset; #ifdef HAVE_SHM if (_useShm) { XShmPutImage(_display, _XWindow, _gc, _XImage, 0, 0, _state.curX, _state.curY, _state.curWidth, _state.curHeight, false); } else #endif { XPutImage(_display, _XWindow, _gc, _XImage, 0, 0, _state.curX, _state.curY, _state.curWidth,_state.curHeight); } _XImage->data -= _outOffset; XUnlockDisplay (_display); }