示例#1
0
//----------------------------------------------------------
void ofTexture::loadData(const ofPixels & pix){
	if(!isAllocated()){
		allocate(pix);
	}else{
		ofSetPixelStoreiAlignment(GL_UNPACK_ALIGNMENT,pix.getBytesStride());
		loadData(pix.getData(), pix.getWidth(), pix.getHeight(), ofGetGlFormat(pix), ofGetGlType(pix));
	}
}
示例#2
0
bool Frame::scale(ofPixels& pixels)
{
   if (sws_ctx)
   {
       uint8_t * inData[1] = { pixels.getData() }; // RGBA32 have one plane
       //
       // NOTE: In a more general setting, the rows of your input image may
       //       be padded; that is, the bytes per row may not be 4 * width.
       //       In such cases, inLineSize should be set to that padded width.
       //
       int inLinesize[1] = { pixels.getBytesStride() };
       sws_scale(sws_ctx, inData, inLinesize, 0, pixels.getHeight(), frm->data, frm->linesize);
       frm->pts = frm->pts + 1;
       return true;
   }
    // sws_scale(sws_ctx, inData, inLinesize, 0, ctx->height, frame->data, frame->linesize);
    return false;
}
示例#3
0
//----------------------------------------------------------
void ofTexture::loadData(const ofPixels & pix){
	ofSetPixelStorei(pix.getBytesStride());
	loadData(pix.getPixels(), pix.getWidth(), pix.getHeight(), ofGetGlFormat(pix), ofGetGlType(pix));
}