您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ FXSYS_fabs函数代码示例

51自学网 2021-06-01 20:45:21
  C++
这篇教程C++ FXSYS_fabs函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中FXSYS_fabs函数的典型用法代码示例。如果您正苦于以下问题:C++ FXSYS_fabs函数的具体用法?C++ FXSYS_fabs怎么用?C++ FXSYS_fabs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了FXSYS_fabs函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ArgbEncode

FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha(){    if (m_pDIBSource->IsOpaqueImage()) {        CFX_PathData path;        path.AppendRect(0, 0, 1, 1);        path.Transform(&m_ImageMatrix);        FX_DWORD fill_color = ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha);        m_pRenderStatus->m_pDevice->DrawPath(&path, NULL, NULL, fill_color, 0, FXFILL_WINDING);    } else {        const CFX_DIBSource* pAlphaMask = m_pDIBSource->IsAlphaMask() ? m_pDIBSource : m_pDIBSource->GetAlphaMask();        if (FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || FXSYS_fabs(m_ImageMatrix.c) >= 0.5f) {            int left, top;            CFX_DIBitmap* pTransformed = pAlphaMask->TransformTo(&m_ImageMatrix, left, top);            if (pTransformed == NULL) {                return TRUE;            }            m_pRenderStatus->m_pDevice->SetBitMask(pTransformed, left, top, ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));            delete pTransformed;        } else {            CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();            FX_RECT image_rect = image_rect_f.GetOutterRect();            int dest_width = m_ImageMatrix.a > 0 ? image_rect.Width() : -image_rect.Width();            int dest_height = m_ImageMatrix.d > 0 ? -image_rect.Height() : image_rect.Height();            int left = dest_width > 0 ? image_rect.left : image_rect.right;            int top = dest_height > 0 ? image_rect.top : image_rect.bottom;            m_pRenderStatus->m_pDevice->StretchBitMask(pAlphaMask, left, top, dest_width, dest_height,                    ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));        }        if (m_pDIBSource != pAlphaMask) {            delete pAlphaMask;        }    }    return FALSE;}
开发者ID:witwall,项目名称:pdfium,代码行数:34,


示例2: CGPointMake

FX_BOOL CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap*     bitmap,        FX_INT32            left,        FX_INT32            top,        void* pIccTransform,        FX_BOOL bDEdge){    if (FXDC_PRINTER == _deviceClass) {        return FALSE;    }    if (bitmap->GetBPP() < 32) {        return FALSE;    }    if (!(_renderCaps | FXRC_GET_BITS)) {        return FALSE;    }    CGPoint pt = CGPointMake(left, top);    pt = CGPointApplyAffineTransform(pt, _foxitDevice2User);    CGAffineTransform ctm = CGContextGetCTM(_context);    pt.x *= FXSYS_fabs(ctm.a);    pt.y *= FXSYS_fabs(ctm.d);    CGImageRef image = CGBitmapContextCreateImage(_context);    if (NULL == image) {        return FALSE;    }    CGFloat width	= (CGFloat) bitmap->GetWidth();    CGFloat height	= (CGFloat) bitmap->GetHeight();    if (width + pt.x > _width) {        width -= (width + pt.x - _width);    }    if (height + pt.y > _height) {        height -= (height + pt.y - _height);    }    CGImageRef subImage = CGImageCreateWithImageInRect(image,                          CGRectMake(pt.x,                                     pt.y,                                     width,                                     height));    CGContextRef context = createContextWithBitmap(bitmap);    CGRect rect = CGContextGetClipBoundingBox(context);    CGContextClearRect(context, rect);    CGContextDrawImage(context, rect, subImage);    CGContextRelease(context);    CGImageRelease(subImage);    CGImageRelease(image);    if (bitmap->HasAlpha()) {        for (int row = 0; row < bitmap->GetHeight(); row ++) {            FX_LPBYTE pScanline = (FX_LPBYTE)bitmap->GetScanline(row);            for (int col = 0; col < bitmap->GetWidth(); col ++) {                if (pScanline[3] > 0) {                    pScanline[0] = (pScanline[0] * 255.f / pScanline[3] + .5f);                    pScanline[1] = (pScanline[1] * 255.f / pScanline[3] + .5f);                    pScanline[2] = (pScanline[2] * 255.f / pScanline[3] + .5f);                }                pScanline += 4;            }        }    }    return TRUE;}
开发者ID:151706061,项目名称:PDFium,代码行数:59,


示例3: FXSYS_fabs

CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize,                                              FX_DWORD charcode,                                              const CFX_AffineMatrix* pMatrix,                                              FX_FLOAT retinaScaleX,                                              FX_FLOAT retinaScaleY) {  const CPDF_Type3Char* pChar = m_pFont->LoadChar(charcode);  if (!pChar || !pChar->m_pBitmap)    return nullptr;  CFX_DIBitmap* pBitmap = pChar->m_pBitmap;  CFX_AffineMatrix image_matrix, text_matrix;  image_matrix = pChar->m_ImageMatrix;  text_matrix.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, 0, 0);  image_matrix.Concat(text_matrix);  CFX_DIBitmap* pResBitmap = NULL;  int left, top;  if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 &&      FXSYS_fabs(image_matrix.c) < FXSYS_fabs(image_matrix.d) / 100) {    int top_line, bottom_line;    top_line = _DetectFirstLastScan(pBitmap, TRUE);    bottom_line = _DetectFirstLastScan(pBitmap, FALSE);    if (top_line == 0 && bottom_line == pBitmap->GetHeight() - 1) {      FX_FLOAT top_y = image_matrix.d + image_matrix.f;      FX_FLOAT bottom_y = image_matrix.f;      FX_BOOL bFlipped = top_y > bottom_y;      if (bFlipped) {        FX_FLOAT temp = top_y;        top_y = bottom_y;        bottom_y = temp;      }      pSize->AdjustBlue(top_y, bottom_y, top_line, bottom_line);      pResBitmap = pBitmap->StretchTo(          (int)(FXSYS_round(image_matrix.a) * retinaScaleX),          (int)((bFlipped ? top_line - bottom_line : bottom_line - top_line) *                retinaScaleY));      top = top_line;      if (image_matrix.a < 0) {        image_matrix.Scale(retinaScaleX, retinaScaleY);        left = FXSYS_round(image_matrix.e + image_matrix.a);      } else {        left = FXSYS_round(image_matrix.e);      }    } else {    }  }  if (pResBitmap == NULL) {    image_matrix.Scale(retinaScaleX, retinaScaleY);    pResBitmap = pBitmap->TransformTo(&image_matrix, left, top);  }  if (pResBitmap == NULL) {    return NULL;  }  CFX_GlyphBitmap* pGlyph = new CFX_GlyphBitmap;  pGlyph->m_Left = left;  pGlyph->m_Top = -top;  pGlyph->m_Bitmap.TakeOver(pResBitmap);  delete pResBitmap;  return pGlyph;}
开发者ID:hoanganhx86,项目名称:pdfium,代码行数:59,


示例4: GetLastPoint

void CFDE_Path::AddLine(const CFX_PointF& pt1, const CFX_PointF& pt2) {  FX_PATHPOINT* pLast = GetLastPoint();  if (!pLast || FXSYS_fabs(pLast->m_PointX - pt1.x) > 0.001 ||      FXSYS_fabs(pLast->m_PointY - pt1.y) > 0.001) {    MoveTo(pt1);  }  LineTo(pt2);}
开发者ID:gradescope,项目名称:pdfium,代码行数:8,


示例5: DrawTextString

static void DrawTextString(CFX_RenderDevice* pDevice,                           const CPDF_Point& pt,                           CPDF_Font* pFont,                           FX_FLOAT fFontSize,                           CPDF_Matrix* pUser2Device,                           const CFX_ByteString& str,                           FX_ARGB crTextFill,                           FX_ARGB crTextStroke,                           int32_t nHorzScale) {  FX_FLOAT x = pt.x, y = pt.y;  pUser2Device->Transform(x, y);  if (pFont) {    if (nHorzScale != 100) {      CPDF_Matrix mt(nHorzScale / 100.0f, 0, 0, 1, 0, 0);      mt.Concat(*pUser2Device);      CPDF_RenderOptions ro;      ro.m_Flags = RENDER_CLEARTYPE;      ro.m_ColorMode = RENDER_COLOR_NORMAL;      if (crTextStroke != 0) {        CPDF_Point pt1(0, 0), pt2(1, 0);        pUser2Device->Transform(pt1.x, pt1.y);        pUser2Device->Transform(pt2.x, pt2.y);        CFX_GraphStateData gsd;        gsd.m_LineWidth =            (FX_FLOAT)FXSYS_fabs((pt2.x + pt2.y) - (pt1.x + pt1.y));        CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, &mt,                                          str, crTextFill, crTextStroke, &gsd,                                          &ro);      } else        CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, &mt,                                          str, crTextFill, 0, NULL, &ro);    } else {      CPDF_RenderOptions ro;      ro.m_Flags = RENDER_CLEARTYPE;      ro.m_ColorMode = RENDER_COLOR_NORMAL;      if (crTextStroke != 0) {        CPDF_Point pt1(0, 0), pt2(1, 0);        pUser2Device->Transform(pt1.x, pt1.y);        pUser2Device->Transform(pt2.x, pt2.y);        CFX_GraphStateData gsd;        gsd.m_LineWidth =            (FX_FLOAT)FXSYS_fabs((pt2.x + pt2.y) - (pt1.x + pt1.y));        CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize,                                          pUser2Device, str, crTextFill,                                          crTextStroke, &gsd, &ro);      } else        CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize,                                          pUser2Device, str, crTextFill, 0,                                          NULL, &ro);    }  }}
开发者ID:hoanganhx86,项目名称:pdfium,代码行数:58,


示例6: _MatchFloatRange

static void _MatchFloatRange(FX_FLOAT f1, FX_FLOAT f2, int& i1, int& i2) {    int length = (int)FXSYS_ceil(f2 - f1);    int i1_1 = (int)FXSYS_floor(f1);    int i1_2 = (int)FXSYS_ceil(f1);    FX_FLOAT error1 = f1 - i1_1 + (FX_FLOAT)FXSYS_fabs(f2 - i1_1 - length);    FX_FLOAT error2 = i1_2 - f1 + (FX_FLOAT)FXSYS_fabs(f2 - i1_2 - length);    i1 = (error1 > error2) ? i1_2 : i1_1;    i2 = i1 + length;}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:9,


示例7: GetX

FX_BOOL CBC_QRAlignmentPattern::AboutEquals(FX_FLOAT moduleSize,                                            FX_FLOAT i,                                            FX_FLOAT j) {  if ((FXSYS_fabs(i - GetY()) <= moduleSize) &&      (FXSYS_fabs(j - GetX()) <= moduleSize)) {    FX_FLOAT moduleSizeDiff = FXSYS_fabs(moduleSize - m_moduleSize);    return (moduleSizeDiff <= 1.0f) || (moduleSizeDiff / m_moduleSize <= 1.0f);  }  return FALSE;}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:10,


示例8: FXSYS_fabs

void CFX_Matrix::MatchRect(const CFX_FloatRect& dest,                           const CFX_FloatRect& src) {    FX_FLOAT fDiff = src.left - src.right;    a = FXSYS_fabs(fDiff) < 0.001f ? 1 : (dest.left - dest.right) / fDiff;    fDiff = src.bottom - src.top;    d = FXSYS_fabs(fDiff) < 0.001f ? 1 : (dest.bottom - dest.top) / fDiff;    e = dest.left - src.left * a;    f = dest.bottom - src.bottom * d;    b = 0;    c = 0;}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:11,


示例9: AddLines

void CFDE_Path::AddPolygon(const CFX_PointsF& points) {  int32_t iCount = points.GetSize();  if (iCount < 2)    return;  AddLines(points);  const CFX_PointF* p = points.GetData();  if (FXSYS_fabs(p[0].x - p[iCount - 1].x) < 0.01f ||      FXSYS_fabs(p[0].y - p[iCount - 1].y) < 0.01f) {    LineTo(p[0]);  }  CloseFigure();}
开发者ID:gradescope,项目名称:pdfium,代码行数:13,


示例10: FXSYS_fabs

FX_BOOL CFX_ImageTransformer::Start() {  CFX_FloatRect unit_rect = m_pMatrix->GetUnitRect();  FX_RECT result_rect = unit_rect.GetClosestRect();  FX_RECT result_clip = result_rect;  if (m_pClip)    result_clip.Intersect(*m_pClip);  if (result_clip.IsEmpty())    return FALSE;  m_result = result_clip;  if (FXSYS_fabs(m_pMatrix->a) < FXSYS_fabs(m_pMatrix->b) / 20 &&      FXSYS_fabs(m_pMatrix->d) < FXSYS_fabs(m_pMatrix->c) / 20 &&      FXSYS_fabs(m_pMatrix->a) < 0.5f && FXSYS_fabs(m_pMatrix->d) < 0.5f) {    int dest_width = result_rect.Width();    int dest_height = result_rect.Height();    result_clip.Offset(-result_rect.left, -result_rect.top);    result_clip = FXDIB_SwapClipBox(result_clip, dest_width, dest_height,                                    m_pMatrix->c > 0, m_pMatrix->b < 0);    m_Stretcher = WrapUnique(new CFX_ImageStretcher(        &m_Storer, m_pSrc, dest_height, dest_width, result_clip, m_Flags));    m_Stretcher->Start();    m_Status = 1;    return TRUE;  }  if (FXSYS_fabs(m_pMatrix->b) < FIX16_005 &&      FXSYS_fabs(m_pMatrix->c) < FIX16_005) {    int dest_width = m_pMatrix->a > 0 ? (int)FXSYS_ceil(m_pMatrix->a)                                      : (int)FXSYS_floor(m_pMatrix->a);    int dest_height = m_pMatrix->d > 0 ? (int)-FXSYS_ceil(m_pMatrix->d)                                       : (int)-FXSYS_floor(m_pMatrix->d);    result_clip.Offset(-result_rect.left, -result_rect.top);    m_Stretcher = WrapUnique(new CFX_ImageStretcher(        &m_Storer, m_pSrc, dest_width, dest_height, result_clip, m_Flags));    m_Stretcher->Start();    m_Status = 2;    return TRUE;  }  int stretch_width = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->a, m_pMatrix->b));  int stretch_height = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->c, m_pMatrix->d));  CFX_Matrix stretch2dest(1.0f, 0.0f, 0.0f, -1.0f, 0.0f,                          (FX_FLOAT)(stretch_height));  stretch2dest.Concat(      m_pMatrix->a / stretch_width, m_pMatrix->b / stretch_width,      m_pMatrix->c / stretch_height, m_pMatrix->d / stretch_height,      m_pMatrix->e, m_pMatrix->f);  m_dest2stretch.SetReverse(stretch2dest);  CFX_FloatRect clip_rect_f(result_clip);  clip_rect_f.Transform(&m_dest2stretch);  m_StretchClip = clip_rect_f.GetOuterRect();  m_StretchClip.Intersect(0, 0, stretch_width, stretch_height);  m_Stretcher = WrapUnique(new CFX_ImageStretcher(&m_Storer, m_pSrc,                                                  stretch_width, stretch_height,                                                  m_StretchClip, m_Flags));  m_Stretcher->Start();  m_Status = 3;  return TRUE;}
开发者ID:hfiguiere,项目名称:pdfium,代码行数:58,


示例11: CanMerge

FX_BOOL CTextBaseLine::CanMerge(CTextBaseLine* pOther){    FX_FLOAT inter_top, inter_bottom;    if (!GetIntersection(m_Bottom, m_Top, pOther->m_Bottom, pOther->m_Top,                         inter_bottom, inter_top)) {        return FALSE;    }    FX_FLOAT inter_h = inter_top - inter_bottom;    if (inter_h < (m_Top - m_Bottom) / 2 && inter_h < (pOther->m_Top - pOther->m_Bottom) / 2) {        return FALSE;    }    FX_FLOAT dy = (FX_FLOAT)FXSYS_fabs(m_BaseLine - pOther->m_BaseLine);    for (int i = 0; i < m_TextList.GetSize(); i ++) {        CTextBox* pText = (CTextBox*)m_TextList.GetAt(i);        for (int j = 0; j < pOther->m_TextList.GetSize(); j ++) {            CTextBox* pOtherText = (CTextBox*)pOther->m_TextList.GetAt(j);            FX_FLOAT inter_left, inter_right;            if (!GetIntersection(pText->m_Left, pText->m_Right,                                 pOtherText->m_Left, pOtherText->m_Right, inter_left, inter_right)) {                continue;            }            FX_FLOAT inter_w = inter_right - inter_left;            if (inter_w < pText->m_SpaceWidth / 2 && inter_w < pOtherText->m_SpaceWidth / 2) {                continue;            }            if (dy >= (pText->m_Bottom - pText->m_Top) / 2 ||                    dy >= (pOtherText->m_Bottom - pOtherText->m_Top) / 2) {                return FALSE;            }        }    }    return TRUE;}
开发者ID:151706061,项目名称:PDFium,代码行数:33,


示例12: return

int32_t CBC_PDF417Reader::getMinWidth(CBC_ResultPoint* p1,                                      CBC_ResultPoint* p2) {  if (p1 == NULL || p2 == NULL) {    return Integer_MAX_VALUE;  }  return (int32_t)FXSYS_fabs(p1->GetX() - p2->GetX());}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:7,


示例13: FXSYS_atan2

void CFDE_Path::ArcTo(FX_BOOL bStart,                      const CFX_RectF& rect,                      FX_FLOAT startAngle,                      FX_FLOAT endAngle) {  FX_FLOAT rx = rect.width / 2;  FX_FLOAT ry = rect.height / 2;  FX_FLOAT cx = rect.left + rx;  FX_FLOAT cy = rect.top + ry;  FX_FLOAT alpha =      FXSYS_atan2(rx * FXSYS_sin(startAngle), ry * FXSYS_cos(startAngle));  FX_FLOAT beta =      FXSYS_atan2(rx * FXSYS_sin(endAngle), ry * FXSYS_cos(endAngle));  if (FXSYS_fabs(beta - alpha) > FX_PI) {    if (beta > alpha)      beta -= 2 * FX_PI;    else      alpha -= 2 * FX_PI;  }  FX_FLOAT half_delta = (beta - alpha) / 2;  FX_FLOAT bcp = 4.0f / 3 * (1 - FXSYS_cos(half_delta)) / FXSYS_sin(half_delta);  FX_FLOAT sin_alpha = FXSYS_sin(alpha);  FX_FLOAT sin_beta = FXSYS_sin(beta);  FX_FLOAT cos_alpha = FXSYS_cos(alpha);  FX_FLOAT cos_beta = FXSYS_cos(beta);  if (bStart)    MoveTo(CFX_PointF(cx + rx * cos_alpha, cy + ry * sin_alpha));  BezierTo(CFX_PointF(cx + rx * (cos_alpha - bcp * sin_alpha),                      cy + ry * (sin_alpha + bcp * cos_alpha)),           CFX_PointF(cx + rx * (cos_beta + bcp * sin_beta),                      cy + ry * (sin_beta - bcp * cos_beta)),           CFX_PointF(cx + rx * cos_beta, cy + ry * sin_beta));}
开发者ID:gradescope,项目名称:pdfium,代码行数:33,


示例14: FXSYS_fabs

void IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {  CFX_RectF rtOld = m_pProperties->m_rtWidget;  m_pProperties->m_rtWidget = rect;  if (IsChild()) {    if (FXSYS_fabs(rtOld.width - rect.width) > 0.5f ||        FXSYS_fabs(rtOld.height - rect.height) > 0.5f) {      CFWL_EvtSizeChanged ev;      ev.m_pSrcTarget = this;      ev.m_rtOld = rtOld;      ev.m_rtNew = rect;      if (IFWL_WidgetDelegate* pDelegate = GetDelegate())        pDelegate->OnProcessEvent(&ev);    }    return;  }  m_pWidgetMgr->SetWidgetRect_Native(this, rect);}
开发者ID:documentcloud,项目名称:pdfium,代码行数:18,


示例15: ArgbEncode

bool CPDF_ImageRenderer::StartBitmapAlpha() {  if (m_pDIBSource->IsOpaqueImage()) {    CFX_PathData path;    path.AppendRect(0, 0, 1, 1);    path.Transform(&m_ImageMatrix);    uint32_t fill_color =        ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha);    m_pRenderStatus->m_pDevice->DrawPath(&path, nullptr, nullptr, fill_color, 0,                                         FXFILL_WINDING);    return false;  }  CFX_MaybeOwned<CFX_DIBSource> pAlphaMask;  if (m_pDIBSource->IsAlphaMask())    pAlphaMask = const_cast<CFX_DIBSource*>(m_pDIBSource);  else    pAlphaMask = m_pDIBSource->CloneAlphaMask();  if (FXSYS_fabs(m_ImageMatrix.b) >= 0.5f ||      FXSYS_fabs(m_ImageMatrix.c) >= 0.5f) {    int left;    int top;    std::unique_ptr<CFX_DIBitmap> pTransformed =        pAlphaMask->TransformTo(&m_ImageMatrix, left, top);    if (!pTransformed)      return true;    m_pRenderStatus->m_pDevice->SetBitMask(        pTransformed.get(), left, top,        ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));    return false;  }  CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();  FX_RECT image_rect = image_rect_f.GetOuterRect();  int dest_width =      m_ImageMatrix.a > 0 ? image_rect.Width() : -image_rect.Width();  int dest_height =      m_ImageMatrix.d > 0 ? -image_rect.Height() : image_rect.Height();  int left = dest_width > 0 ? image_rect.left : image_rect.right;  int top = dest_height > 0 ? image_rect.top : image_rect.bottom;  m_pRenderStatus->m_pDevice->StretchBitMask(      pAlphaMask.Get(), left, top, dest_width, dest_height,      ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));  return false;}
开发者ID:MIPS,项目名称:external-pdfium,代码行数:44,


示例16: FXSYS_fabs

void CPDF_ReflowedPage::FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x, FX_INT32 y, CFX_ByteString& str){    if (NULL == m_pReflowed) {        return;    }    CFX_AffineMatrix revMatrix;    revMatrix.SetReverse(matrix);    FX_FLOAT x1, y1;    revMatrix.Transform((float)x, (float)y, x1, y1);    int count = m_pReflowed->GetSize();    FX_FLOAT dx = 1000, dy = 1000;    FX_INT32 pos = 0;    FX_INT32 i;    for(i = 0; i < count; i++) {        CRF_Data* pData = (*m_pReflowed)[i];        FX_FLOAT tempdy = FXSYS_fabs(pData->m_PosY - y1);        if(FXSYS_fabs(tempdy - dy) < 1) {            continue;        }        CFX_FloatRect rect (0, pData->m_PosY + pData->m_Height, this->m_PageWidth, pData->m_PosY);        if(rect.Contains(x1, y1)) {            pos = i;            dx = 0;            dy = 0;            break;        } else if(tempdy < dy) {            dy = tempdy;            dx = FXSYS_fabs(pData->m_PosX - x1);            pos = i;        } else if (tempdy == dy) {            FX_FLOAT tempdx = FXSYS_fabs(pData->m_PosX - x1);            if(tempdx < dx) {                dx = tempdx;                pos = i;            }        } else if (tempdy > dy) {            break;        }    }    if(dx != 0 || dy != 0) {        count = count < (pos + 10) ? count : (pos + 10);        for(i = 0 > (pos - 10) ? 0 : (pos - 10); i < count; i++) {            CRF_Data* pData = (*m_pReflowed)[i];            FX_FLOAT tempdy = FXSYS_fabs(pData->m_PosY - y1);            if(tempdy < dy) {                dy = tempdy;                dx = FXSYS_fabs(pData->m_PosX - x1);                pos = i;            } else if (tempdy == dy) {                FX_FLOAT tempdx = FXSYS_fabs(pData->m_PosX - x1);                if(tempdx < dx) {                    dx = tempdx;                    pos = i;                }            }        }    }    str.Format("%d", pos);}
开发者ID:151706061,项目名称:PDFium,代码行数:59,


示例17: FXSYS_fabs

CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj,                                             const FX_RECT& rect,                                             int& left,                                             int& top,                                             FX_BOOL bBackAlphaRequired) {  FX_RECT bbox = rect;  bbox.Intersect(m_pDevice->GetClipBox());  left = bbox.left;  top = bbox.top;  CFX_Matrix deviceCTM = m_pDevice->GetCTM();  FX_FLOAT scaleX = FXSYS_fabs(deviceCTM.a);  FX_FLOAT scaleY = FXSYS_fabs(deviceCTM.d);  int width = FXSYS_round(bbox.Width() * scaleX);  int height = FXSYS_round(bbox.Height() * scaleY);  std::unique_ptr<CFX_DIBitmap> pBackdrop(new CFX_DIBitmap);  if (bBackAlphaRequired && !m_bDropObjects)    pBackdrop->Create(width, height, FXDIB_Argb);  else    m_pDevice->CreateCompatibleBitmap(pBackdrop.get(), width, height);  if (!pBackdrop->GetBuffer())    return nullptr;  FX_BOOL bNeedDraw;  if (pBackdrop->HasAlpha())    bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT);  else    bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_GET_BITS);  if (!bNeedDraw) {    m_pDevice->GetDIBits(pBackdrop.get(), left, top);    return pBackdrop.release();  }  CFX_Matrix FinalMatrix = m_DeviceMatrix;  FinalMatrix.TranslateI(-left, -top);  FinalMatrix.Scale(scaleX, scaleY);  pBackdrop->Clear(pBackdrop->HasAlpha() ? 0 : 0xffffffff);  CFX_FxgeDevice device;  device.Attach(pBackdrop.get(), false, nullptr, false);  m_pContext->Render(&device, pObj, &m_Options, &FinalMatrix);  return pBackdrop.release();}
开发者ID:gradescope,项目名称:pdfium,代码行数:43,


示例18: IsVisible

FX_BOOL CXFA_Stroke::SameStyles(CXFA_Stroke stroke, uint32_t dwFlags) const {  if (m_pNode == stroke.GetNode())    return TRUE;  if (FXSYS_fabs(GetThickness() - stroke.GetThickness()) >= 0.01f)    return FALSE;  if ((dwFlags & XFA_STROKE_SAMESTYLE_NoPresence) == 0 &&      IsVisible() != stroke.IsVisible()) {    return FALSE;  }  if (GetStrokeType() != stroke.GetStrokeType())    return FALSE;  if (GetColor() != stroke.GetColor())    return FALSE;  if ((dwFlags & XFA_STROKE_SAMESTYLE_Corner) != 0 &&      FXSYS_fabs(GetRadius() - stroke.GetRadius()) >= 0.01f) {    return FALSE;  }  return TRUE;}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:19,


示例19:

CFX_Matrix_3by3 CFX_Matrix_3by3::Inverse() {  FX_FLOAT det =      a * (e * i - f * h) - b * (i * d - f * g) + c * (d * h - e * g);  if (FXSYS_fabs(det) < 0.0000001)    return CFX_Matrix_3by3();  return CFX_Matrix_3by3(      (e * i - f * h) / det, -(b * i - c * h) / det, (b * f - c * e) / det,      -(d * i - f * g) / det, (a * i - c * g) / det, -(a * f - c * d) / det,      (d * h - e * g) / det, -(a * h - b * g) / det, (a * e - b * d) / det);}
开发者ID:gradescope,项目名称:pdfium,代码行数:11,


示例20: Load

FX_BOOL CPDF_TilingPattern::Load(){    if (m_pForm != NULL) {        return TRUE;    }    CPDF_Dictionary* pDict = m_pPatternObj->GetDict();    if (pDict == NULL) {        return FALSE;    }    m_bColored = pDict->GetInteger(FX_BSTRC("PaintType")) == 1;    m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumber(FX_BSTRC("XStep")));    m_YStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumber(FX_BSTRC("YStep")));    if (m_pPatternObj->GetType() != PDFOBJ_STREAM) {        return FALSE;    }    CPDF_Stream* pStream = (CPDF_Stream*)m_pPatternObj;    m_pForm = FX_NEW CPDF_Form(m_pDocument, NULL, pStream);    m_pForm->ParseContent(NULL, &m_ParentMatrix, NULL, NULL);    m_BBox = pDict->GetRect(FX_BSTRC("BBox"));    return TRUE;}
开发者ID:151706061,项目名称:PDFium,代码行数:21,


示例21: Load

bool CPDF_TilingPattern::Load() {    if (m_pForm)        return true;    CPDF_Dictionary* pDict = m_pPatternObj->GetDict();    if (!pDict)        return false;    m_bColored = pDict->GetIntegerFor("PaintType") == 1;    m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberFor("XStep"));    m_YStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumberFor("YStep"));    CPDF_Stream* pStream = m_pPatternObj->AsStream();    if (!pStream)        return false;    m_pForm.reset(new CPDF_Form(m_pDocument, nullptr, pStream));    m_pForm->ParseContent(nullptr, &m_ParentMatrix, nullptr);    m_BBox = pDict->GetRectFor("BBox");    return true;}
开发者ID:documentcloud,项目名称:pdfium,代码行数:21,


示例22: FXSYS_fabs

FX_BOOL CFX_ImageTransformer::Start(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pDestMatrix, int flags, const FX_RECT* pDestClip){    m_pMatrix = (CFX_AffineMatrix*)pDestMatrix;    CFX_FloatRect unit_rect = pDestMatrix->GetUnitRect();    FX_RECT result_rect = unit_rect.GetClosestRect();    FX_RECT result_clip = result_rect;    if (pDestClip) {        result_clip.Intersect(*pDestClip);    }    if (result_clip.IsEmpty()) {        return FALSE;    }    m_ResultLeft = result_clip.left;    m_ResultTop = result_clip.top;    m_ResultWidth = result_clip.Width();    m_ResultHeight = result_clip.Height();    m_Flags = flags;    if (FXSYS_fabs(pDestMatrix->a) < FXSYS_fabs(pDestMatrix->b) / 20 &&            FXSYS_fabs(pDestMatrix->d) < FXSYS_fabs(pDestMatrix->c) / 20 &&            FXSYS_fabs(pDestMatrix->a) < 0.5f && FXSYS_fabs(pDestMatrix->d) < 0.5f) {        int dest_width = result_rect.Width();        int dest_height = result_rect.Height();        result_clip.Offset(-result_rect.left, -result_rect.top);        result_clip = _FXDIB_SwapClipBox(result_clip, dest_width, dest_height, pDestMatrix->c > 0, pDestMatrix->b < 0);        m_Stretcher.Start(&m_Storer, pSrc, dest_height, dest_width, result_clip, flags);        m_Status = 1;        return TRUE;    }    if (FXSYS_fabs(pDestMatrix->b) < FIX16_005 && FXSYS_fabs(pDestMatrix->c) < FIX16_005) {        int dest_width = pDestMatrix->a > 0 ? (int)FXSYS_ceil(pDestMatrix->a) : (int)FXSYS_floor(pDestMatrix->a);        int dest_height = pDestMatrix->d > 0 ? (int) - FXSYS_ceil(pDestMatrix->d) : (int) - FXSYS_floor(pDestMatrix->d);        result_clip.Offset(-result_rect.left, -result_rect.top);        m_Stretcher.Start(&m_Storer, pSrc, dest_width, dest_height, result_clip, flags);        m_Status = 2;        return TRUE;    }    int stretch_width = (int)FXSYS_ceil(FXSYS_sqrt2(pDestMatrix->a, pDestMatrix->b));    int stretch_height = (int)FXSYS_ceil(FXSYS_sqrt2(pDestMatrix->c, pDestMatrix->d));    CFX_AffineMatrix stretch2dest(1.0f, 0.0f, 0.0f, -1.0f, 0.0f, (FX_FLOAT)(stretch_height));    stretch2dest.Concat(pDestMatrix->a / stretch_width, pDestMatrix->b / stretch_width,                        pDestMatrix->c / stretch_height, pDestMatrix->d / stretch_height, pDestMatrix->e, pDestMatrix->f);    m_dest2stretch.SetReverse(stretch2dest);    CFX_FloatRect clip_rect_f(result_clip);    clip_rect_f.Transform(&m_dest2stretch);    m_StretchClip = clip_rect_f.GetOutterRect();    m_StretchClip.Intersect(0, 0, stretch_width, stretch_height);    m_Stretcher.Start(&m_Storer, pSrc, stretch_width, stretch_height, m_StretchClip, flags);    m_Status = 3;    return TRUE;}
开发者ID:MWisBest,项目名称:android_external_pdfium,代码行数:50,


示例23: SetReverse

void CFX_Matrix::SetReverse(const CFX_Matrix& m) {    FX_FLOAT i = m.a * m.d - m.b * m.c;    if (FXSYS_fabs(i) == 0) {        return;    }    FX_FLOAT j = -i;    a = m.d / i;    b = m.b / j;    c = m.c / j;    d = m.a / i;    e = (m.c * m.f - m.d * m.e) / i;    f = (m.a * m.f - m.b * m.e) / j;}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:13,


示例24: FPDFText_ProcessInterObj

int FPDFText_ProcessInterObj(const CPDF_TextObject* pPrevObj, const CPDF_TextObject* pObj){    if(FPDFText_IsSameTextObject(pPrevObj, pObj)) {        return -1;    }    CPDF_TextObjectItem item;    int nItem = pPrevObj->CountItems();    pPrevObj->GetItemInfo(nItem - 1, &item);    FX_WCHAR preChar = 0, curChar = 0;    CFX_WideString wstr = pPrevObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);    if(wstr.GetLength()) {        preChar = wstr.GetAt(0);    }    FX_FLOAT last_pos = item.m_OriginX;    int nLastWidth = GetCharWidth(item.m_CharCode, pPrevObj->GetFont());    FX_FLOAT last_width = nLastWidth * pPrevObj->GetFontSize() / 1000;    last_width = FXSYS_fabs(last_width);    pObj->GetItemInfo(0, &item);    wstr = pObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);    if(wstr.GetLength()) {        curChar = wstr.GetAt(0);    }    int nThisWidth = GetCharWidth(item.m_CharCode, pObj->GetFont());    FX_FLOAT this_width = nThisWidth * pObj->GetFontSize() / 1000;    this_width = FXSYS_fabs(this_width);    FX_FLOAT threshold = last_width > this_width ? last_width / 4 : this_width / 4;    CFX_AffineMatrix prev_matrix, prev_reverse;    pPrevObj->GetTextMatrix(&prev_matrix);    prev_reverse.SetReverse(prev_matrix);    FX_FLOAT x = pObj->GetPosX(), y = pObj->GetPosY();    prev_reverse.Transform(x, y);    if (FXSYS_fabs(y) > threshold * 2) {        return 2;    }    threshold = (FX_FLOAT)(nLastWidth > nThisWidth ? nLastWidth : nThisWidth);    threshold = threshold > 400 ? (threshold < 700 ? threshold / 4 :  threshold / 5) : (threshold / 2);    threshold *= nLastWidth > nThisWidth ? FXSYS_fabs(pPrevObj->GetFontSize()) : FXSYS_fabs(pObj->GetFontSize());    threshold /= 1000;    if (FXSYS_fabs(last_pos + last_width - x) > threshold && curChar != L' ' && preChar != L' ')        if(curChar != L' ' && preChar != L' ') {            if((x - last_pos - last_width) > threshold || (last_pos - x - last_width) > threshold) {                return 1;            }            if(x < 0 && (last_pos - x - last_width) > threshold) {                return 1;            }            if((x - last_pos - last_width) > this_width || (x - last_pos - this_width) > last_width ) {                return 1;            }        }    if(last_pos + last_width > x + this_width && curChar == L' ') {        return 3;    }    return 0;}
开发者ID:151706061,项目名称:PDFium,代码行数:55,


示例25: _AdjustBlue

static int _AdjustBlue(FX_FLOAT pos, int& count, int blues[]) {  FX_FLOAT min_distance = 1000000.0f * 1.0f;  int closest_pos = -1;  for (int i = 0; i < count; i++) {    FX_FLOAT distance = (FX_FLOAT)FXSYS_fabs(pos - (FX_FLOAT)blues[i]);    if (distance < 1.0f * 80.0f / 100.0f && distance < min_distance) {      min_distance = distance;      closest_pos = i;    }  }  if (closest_pos >= 0) {    return blues[closest_pos];  }  int new_pos = FXSYS_round(pos);  if (count == TYPE3_MAX_BLUES) {    return new_pos;  }  blues[count++] = new_pos;  return new_pos;}
开发者ID:hoanganhx86,项目名称:pdfium,代码行数:20,


示例26: FPDFText_IsSameTextObject

FX_BOOL FPDFText_IsSameTextObject(const CPDF_TextObject* pTextObj1, const CPDF_TextObject* pTextObj2){    if (!pTextObj1 || !pTextObj2) {        return FALSE;    }    CFX_FloatRect rcPreObj(pTextObj2->m_Left, pTextObj2->m_Bottom, pTextObj2->m_Right, pTextObj2->m_Top);    CFX_FloatRect rcCurObj(pTextObj1->m_Left, pTextObj1->m_Bottom, pTextObj1->m_Right, pTextObj1->m_Top);    if (rcPreObj.IsEmpty() && rcCurObj.IsEmpty()) {        return TRUE;    }    if (!rcPreObj.IsEmpty() || !rcCurObj.IsEmpty()) {        rcPreObj.Intersect(rcCurObj);        if (rcPreObj.IsEmpty()) {            return FALSE;        }        if (FXSYS_fabs(rcPreObj.Width() - rcCurObj.Width()) > rcCurObj.Width() / 2) {            return FALSE;        }        if (pTextObj2->GetFontSize() != pTextObj1->GetFontSize()) {            return FALSE;        }    }    int nPreCount = pTextObj2->CountItems();    int nCurCount = pTextObj1->CountItems();    if (nPreCount != nCurCount) {        return FALSE;    }    for (int i = 0; i < nPreCount; i++) {        CPDF_TextObjectItem itemPer, itemCur;        pTextObj2->GetItemInfo(i, &itemPer);        pTextObj1->GetItemInfo(i, &itemCur);        if (itemCur.m_CharCode != itemPer.m_CharCode) {            return FALSE;        }    }    return TRUE;}
开发者ID:151706061,项目名称:PDFium,代码行数:37,



注:本文中的FXSYS_fabs函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ FXSYS_memcpy函数代码示例
C++ FXSYS_assert函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。