本文整理汇总了C++中LLImageRaw::getHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ LLImageRaw::getHeight方法的具体用法?C++ LLImageRaw::getHeight怎么用?C++ LLImageRaw::getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLImageRaw
的用法示例。
在下文中一共展示了LLImageRaw::getHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyScaled
// Src and dst can be any size. Src and dst have same number of components.
void LLImageRaw::copyScaled( LLImageRaw* src )
{
LLMemType mt1((LLMemType::EMemType)mMemType);
LLImageRaw* dst = this; // Just for clarity.
llassert_always( (1 == src->getComponents()) || (3 == src->getComponents()) || (4 == src->getComponents()) );
llassert_always( src->getComponents() == dst->getComponents() );
if( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) )
{
memcpy( dst->getData(), src->getData(), getWidth() * getHeight() * getComponents() ); /* Flawfinder: ignore */
return;
}
// Vertical
S32 temp_data_size = src->getWidth() * dst->getHeight() * getComponents();
llassert_always(temp_data_size > 0);
U8* temp_buffer = new U8[ temp_data_size ];
for( S32 col = 0; col < src->getWidth(); col++ )
{
copyLineScaled( src->getData() + (getComponents() * col), temp_buffer + (getComponents() * col), src->getHeight(), dst->getHeight(), src->getWidth(), src->getWidth() );
}
// Horizontal
for( S32 row = 0; row < dst->getHeight(); row++ )
{
copyLineScaled( temp_buffer + (getComponents() * src->getWidth() * row), dst->getData() + (getComponents() * dst->getWidth() * row), src->getWidth(), dst->getWidth(), 1, 1 );
}
// Clean up
delete[] temp_buffer;
}
示例2: copyScaled
// Src and dst can be any size. Src and dst have same number of components.
void LLImageRaw::copyScaled( LLImageRaw* src )
{
LLImageRaw* dst = this; // Just for clarity.
llassert_always( (1 == src->getComponents()) || (3 == src->getComponents()) || (4 == src->getComponents()) );
llassert_always( src->getComponents() == dst->getComponents() );
if( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) )
{
memcpy( dst->getData(), src->getData(), getWidth() * getHeight() * getComponents() ); /* Flawfinder: ignore */
return;
}
S32 temp_data_size = src->getWidth() * dst->getHeight() * getComponents();
llassert_always(temp_data_size > 0);
std::vector<U8> temp_buffer(temp_data_size);
// Vertical
for( S32 col = 0; col < src->getWidth(); col++ )
{
copyLineScaled( src->getData() + (getComponents() * col), &temp_buffer[0] + (getComponents() * col), src->getHeight(), dst->getHeight(), src->getWidth(), src->getWidth() );
}
// Horizontal
for( S32 row = 0; row < dst->getHeight(); row++ )
{
copyLineScaled( &temp_buffer[0] + (getComponents() * src->getWidth() * row), dst->getData() + (getComponents() * dst->getWidth() * row), src->getWidth(), dst->getWidth(), 1, 1 );
}
}
示例3:
// Src and dst can be any size. Src has 4 components. Dst has 3 components.
void LLImageRaw::compositeScaled4onto3(LLImageRaw* src)
{
LLMemType mt1((LLMemType::EMemType)mMemType);
llinfos << "compositeScaled4onto3" << llendl;
LLImageRaw* dst = this; // Just for clarity.
llassert( (4 == src->getComponents()) && (3 == dst->getComponents()) );
// Vertical: scale but no composite
S32 temp_data_size = src->getWidth() * dst->getHeight() * src->getComponents();
U8* temp_buffer = new U8[ temp_data_size ];
for( S32 col = 0; col < src->getWidth(); col++ )
{
copyLineScaled( src->getData() + (src->getComponents() * col), temp_buffer + (src->getComponents() * col), src->getHeight(), dst->getHeight(), src->getWidth(), src->getWidth() );
}
// Horizontal: scale and composite
for( S32 row = 0; row < dst->getHeight(); row++ )
{
compositeRowScaled4onto3( temp_buffer + (src->getComponents() * src->getWidth() * row), dst->getData() + (dst->getComponents() * dst->getWidth() * row), src->getWidth(), dst->getWidth() );
}
// Clean up
delete[] temp_buffer;
}
示例4:
// Src and dst can be any size. Src has 4 components. Dst has 3 components.
void LLImageRaw::compositeScaled4onto3(LLImageRaw* src)
{
LLMemType mt1(mMemType);
llinfos << "compositeScaled4onto3" << llendl;
LLImageRaw* dst = this; // Just for clarity.
llassert( (4 == src->getComponents()) && (3 == dst->getComponents()) );
S32 temp_data_size = src->getWidth() * dst->getHeight() * src->getComponents();
llassert_always(temp_data_size > 0);
std::vector<U8> temp_buffer(temp_data_size);
// Vertical: scale but no composite
for( S32 col = 0; col < src->getWidth(); col++ )
{
copyLineScaled( src->getData() + (src->getComponents() * col), &temp_buffer[0] + (src->getComponents() * col), src->getHeight(), dst->getHeight(), src->getWidth(), src->getWidth() );
}
// Horizontal: scale and composite
for( S32 row = 0; row < dst->getHeight(); row++ )
{
compositeRowScaled4onto3( &temp_buffer[0] + (src->getComponents() * src->getWidth() * row), dst->getData() + (dst->getComponents() * dst->getWidth() * row), src->getWidth(), dst->getWidth() );
}
}
示例5: composite
void LLImageRaw::composite( LLImageRaw* src )
{
LLImageRaw* dst = this; // Just for clarity.
llassert(3 == src->getComponents());
llassert(3 == dst->getComponents());
if( 3 == dst->getComponents() )
{
if( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) )
{
// No scaling needed
if( 3 == src->getComponents() )
{
copyUnscaled( src ); // alpha is one so just copy the data.
}
else
{
compositeUnscaled4onto3( src );
}
}
else
{
if( 3 == src->getComponents() )
{
copyScaled( src ); // alpha is one so just copy the data.
}
else
{
compositeScaled4onto3( src );
}
}
}
}
示例6: PerformSculptUpdates
void LocalAssetBrowser::PerformSculptUpdates(LocalBitmap* unit)
{
/* looking for sculptmap using objects only */
std::vector<affected_object> object_list = unit->getUsingObjects(false, false, true);
if (object_list.empty()) { return; }
for( std::vector<affected_object>::iterator iter = object_list.begin();
iter != object_list.end(); iter++ )
{
affected_object aobj = *iter;
if ( aobj.object )
{
if ( !aobj.local_sculptmap ) { continue; } // should never get here. only in case of misuse.
// update code [begin]
if ( unit->volume_dirty )
{
LLImageRaw* rawimage = gTextureList.findImage( unit->getID() )->getCachedRawImage();
aobj.object->getVolume()->sculpt(rawimage->getWidth(), rawimage->getHeight(),
rawimage->getComponents(), rawimage->getData(), 0);
unit->volume_dirty = false;
}
// tell affected drawable it's got updated
aobj.object->mDrawable->getVOVolume()->setSculptChanged( true );
aobj.object->mDrawable->getVOVolume()->markForUpdate( true );
// update code [end]
}
}
}
示例7: performSculptUpdates
void LLLocalBitmapBrowser::performSculptUpdates(LLLocalBitmap* unit)
{
/* looking for sculptmap using objects only */
std::vector<LLAffectedObject> object_list = unit->getUsingObjects(false, false, true);
if (object_list.empty()) { return; }
for( std::vector<LLAffectedObject>::iterator iter = object_list.begin();
iter != object_list.end(); iter++ )
{
LLAffectedObject aobj = *iter;
if ( aobj.object )
{
if ( !aobj.local_sculptmap ) { continue; } // should never get here. only in case of misuse.
// update code [begin]
if ( unit->mVolumeDirty )
{
LLImageRaw* rawimage = gTextureList.findImage( unit->getID() )->getCachedRawImage();
LLVolumeParams params = aobj.object->getVolume()->getParams();
LLVolumeLODGroup* lodgroup = aobj.object->mDrawable->getVOVolume()->getVolumeManager()->getGroup(params);
for (S32 i = 0; i < LLVolumeLODGroup::NUM_LODS; i++)
{
LLVolume* vol = lodgroup->getVolByLOD(i);
if (vol)
{ vol->sculpt(rawimage->getWidth(), rawimage->getHeight(), rawimage->getComponents(), rawimage->getData(), 0); }
}
// doing this again to fix the weirdness with selected-for-edit objects not updating otherwise.
aobj.object->getVolume()->sculpt(rawimage->getWidth(), rawimage->getHeight(),
rawimage->getComponents(), rawimage->getData(), 0);
unit->mVolumeDirty = false;
}
aobj.object->mDrawable->getVOVolume()->setSculptChanged( true );
aobj.object->mDrawable->getVOVolume()->markForUpdate( true );
// update code [end]
}
}
}
示例8: copyUnscaled
// Src and dst are same size. Src and dst have same number of components.
void LLImageRaw::copyUnscaled(LLImageRaw* src)
{
LLImageRaw* dst = this; // Just for clarity.
llassert( (1 == src->getComponents()) || (3 == src->getComponents()) || (4 == src->getComponents()) );
llassert( src->getComponents() == dst->getComponents() );
llassert( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) );
memcpy( dst->getData(), src->getData(), getWidth() * getHeight() * getComponents() ); /* Flawfinder: ignore */
}
示例9: fastFractionalMult
// Src and dst are same size. Src has 4 components. Dst has 3 components.
void LLImageRaw::compositeUnscaled4onto3( LLImageRaw* src )
{
/*
//test fastFractionalMult()
{
U8 i = 255;
U8 j = 255;
do
{
do
{
llassert( fastFractionalMult(i, j) == (U8)(255*(i/255.f)*(j/255.f) + 0.5f) );
} while( j-- );
} while( i-- );
}
*/
LLImageRaw* dst = this; // Just for clarity.
llassert( (3 == src->getComponents()) || (4 == src->getComponents()) );
llassert( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) );
U8* src_data = src->getData();
U8* dst_data = dst->getData();
S32 pixels = getWidth() * getHeight();
while( pixels-- )
{
U8 alpha = src_data[3];
if( alpha )
{
if( 255 == alpha )
{
dst_data[0] = src_data[0];
dst_data[1] = src_data[1];
dst_data[2] = src_data[2];
}
else
{
U8 transparency = 255 - alpha;
dst_data[0] = fastFractionalMult( dst_data[0], transparency ) + fastFractionalMult( src_data[0], alpha );
dst_data[1] = fastFractionalMult( dst_data[1], transparency ) + fastFractionalMult( src_data[1], alpha );
dst_data[2] = fastFractionalMult( dst_data[2], transparency ) + fastFractionalMult( src_data[2], alpha );
}
}
src_data += 4;
dst_data += 3;
}
}
示例10: copy
// Src and dst can be any size. Src and dst can each have 3 or 4 components.
void LLImageRaw::copy(LLImageRaw* src)
{
if (!src)
{
llwarns << "LLImageRaw::copy called with a null src pointer" << llendl;
return;
}
LLImageRaw* dst = this; // Just for clarity.
llassert( (3 == src->getComponents()) || (4 == src->getComponents()) );
llassert( (3 == dst->getComponents()) || (4 == dst->getComponents()) );
if( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) )
{
// No scaling needed
if( src->getComponents() == dst->getComponents() )
{
copyUnscaled( src );
}
else
if( 3 == src->getComponents() )
{
copyUnscaled3onto4( src );
}
else
{
// 4 == src->getComponents()
copyUnscaled4onto3( src );
}
}
else
{
// Scaling needed
// No scaling needed
if( src->getComponents() == dst->getComponents() )
{
copyScaled( src );
}
else
if( 3 == src->getComponents() )
{
copyScaled3onto4( src );
}
else
{
// 4 == src->getComponents()
copyScaled4onto3( src );
}
}
}
示例11: copy
// Src and dst can be any size. Src and dst can each have 3 or 4 components.
void LLImageRaw::copy(LLImageRaw* src)
{
if (!src)
{
LL_WARNS() << "LLImageRaw::copy called with a null src pointer" << LL_ENDL;
return;
}
LLImageRaw* dst = this; // Just for clarity.
if( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) )
{
// No scaling needed
if( src->getComponents() == dst->getComponents() )
{
copyUnscaled( src );
}
else
if( 3 == src->getComponents() )
{
copyUnscaled3onto4( src );
}
else
{
// 4 == src->getComponents()
copyUnscaled4onto3( src );
}
}
else
{
// Scaling needed
// No scaling needed
if( src->getComponents() == dst->getComponents() )
{
copyScaled( src );
}
else
if( 3 == src->getComponents() )
{
copyScaled3onto4( src );
}
else
{
// 4 == src->getComponents()
copyScaled4onto3( src );
}
}
}
示例12: copy
// Src and dst can be any size. Src and dst can each have 3 or 4 components.
void LLImageRaw::copy(LLImageRaw* src)
{
LLImageRaw* dst = this; // Just for clarity.
llassert( (3 == src->getComponents()) || (4 == src->getComponents()) );
llassert( (3 == dst->getComponents()) || (4 == dst->getComponents()) );
if( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) )
{
// No scaling needed
if( src->getComponents() == dst->getComponents() )
{
copyUnscaled( src );
}
else
if( 3 == src->getComponents() )
{
copyUnscaled3onto4( src );
}
else
{
// 4 == src->getComponents()
copyUnscaled4onto3( src );
}
}
else
{
// Scaling needed
// No scaling needed
if( src->getComponents() == dst->getComponents() )
{
copyScaled( src );
}
else
if( 3 == src->getComponents() )
{
copyScaled3onto4( src );
}
else
{
// 4 == src->getComponents()
copyScaled4onto3( src );
}
}
}
示例13: getWidth
// Src and dst are same size. Src has 4 components. Dst has 3 components.
void LLImageRaw::copyUnscaled4onto3( LLImageRaw* src )
{
LLImageRaw* dst = this; // Just for clarity.
llassert( (3 == dst->getComponents()) && (4 == src->getComponents()) );
llassert( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) );
S32 pixels = getWidth() * getHeight();
U8* src_data = src->getData();
U8* dst_data = dst->getData();
for( S32 i=0; i<pixels; i++ )
{
dst_data[0] = src_data[0];
dst_data[1] = src_data[1];
dst_data[2] = src_data[2];
src_data += 4;
dst_data += 3;
}
}
示例14: copyUnscaledAlphaMask
void LLImageRaw::copyUnscaledAlphaMask( LLImageRaw* src, const LLColor4U& fill)
{
LLImageRaw* dst = this; // Just for clarity.
llassert( 1 == src->getComponents() );
llassert( 4 == dst->getComponents() );
llassert( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) );
S32 pixels = getWidth() * getHeight();
U8* src_data = src->getData();
U8* dst_data = dst->getData();
for ( S32 i = 0; i < pixels; i++ )
{
dst_data[0] = fill.mV[0];
dst_data[1] = fill.mV[1];
dst_data[2] = fill.mV[2];
dst_data[3] = src_data[0];
src_data += 1;
dst_data += 4;
}
}
示例15: timestr
BOOL LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time, BOOL reversible)
{
const S32 MAX_COMPS = 5;
opj_cparameters_t parameters; /* compression parameters */
opj_event_mgr_t event_mgr; /* event manager */
/*
configure the event callbacks (not required)
setting of each callback is optional
*/
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
event_mgr.error_handler = error_callback;
event_mgr.warning_handler = warning_callback;
event_mgr.info_handler = info_callback;
/* set encoding parameters to default values */
opj_set_default_encoder_parameters(¶meters);
parameters.cod_format = 0;
parameters.cp_disto_alloc = 1;
if (reversible)
{
parameters.tcp_numlayers = 1;
parameters.tcp_rates[0] = 0.0f;
}
else
{
parameters.tcp_numlayers = 5;
parameters.tcp_rates[0] = 1920.0f;
parameters.tcp_rates[1] = 480.0f;
parameters.tcp_rates[2] = 120.0f;
parameters.tcp_rates[3] = 30.0f;
parameters.tcp_rates[4] = 10.0f;
parameters.irreversible = 1;
if (raw_image.getComponents() >= 3)
{
parameters.tcp_mct = 1;
}
}
std::string comment_metadata;
if (!comment_text)
{
//Inserting owner id, upload time, and dimensions
//See http://wiki.secondlife.com/wiki/Texture_meta-data for details.
extern LLUUID gAgentID;
time_t now = time(NULL);
tm * ptime = gmtime(&now);
//std::string color_avg(llformat("c=%02x%02x%02x%02x")); //Perhaps do this some day...
std::string timestr(llformat("z=%04i%02i%02i%02i%02i%02i",ptime->tm_year+1900,ptime->tm_mon+1,ptime->tm_mday,ptime->tm_hour,ptime->tm_min,ptime->tm_sec));
comment_metadata=llformat("a=%s&%s&h=%u&w=%u",gAgentID.asString().c_str(),timestr.c_str(),(U32)raw_image.getHeight(),(U32)raw_image.getWidth());
parameters.cp_comment = (char *) comment_metadata.c_str();
}
else
{
// Awful hacky cast, too lazy to copy right now.
parameters.cp_comment = (char *) comment_text;
}
//
// Fill in the source image from our raw image
//
OPJ_COLOR_SPACE color_space = CLRSPC_SRGB;
opj_image_cmptparm_t cmptparm[MAX_COMPS];
opj_image_t * image = NULL;
S32 numcomps = llmin((S32)raw_image.getComponents(),(S32)MAX_COMPS); //Clamp avoid overrunning buffer -Shyotl
S32 width = raw_image.getWidth();
S32 height = raw_image.getHeight();
memset(&cmptparm[0], 0, MAX_COMPS * sizeof(opj_image_cmptparm_t));
for(S32 c = 0; c < numcomps; c++) {
cmptparm[c].prec = 8;
cmptparm[c].bpp = 8;
cmptparm[c].sgnd = 0;
cmptparm[c].dx = parameters.subsampling_dx;
cmptparm[c].dy = parameters.subsampling_dy;
cmptparm[c].w = width;
cmptparm[c].h = height;
}
/* create the image */
image = opj_image_create(numcomps, &cmptparm[0], color_space);
image->x1 = width;
image->y1 = height;
S32 i = 0;
const U8 *src_datap = raw_image.getData();
for (S32 y = height - 1; y >= 0; y--)
{
for (S32 x = 0; x < width; x++)
{
const U8 *pixel = src_datap + (y*width + x) * numcomps;
for (S32 c = 0; c < numcomps; c++)
{
image->comps[c].data[i] = *pixel;
pixel++;
}
i++;
//.........这里部分代码省略.........