本文整理汇总了C++中HEIGHT函数的典型用法代码示例。如果您正苦于以下问题:C++ HEIGHT函数的具体用法?C++ HEIGHT怎么用?C++ HEIGHT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HEIGHT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: LCD_PrintCharXY
void LCD_PrintCharXY(unsigned int x, unsigned int y, u32 c)
{
u8 row, col, width;
const u8 *offset = char_offset(c, &width);
if (! offset || ! width) {
printf("Could not locate character U-%04x\n", (int)c);
return;
}
// Check if the requested character is available
LCD_DrawStart(x, y, x + width - 1, y + HEIGHT(cur_str.font) - 1, DRAW_NWSE);
for (col = 0; col < width; col++)
{
const u8 *data = offset++;
u8 bit = 0;
// Data is right aligned,adrawn top to bottom
for (row = 0; row < HEIGHT(cur_str.font); ++row)
{
if (bit == 8) {
data = offset++;
bit = 0;
}
if (*data & (1 << bit)) {
LCD_DrawPixelXY(x + col, y + row, cur_str.color);
}
bit++;
}
}
LCD_DrawStop();
}
开发者ID:caoqing32,项目名称:deviation,代码行数:29,代码来源:lcd_string.c
示例2: ensure_balance
struct node* ensure_balance(struct node *p)
{
// trivially balanced - return now
if (p==NULL)
return p;
p->height = 1 + MAX(HEIGHT(p->left),HEIGHT(p->right));
// left-heavy - rebalance needed
if ( HEIGHT(p->left) - HEIGHT(p->right) > 1)
{
if (HEIGHT(p->left->left) > HEIGHT(p->left->right))
p = rotate_right(p);
else {
p->left = rotate_left(p->left);
p = rotate_right(p);
}
}
// right-heavy - rebalance needed
else if ( HEIGHT(p->right) - HEIGHT(p->left) > 1)
{
if (HEIGHT(p->right->right) > HEIGHT(p->right->left))
p = rotate_left(p);
else {
p->right = rotate_right(p->right);
p = rotate_left(p);
}
}
else// balanced - no rebalance needed
;
return p;
}
开发者ID:p14167376,项目名称:ctec2901-librarysim-c,代码行数:34,代码来源:avl_any.c
示例3: avl_get_balance
static int avl_get_balance(avl_node_t* node)
{
if (node == NULL)
return 0;
else
return HEIGHT(node->left) - HEIGHT(node->right);
}
开发者ID:BigBigXiong,项目名称:WinsockExamples,代码行数:7,代码来源:avl.c
示例4: Draw
static void
Draw(void *obj)
{
AG_Slider *sl = obj;
int x;
if (GetPosition(sl, &x) == -1) {
return;
}
switch (sl->type) {
case AG_SLIDER_VERT:
AG_DrawBox(sl, AG_RECT(0,0,WIDTH(sl),HEIGHT(sl)), -1, WCOLOR(sl,0));
AG_DrawBox(sl,
AG_RECT(0, x, WIDTH(sl), sl->wControl),
sl->ctlPressed ? -1 : 1,
WCOLOR(sl,0));
break;
case AG_SLIDER_HORIZ:
AG_DrawBox(sl, AG_RECT(0,0,WIDTH(sl),HEIGHT(sl)), -1, WCOLOR(sl,0));
AG_DrawBox(sl,
AG_RECT(x, 0, sl->wControl, HEIGHT(sl)),
sl->ctlPressed ? -1 : 1,
WCOLOR(sl,0));
break;
}
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:26,代码来源:slider.c
示例5: _equalf
static int _equalf(CMATRIX *a, double f)
{
bool result;
if (COMPLEX(a))
{
if (f == 0.0)
return gsl_matrix_complex_isnull(CMAT(a));
gsl_matrix_complex *m = gsl_matrix_complex_alloc(WIDTH(a), HEIGHT(a));
gsl_matrix_complex_set_identity(m);
gsl_matrix_complex_scale(m, gsl_complex_rect(f, 0));
result = gsl_matrix_complex_equal(CMAT(a), m);
gsl_matrix_complex_free(m);
}
else
{
if (f == 0.0)
return gsl_matrix_isnull(MAT(a));
gsl_matrix *m = gsl_matrix_alloc(WIDTH(a), HEIGHT(a));
gsl_matrix_set_identity(m);
gsl_matrix_scale(m, f);
result = gsl_matrix_equal(MAT(a), m);
gsl_matrix_free(m);
}
return result;
}
开发者ID:ramonelalto,项目名称:gambas,代码行数:29,代码来源:c_matrix.c
示例6: GetClientRect
//-------------------------------------------------------------------------
// CmdProcessDoubleClick
// processes command "change selection" from the playback window
//-------------------------------------------------------------------------
void CMultiSAP::CmdProcessDoubleClick( int xPos, int yPos)
{
if( !m_pEffect || eEffectStagePlaying != m_pEffect->GetStage() )
{
return;
}
RECT rect;
GetClientRect( m_hwndApp, &rect );
RECT rectRT = m_movieList.GetDefaultTarget();
// given xPos, yPos are in client coordinates of the window;
// transform then to client coordinates of the render target and find the movie
float xPosRT = (float)xPos / (float)(WIDTH(&rect)) * (float)(WIDTH(&rectRT));
float yPosRT = (float)yPos / (float)(HEIGHT(&rect)) * (float)(HEIGHT(&rectRT));
CMovie *pmovie = NULL;
pmovie = m_movieList.GetMovieFromRTPoint( xPosRT, yPosRT);
if( pmovie && pmovie->m_dwUserID != m_movieList.GetSelectedMovieID() )
{
m_pdwNextSelectedMovie = pmovie->m_dwUserID;
if( m_pEffect )
{
m_pEffect->Finish();
}
CmdAddEffect(eEffectFountain, 10, 10, 10, TRUE);
return;
}
}
开发者ID:hgl888,项目名称:nashtest,代码行数:38,代码来源:CMultiSAP.cpp
示例7: draw
void draw(void) {
int x, y;
double diff;
glBegin(GL_QUADS);
GLfloat c1[4] = { 0, 0, 1, 1 };
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, c1);
VERTEX3(0, 0, waterh);
VERTEX3(0, maph - 1, waterh);
VERTEX3(mapw - 1, maph - 1, waterh);
VERTEX3(mapw - 1, 0, waterh);
GLfloat c2[4] = { 34 / 255., 139 / 255., 34 / 255., 1 };
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, c2);
for(x = 0; x < mapw - 1; ++x)
for(y = 0; y < maph - 1; ++y) {
diff = HEIGHT(x, y) - HEIGHT(x + 1, y + 1);
glNormal3f(diff, diff, 2);
VERTEX2(x, y);
VERTEX2(x, y + 1);
VERTEX2(x + 1, y + 1);
VERTEX2(x + 1, y);
}
GLfloat c3[4] = { 160 / 255., 82 / 255., 45 / 255., 1 };
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, c3);
glNormal3i(0, -1, 0);
for(x = 0; x < mapw - 1; ++x) {
VERTEX3(x, 0, waterh);
VERTEX2(x, 0);
VERTEX2(x + 1, 0);
VERTEX3(x + 1, 0, waterh);
}
glNormal3i(1, 0, 0);
for(y = 0; y < maph - 1; ++y) {
VERTEX3(mapw - 1, y, waterh);
VERTEX2(mapw - 1, y);
VERTEX2(mapw - 1, y + 1);
VERTEX3(mapw - 1, y + 1, waterh);
}
glNormal3i(0, 1, 0);
for(x = 0; x < mapw - 1; ++x) {
VERTEX3(x, maph - 1, waterh);
VERTEX3(x + 1, maph - 1, waterh);
VERTEX2(x + 1, maph - 1);
VERTEX2(x, maph - 1);
}
glNormal3i(-1, 0, 0);
for(y = 0; y < maph - 1; ++y) {
VERTEX3(0, y, waterh);
VERTEX3(0, y + 1, waterh);
VERTEX2(0, y + 1);
VERTEX2(0, y);
}
glEnd();
}
开发者ID:cesium12,项目名称:terrain,代码行数:56,代码来源:viewer.c
示例8: rgz_hwc_scaled
static int rgz_hwc_scaled(hwc_layer_1_t *layer)
{
int w = WIDTH(layer->sourceCrop);
int h = HEIGHT(layer->sourceCrop);
if (layer->transform & HWC_TRANSFORM_ROT_90)
swap(w, h);
return WIDTH(layer->displayFrame) != w || HEIGHT(layer->displayFrame) != h;
}
开发者ID:LG-P769-DEVELOPERS,项目名称:aokp_device_lge_p769,代码行数:10,代码来源:rgz_2d.c
示例9: right_right_rotation
Node* right_right_rotation(AVLTree v1)
{
AVLTree v2;
v2 = v1->right;
v1->right = v2->left;
v2->left = v1;
v1->height = MAX( HEIGHT(v1->left), HEIGHT(v1->right)) + 1;
v2->height = MAX( HEIGHT(v2->right), v1->height) + 1;
return v2;
}
开发者ID:1130310223,项目名称:lab4,代码行数:10,代码来源:AVL.cpp
示例10: left_left_rotation
Node* left_left_rotation(AVLTree v2)
{
AVLTree v1;
v1 = v2->left;
v2->left = v1->right;
v1->right = v2;
v2->height = MAX( HEIGHT(v2->left), HEIGHT(v2->right)) + 1;
v1->height = MAX( HEIGHT(v1->left), v2->height) + 1;
return v1;
}
开发者ID:1130310223,项目名称:lab4,代码行数:10,代码来源:AVL.cpp
示例11: getscaleh
static float getscaleh(hwc_layer_1_t *layer)
{
int w = WIDTH(layer->sourceCrop);
int h = HEIGHT(layer->sourceCrop);
if (layer->transform & HWC_TRANSFORM_ROT_90)
swap(w, h);
return ((float)HEIGHT(layer->displayFrame)) / (float)h;
}
开发者ID:LG-P769-DEVELOPERS,项目名称:aokp_device_lge_p769,代码行数:10,代码来源:rgz_2d.c
示例12: rgz_src1_prep
static void rgz_src1_prep(
struct rgz_blt_entry* e, hwc_layer_1_t *l,
blit_rect_t *rect,
struct bvbuffdesc *scrdesc, struct bvsurfgeom *scrgeom)
{
if (!l)
return;
IMG_native_handle_t *handle = (IMG_native_handle_t *)l->handle;
struct bvbuffdesc *src1desc = &e->src1desc;
src1desc->structsize = sizeof(struct bvbuffdesc);
src1desc->length = handle->iHeight * HANDLE_TO_STRIDE(handle);
/*
* The virtaddr isn't going to be used in the final 2D h/w integration
* because we will be handling buffers differently
*/
src1desc->virtaddr = HANDLE_TO_BUFFER(handle);
struct bvsurfgeom *src1geom = &e->src1geom;
src1geom->structsize = sizeof(struct bvsurfgeom);
src1geom->format = hal_to_ocd(handle->iFormat);
src1geom->width = handle->iWidth;
src1geom->height = handle->iHeight;
src1geom->orientation = l->transform & HWC_TRANSFORM_ROT_90 ? 90 :
l->transform & HWC_TRANSFORM_ROT_180 ? 180 :
l->transform & HWC_TRANSFORM_ROT_270 ? 270 : 0;
src1geom->virtstride = HANDLE_TO_STRIDE(handle);
struct bvsurfgeom *dstgeom = &e->dstgeom;
dstgeom->structsize = sizeof(struct bvsurfgeom);
dstgeom->format = scrgeom->format;
dstgeom->width = scrgeom->width;
dstgeom->height = scrgeom->height;
dstgeom->orientation = 0;
dstgeom->virtstride = DSTSTRIDE(scrgeom);
struct bvbltparams *bp = &e->bp;
bp->structsize = sizeof(struct bvbltparams);
bp->dstdesc = scrdesc;
bp->dstgeom = dstgeom;
bp->dstrect.left = rect->left;
bp->dstrect.top = rect->top;
bp->dstrect.width = WIDTH(*rect);
bp->dstrect.height = HEIGHT(*rect);
bp->src1.desc = src1desc;
bp->src1geom = src1geom;
bp->src1rect.left = effective_srcleft(l, rect);
bp->src1rect.top = effective_srctop(l, rect);
bp->src1rect.width = WIDTH(*rect); // XXX fixme - effective width/height?
bp->src1rect.height = HEIGHT(*rect);
bp->cliprect.left = bp->cliprect.top = 0;
bp->cliprect.width = scrgeom->width;
bp->cliprect.height = scrgeom->height;
}
开发者ID:LG-P769-DEVELOPERS,项目名称:aokp_device_lge_p769,代码行数:55,代码来源:rgz_2d.c
示例13: avl_remove_node
/* delete an node from tree */
static avl_node_t* avl_remove_node(avl_node_t* root, avl_key_t key)
{
int factor = 0;
int rotate = 0;
if (root == NULL)
return NULL;
if (key < root->key)
{
root->left = avl_remove_node(root->left, key);
}
else if (key > root->key)
{
root->right = avl_remove_node(root->right, key);
}
else /* this is the node to be deleted */
{
if ((root->left == NULL) || (root->right == NULL))
{
avl_node_t* node = (root->left ? root->left : root->right);
if (node != NULL) /* one child case */
{
*root = *node;
}
else /* no child case */
{
node = root;
root = NULL;
}
avl_free_node(node);
}
else /* node with two children */
{
avl_node_t* node = avl_node_min(root->right);
root->key = node->key;
root->data = node->data;
root->right = avl_remove_node(root->right, node->key);
}
}
if (root == NULL)
return NULL;
root->height = MAX(HEIGHT(root->left), HEIGHT(root->right)) + 1;
factor = avl_get_balance(root);
if (factor > 1)
{
int left_balance = avl_get_balance(root->left);
rotate = (left_balance >= 0 ? ROT_LEFT : ROT_RIGHT);
}
else if (factor < -1)
{
int right_balance = avl_get_balance(root->right);
rotate = (right_balance <= 0 ? ROT_RIGHT : ROT_LEFT);
}
return avl_balance_node(root, factor, rotate);
}
开发者ID:BigBigXiong,项目名称:WinsockExamples,代码行数:56,代码来源:avl.c
示例14: avl_node_ll_rot
/*
* left-left rotation
*
* A B
* / \ / \
* B C D A
* / \ ==> / \ / \
* D E F G E C
* / \
* F G
*/
static avl_node_t* avl_node_ll_rot(avl_node_t* A)
{
avl_node_t* B = A->left;
A->left = B->right;
B->right = A;
// update heights
A->height = MAX(HEIGHT(A->left), HEIGHT(A->right)) + 1;
B->height = MAX(HEIGHT(B->left), HEIGHT(B->right)) + 1;
return B;
}
开发者ID:BigBigXiong,项目名称:WinsockExamples,代码行数:23,代码来源:avl.c
示例15: avl_node_rr_rot
/*
* right-right rotation
*
* A C
* / \ / \
* B C A E
* / \ ==> / \ / \
* D E B D F G
* / \
* F G
*/
static avl_node_t* avl_node_rr_rot(avl_node_t* A)
{
avl_node_t* C = A->right;
A->right = C->left;
C->left = A;
// update heights
A->height = MAX(HEIGHT(A->left), HEIGHT(A->right)) + 1;
C->height = MAX(HEIGHT(C->left), HEIGHT(C->right)) + 1;
return C;
}
开发者ID:BigBigXiong,项目名称:WinsockExamples,代码行数:23,代码来源:avl.c
示例16: rotate_left
struct node* rotate_left(struct node *p)
{
struct node *q;
assert(p!=NULL);
assert(p->right!=NULL);
q = p->right;
p->right = q->left;
q->left = p;
p->height = 1 + MAX(HEIGHT(p->left),HEIGHT(p->right));
q->height = 1 + MAX(HEIGHT(q->left),HEIGHT(q->right));
return q;
}
开发者ID:p14167376,项目名称:ctec2901-librarysim-c,代码行数:12,代码来源:avl_any.c
示例17: LoadTerrain
void LoadTerrain (char *filename)
{
grsBitmap bmHeight;
int iff_error;
int i, j;
ubyte h, hMin, hMax;
LogErr (" loading terrain height map\n");
iff_error = iff_read_bitmap (filename, &bmHeight, BM_LINEAR);
if (iff_error != IFF_NO_ERROR) {
#if TRACE
con_printf (1, "File %s - IFF error: %s", filename, iff_errormsg (iff_error));
#endif
Error ("File %s - IFF error: %s", filename, iff_errormsg (iff_error));
}
if (gameData.render.terrain.pHeightMap)
D2_FREE (gameData.render.terrain.pHeightMap)
else
atexit (FreeTerrainHeightMap); //first time
gameData.render.terrain.nGridW = bmHeight.bmProps.w;
gameData.render.terrain.nGridH = bmHeight.bmProps.h;
Assert (gameData.render.terrain.nGridW <= TERRAIN_GRID_MAX_SIZE);
Assert (gameData.render.terrain.nGridH <= TERRAIN_GRID_MAX_SIZE);
LogErr ("heightmap loaded, size=%dx%d\n", gameData.render.terrain.nGridW, gameData.render.terrain.nGridH);
gameData.render.terrain.pHeightMap = bmHeight.bmTexBuf;
hMax = 0;
hMin = 255;
for (i = 0; i < gameData.render.terrain.nGridW; i++)
for (j = 0; j < gameData.render.terrain.nGridH; j++) {
h = HEIGHT (i, j);
if (h > hMax)
hMax = h;
if (h < hMin)
hMin = h;
}
for (i = 0; i < gameData.render.terrain.nGridW; i++) {
for (j = 0; j < gameData.render.terrain.nGridH; j++) {
HEIGHT (i, j) -= hMin;
}
}
// D2_FREE (bmHeight.bmTexBuf);
gameData.render.terrain.bmP = gameData.endLevel.terrain.bmP;
#if 0 //the following code turns the (palettized) terrain texture into a white TGA texture for testing
gameData.render.terrain.bmP->bmProps.rowSize *= 4;
gameData.render.terrain.bmP->bmProps.flags |= BM_FLAG_TGA;
D2_FREE (gameData.render.terrain.bmP->bmTexBuf);
gameData.render.terrain.bmP->bmTexBuf = D2_ALLOC (gameData.render.terrain.bmP->bmProps.h * gameData.render.terrain.bmP->bmProps.rowSize);
memset (gameData.render.terrain.bmP->bmTexBuf, 0xFF, gameData.render.terrain.bmP->bmProps.h * gameData.render.terrain.bmP->bmProps.rowSize);
#endif
LogErr (" building terrain light map\n");
BuildTerrainLightMap ();
}
开发者ID:paud,项目名称:d2x-xl,代码行数:52,代码来源:terrain.c
示例18: right_right_rotation
/*
* RR:右右对应的情况(右单旋转)。
*
* 返回值:旋转后的根节点
*/
static Node* right_right_rotation(AVLTree k1)
{
AVLTree k2;
k2 = k1->right;
k1->right = k2->left;
k2->left = k1;
k1->height = MAX( HEIGHT(k1->left), HEIGHT(k1->right)) + 1;
k2->height = MAX( HEIGHT(k2->right), k1->height) + 1;
return k2;
}
开发者ID:guker,项目名称:Algrithm-Learning,代码行数:18,代码来源:avltree.cpp
示例19: left_left_rotation
/*
* LL:左左对应的情况(左单旋转)。
*
* 返回值:旋转后的根节点
*/
static Node* left_left_rotation(AVLTree k2)
{
AVLTree k1;
k1 = k2->left;
k2->left = k1->right;
k1->right = k2;
k2->height = MAX( HEIGHT(k2->left), HEIGHT(k2->right)) + 1;
k1->height = MAX( HEIGHT(k1->left), k2->height) + 1;
return k1;
}
开发者ID:guker,项目名称:Algrithm-Learning,代码行数:18,代码来源:avltree.cpp
示例20: LoadTerrain
void LoadTerrain (char *filename)
{
CBitmap bmHeight;
int iff_error;
int i, j;
ubyte h, hMin, hMax;
CIFF iff;
PrintLog (" loading terrain height map\n");
memset (&bmHeight, 0, sizeof (bmHeight));
iff_error = iff.ReadBitmap (filename, &bmHeight, BM_LINEAR);
if (iff_error != IFF_NO_ERROR) {
#if TRACE
console.printf (1, "File %s - IFF error: %s", filename, iff.ErrorMsg (iff_error));
#endif
Error ("File %s - IFF error: %s", filename, iff.ErrorMsg (iff_error));
}
gameData.render.terrain.heightmap.Destroy ();
gameData.render.terrain.nGridW = bmHeight.Width ();
gameData.render.terrain.nGridH = bmHeight.Height ();
Assert (gameData.render.terrain.nGridW <= TERRAIN_GRID_MAX_SIZE);
Assert (gameData.render.terrain.nGridH <= TERRAIN_GRID_MAX_SIZE);
PrintLog ("heightmap loaded, size=%dx%d\n", gameData.render.terrain.nGridW, gameData.render.terrain.nGridH);
gameData.render.terrain.heightmap = bmHeight;
hMax = 0;
hMin = 255;
for (i = 0; i < gameData.render.terrain.nGridW; i++)
for (j = 0; j < gameData.render.terrain.nGridH; j++) {
h = HEIGHT (i, j);
if (h > hMax)
hMax = h;
if (h < hMin)
hMin = h;
}
for (i = 0; i < gameData.render.terrain.nGridW; i++) {
for (j = 0; j < gameData.render.terrain.nGridH; j++) {
HEIGHT (i, j) -= hMin;
}
}
gameData.render.terrain.bmP = gameData.endLevel.terrain.bmP;
#if 0 //the following code turns the (palettized) terrain texture into a white TGA texture for testing
gameData.render.terrain.bmP->props.rowSize *= 4;
gameData.render.terrain.bmP->props.flags |= BM_FLAG_TGA;
gameData.render.terrain.bmP->DestroyBuffer ();
gameData.render.terrain.bmP->CreateBuffer (gameData.render.terrain.bmP->Height () * gameData.render.terrain.bmP->props.rowSize);
gameData.render.terrain.bmP->Clear (0xFF);
#endif
PrintLog (" building terrain light map\n");
BuildTerrainLightmap ();
}
开发者ID:paud,项目名称:d2x-xl,代码行数:50,代码来源:terrain.cpp
注:本文中的HEIGHT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论