Hi: Where can I get detailed documentation for IDirectFBSurface#Read/Write?
I tried to get the image data from the surface, and redraw it to the surface at another location, however the result is just some mosaic. Why the result is incorrect? Thanks! Here is my implementation code: // Read the image data of the rect (100, 100, 200, 200), and redraw it to (500, 500) DrawingContextImageData imageData = context->getImageData(100, 100, 200, 200); context->putImageData(&imageData, 500, 500, 0, 0, 300, 300); DrawingContextImageData DirectFBDrawingContext::getImageData(double sx, double sy, double sw, double sh) { DFBRectangle rect; rect.x = static_cast<int>(sx); rect.y = static_cast<int>(sy); rect.w = static_cast<int>(sw); rect.h = static_cast<int>(sh); DFBSurfacePixelFormat format; surface->GetPixelFormat(surface, &format); int bytesPerLine = DFB_BYTES_PER_LINE(format, static_cast<int>(sw)); char* data = new char[static_cast<int>(sh) * bytesPerLine + 1]; surface->Read(surface, &rect, data, bytesPerLine); return DrawingContextImageData(sx, sy, sw, sh, data, static_cast<int>(sh) * bytesPerLine + 1); } void DirectFBDrawingContext::putImageData(DrawingContextImageData* imageData, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight) { if(imageData == NULL) { throw IllegalArgumentException("The imageData can't be NULL."); } if(dirtyWidth < 0) { throw IllegalArgumentException("dirtyWidth can't be negative."); } if(dirtyHeight < 0) { throw IllegalArgumentException("dirtyHeight can't be negative."); } DFBRectangle rect; rect.x = dirtyX; rect.y = dirtyY; rect.w = dirtyWidth; rect.h = dirtyHeight; surface->Write(surface, &rect, imageData->getData(), imageData->getLength()); surface->Flip(surface, NULL, DFBSurfaceFlipFlags(0)); } _______________________________________________ directfb-users mailing list directfb-users@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users