本文整理汇总了C++中TRectD类的典型用法代码示例。如果您正苦于以下问题:C++ TRectD类的具体用法?C++ TRectD怎么用?C++ TRectD使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TRectD类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: picker
/*! rectangular rgb picking. The picked color will be an average of pixels in
* specified rectangle
*/
void ImageViewer::rectPickColor(bool putValueToStyleEditor) {
if (!m_isHistogramEnable) return;
if (!m_histogramPopup->isVisible()) return;
StylePicker picker(m_image);
TPoint startPos =
TPoint(m_pressedMousePos.x, height() - 1 - m_pressedMousePos.y);
TPoint endPos = TPoint(m_pos.x(), height() - 1 - m_pos.y());
TRectD area = TRectD(convert(startPos), convert(endPos));
area = area.enlarge(-1, -1);
if (area.getLx() < 2 || area.getLy() < 2) {
m_histogramPopup->updateAverageColor(TPixel32::Transparent);
return;
}
if (m_lutCalibrator && m_lutCalibrator->isValid() && m_fbo) m_fbo->bind();
const TPixel32 pix = picker.pickColor(area.enlarge(-1, -1));
if (m_lutCalibrator && m_lutCalibrator->isValid() && m_fbo) m_fbo->release();
// throw the picked color to the histogram
m_histogramPopup->updateAverageColor(pix);
// throw it to the style editor as well
if (putValueToStyleEditor) setPickedColorToStyleEditor(pix);
}
开发者ID:janisozaur,项目名称:opentoonz,代码行数:30,代码来源:imageviewer.cpp
示例2: getBBoxEnlargement
TRectD SandorFxRenderData::getBBoxEnlargement(const TRectD &bbox)
{
switch (m_type) {
case BlendTz: {
//Nothing happen, unless we have color 0 among the blended ones. In such case,
//we have to enlarge the bbox proportionally to the amount param.
std::vector<std::string> items;
std::string indexes = std::string(m_argv[0]);
parseIndexes(indexes, items);
PaletteFilterFxRenderData paletteFilterData;
insertIndexes(items, &paletteFilterData);
if (paletteFilterData.m_colors.size() > 0 && *paletteFilterData.m_colors.begin() == 0)
return bbox.enlarge(m_blendParams.m_amount);
return bbox;
}
case Calligraphic:
case OutBorder:
return bbox.enlarge(m_callParams.m_thickness);
case ArtAtContour:
return bbox.enlarge(
tmax(tceil(m_controllerBBox.getLx()), tceil(m_controllerBBox.getLy())) * m_contourParams.m_maxSize);
default:
assert(false);
return bbox;
}
}
开发者ID:PsmithG,项目名称:opentoonz,代码行数:31,代码来源:ttzpimagefx.cpp
示例3: drawCleanupCamera
void CameraTestTool::drawCleanupCamera(double pixelSize) {
CleanupParameters *cp =
CleanupSettingsModel::instance()->getCurrentParameters();
TRectD rect = cp->m_camera.getStageRect();
glColor3d(1.0, 0.0, 0.0);
glLineStipple(1, 0xFFFF);
glEnable(GL_LINE_STIPPLE);
// box
glBegin(GL_LINE_STRIP);
glVertex2d(rect.x0, rect.y0);
glVertex2d(rect.x0, rect.y1 - pixelSize);
glVertex2d(rect.x1 - pixelSize, rect.y1 - pixelSize);
glVertex2d(rect.x1 - pixelSize, rect.y0);
glVertex2d(rect.x0, rect.y0);
glEnd();
// central cross
double dx = 0.05 * rect.getP00().x;
double dy = 0.05 * rect.getP00().y;
tglDrawSegment(TPointD(-dx, -dy), TPointD(dx, dy));
tglDrawSegment(TPointD(-dx, dy), TPointD(dx, -dy));
glDisable(GL_LINE_STIPPLE);
// camera name
TPointD pos = rect.getP01() + TPointD(0, 4);
glPushMatrix();
glTranslated(pos.x, pos.y, 0);
glScaled(2, 2, 2);
tglDrawText(TPointD(), "Cleanup Camera");
glPopMatrix();
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:35,代码来源:cleanuppreview.cpp
示例4: TImageP
void RGBPickerTool::pickRect() {
TImageP image = TImageP(getImage(false));
TTool::Application *app = TTool::getApplication();
TPaletteHandle *ph = app->getPaletteController()->getCurrentPalette();
int styleId = ph->getStyleIndex();
TPalette *palette = ph->getPalette();
TRectD area = m_selectingRect;
if (!palette) return;
if (m_selectingRect.x0 > m_selectingRect.x1) {
area.x1 = m_selectingRect.x0;
area.x0 = m_selectingRect.x1;
}
if (m_selectingRect.y0 > m_selectingRect.y1) {
area.y1 = m_selectingRect.y0;
area.y0 = m_selectingRect.y1;
}
m_selectingRect.empty();
if (area.getLx() <= 1 || area.getLy() <= 1) return;
StylePicker picker(image, palette);
// iwsw commented out temporarily
// if (m_viewer->get3DLutUtil() &&
// Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
// m_viewer->get3DLutUtil()->bindFBO();
m_currentValue = picker.pickColor(area);
// iwsw commented out temporarily
// if (m_viewer->get3DLutUtil() &&
// Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
// m_viewer->get3DLutUtil()->releaseFBO();
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:33,代码来源:rgbpickertool.cpp
示例5: tglFillRect
void tglFillRect(const TRectD &rect)
{
glBegin(GL_POLYGON);
tglVertex(rect.getP00());
tglVertex(rect.getP10());
tglVertex(rect.getP11());
tglVertex(rect.getP01());
glEnd();
}
开发者ID:guozanhua,项目名称:opentoonz,代码行数:9,代码来源:tgl.cpp
示例6: tglDrawRect
void tglDrawRect(const TRectD &rect)
{
glBegin(GL_LINE_LOOP);
tglVertex(rect.getP00());
tglVertex(rect.getP10());
tglVertex(rect.getP11());
tglVertex(rect.getP01());
glEnd();
}
开发者ID:guozanhua,项目名称:opentoonz,代码行数:9,代码来源:tgl.cpp
示例7: computeThickness
void FullColorBrushTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e)
{
m_brushPos = m_mousePos = pos;
TRasterImageP ri = (TRasterImageP)getImage(true);
if (!ri)
return;
double maxThickness = m_thickness.getValue().second;
double thickness = m_pressure.getValue() ? computeThickness(e.m_pressure, m_thickness) : maxThickness;
double opacity = (m_pressure.getValue() ? computeThickness(e.m_pressure, m_opacity) : m_opacity.getValue().second) * 0.01;
TDimension size = m_workRaster->getSize();
TPointD rasCenter = TPointD(size.lx * 0.5, size.ly * 0.5);
TThickPoint point(pos + rasCenter, thickness);
TThickPoint old = m_points.back();
if (norm2(point - old) < 4)
return;
TThickPoint mid((old + point) * 0.5, (point.thick + old.thick) * 0.5);
m_points.push_back(mid);
m_points.push_back(point);
TRect bbox;
int m = m_points.size();
TRectD invalidateRect;
if (m == 3) {
// ho appena cominciato. devo disegnare un segmento
TThickPoint pa = m_points.front();
vector<TThickPoint> points;
points.push_back(pa);
points.push_back(mid);
invalidateRect = ToolUtils::getBounds(points, maxThickness);
bbox = m_brush->getBoundFromPoints(points);
updateWorkAndBackupRasters(bbox + m_lastRect);
m_tileSaver->save(bbox);
m_brush->addArc(pa, (pa + mid) * 0.5, mid, m_oldOpacity, opacity);
m_lastRect += bbox;
} else {
// caso generale: disegno un arco
vector<TThickPoint> points;
points.push_back(m_points[m - 4]);
points.push_back(old);
points.push_back(mid);
invalidateRect = ToolUtils::getBounds(points, maxThickness);
bbox = m_brush->getBoundFromPoints(points);
updateWorkAndBackupRasters(bbox + m_lastRect);
m_tileSaver->save(bbox);
m_brush->addArc(m_points[m - 4], old, mid, m_oldOpacity, opacity);
m_lastRect += bbox;
}
m_oldOpacity = opacity;
m_brush->updateDrawing(ri->getRaster(), m_backUpRas, m_currentColor, bbox, m_opacity.getValue().second * 0.01);
invalidate(invalidateRect.enlarge(2) - rasCenter);
m_strokeRect += bbox;
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:56,代码来源:fullcolorbrushtool.cpp
示例8: TRectD
TRectD TAffine::operator*(const TRectD &rect) const
{
if (rect != TConsts::infiniteRectD) {
TPointD p1 = *this * rect.getP00(),
p2 = *this * rect.getP01(),
p3 = *this * rect.getP10(),
p4 = *this * rect.getP11();
return TRectD(tmin(p1.x, p2.x, p3.x, p4.x), tmin(p1.y, p2.y, p3.y, p4.y),
tmax(p1.x, p2.x, p3.x, p4.x), tmax(p1.y, p2.y, p3.y, p4.y));
} else
return TConsts::infiniteRectD;
}
开发者ID:AmEv7Fam,项目名称:opentoonz,代码行数:12,代码来源:tgeometry.cpp
示例9: get_render_enlarge
void get_render_enlarge(const double frame, const TAffine affine,
TRectD &bBox) {
TPointD center(this->get_render_center(frame, bBox.getP00(), affine));
int margin = this->get_render_int_margin(frame, bBox, affine, center);
if (0 < margin) {
/* 拡大のしすぎを防ぐテキトーな制限 */
if (4096 < margin) {
margin = 4096;
}
bBox = bBox.enlarge(margin);
}
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:12,代码来源:ino_radial_blur.cpp
示例10: drawControlRect
void ShiftTraceTool::drawControlRect() {
if (m_ghostIndex < 0 || m_ghostIndex > 1) return;
int row = m_row[m_ghostIndex];
if (row < 0) return;
int col = TApp::instance()->getCurrentColumn()->getColumnIndex();
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
TXshCell cell = xsh->getCell(row, col);
if (cell.isEmpty()) return;
TImageP img = cell.getImage(false);
if (!img) return;
TRectD box;
if (TRasterImageP ri = img) {
TRasterP ras = ri->getRaster();
box =
(convert(ras->getBounds()) - ras->getCenterD()) * ri->getSubsampling();
} else if (TToonzImageP ti = img) {
TRasterP ras = ti->getRaster();
box =
(convert(ras->getBounds()) - ras->getCenterD()) * ti->getSubsampling();
} else if (TVectorImageP vi = img) {
box = vi->getBBox();
} else {
return;
}
glPushMatrix();
tglMultMatrix(getGhostAff());
TPixel32 color;
color = m_highlightedGadget == TranslateGadget ? TPixel32(200, 100, 100)
: TPixel32(120, 120, 120);
tglColor(color);
glBegin(GL_LINE_STRIP);
glVertex2d(box.x0, box.y0);
glVertex2d(box.x1, box.y0);
glVertex2d(box.x1, box.y1);
glVertex2d(box.x0, box.y1);
glVertex2d(box.x0, box.y0);
glEnd();
color =
m_highlightedGadget == 2000 ? TPixel32(200, 100, 100) : TPixel32::White;
double r = 4 * sqrt(tglGetPixelSize2());
drawDot(box.getP00(), r, color);
drawDot(box.getP01(), r, color);
drawDot(box.getP10(), r, color);
drawDot(box.getP11(), r, color);
if (m_curveStatus == NoCurve) {
color =
m_highlightedGadget == 2001 ? TPixel32(200, 100, 100) : TPixel32::White;
TPointD c = m_center[m_ghostIndex];
drawDot(c, r, color);
}
glPopMatrix();
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:52,代码来源:shifttracetool.cpp
示例11: getMemoryRequirement
int getMemoryRequirement(const TRectD &rect, double frame,
const TRenderSettings &info) override {
double scale = sqrt(fabs(info.m_affine.det()));
double blur = m_value->getValue(frame) * scale;
return TRasterFx::memorySize(rect.enlarge(blur), info.m_bpp);
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:7,代码来源:glowfx.cpp
示例12: get_render_enlarge
void get_render_enlarge(
const double frame, const TAffine affine, TRectD &bBox)
{
const int margin = this->get_render_margin(frame, affine);
if (0 < margin) {
bBox = bBox.enlarge(static_cast<double>(margin));
}
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:8,代码来源:ino_motion_blur.cpp
示例13: get_render_enlarge
void get_render_enlarge(const double frame, const TAffine affine,
TRectD &bBox) {
const int margin = igs::gaussian_blur_hv::int_radius(
this->get_render_real_radius(frame, affine));
if (0 < margin) {
bBox = bBox.enlarge(static_cast<double>(margin));
}
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:8,代码来源:ino_blur.cpp
示例14: doGetBBox
bool doGetBBox(double frame, TRectD &bBox, const TRenderSettings &info) {
if (m_warped.isConnected()) {
int ret = m_warped->doGetBBox(frame, bBox, info);
if (ret && !bBox.isEmpty()) {
if (bBox != TConsts::infiniteRectD) {
WarpParams params;
params.m_intensity = m_intensity->getValue(frame);
bBox = bBox.enlarge(getWarpRadius(params));
}
return true;
}
}
bBox = TRectD();
return false;
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:18,代码来源:linearwavefx.cpp
示例15: TRect
TRect TRasterImageUtils::convertWorldToRaster(const TRectD &area, const TRasterImageP ri)
{
if (area.isEmpty())
return TRect();
if (!ri || !ri->getRaster())
return TRect(tfloor(area.x0), tfloor(area.y0), tfloor(area.x1) - 1, tfloor(area.y1) - 1);
TRasterP ras = ri->getRaster();
TRectD rect(area + ras->getCenterD());
return TRect(tfloor(rect.x0), tfloor(rect.y0), tceil(rect.x1) - 1, tceil(rect.y1) - 1);
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:10,代码来源:trasterimageutils.cpp
示例16: glPushMatrix
/*-- Paste後のフローティング状態の画像の描画 --*/
void RasterSelectionTool::drawFloatingSelection()
{
double pixelSize = TTool::getApplication()->getCurrentTool()->getTool()->getPixelSize();
TAffine aff = m_rasterSelection.getTransformation();
glPushMatrix();
tglMultMatrix(aff);
//draw m_floatingSelection
if (isFloating()) {
TRasterP floatingSelection = m_rasterSelection.getFloatingSelection();
TImageP app;
if (TRasterCM32P toonzRas = (TRasterCM32P)(floatingSelection))
app = TToonzImageP(toonzRas, toonzRas->getBounds());
if (TRaster32P fullColorRas = (TRaster32P)(floatingSelection))
app = TRasterImageP(fullColorRas);
if (TRasterGR8P grRas = (TRasterGR8P)(floatingSelection))
app = TRasterImageP(grRas);
app->setPalette(m_rasterSelection.getCurrentImage()->getPalette());
FourPoints points = getBBox() * aff.inv();
TRectD bbox = points.getBox();
TPointD center((bbox.getP00() + bbox.getP11()) * 0.5);
if (TToonzImageP ti = (TToonzImageP)app)
GLRasterPainter::drawRaster(TTranslation(center), ti, false);
if (TRasterImageP ri = (TRasterImageP)app)
GLRasterPainter::drawRaster(TTranslation(center), ri, true);
}
std::vector<TStroke> strokes = m_rasterSelection.getStrokes();
int i;
for (i = 0; i < (int)strokes.size(); i++) {
TStroke stroke = strokes[i];
glEnable(GL_LINE_STIPPLE);
glLineStipple(1, 0xF0F0);
tglColor(TPixel32::Black);
drawStrokeCenterline(stroke, pixelSize);
glDisable(GL_LINE_STIPPLE);
}
glPopMatrix();
}
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:42,代码来源:rasterselectiontool.cpp
示例17: get_render_int_margin
int get_render_int_margin(const double frame, const TRectD &bBox,
const TAffine affine, TPointD center) {
/*--- 単位変換(mm-->render用pixel)と長さ(scale)変換 ---*/
const double scale = ino::pixel_per_mm() * sqrt(fabs(affine.det()));
/*--- margin計算...Twist時正確でない ---*/
return igs::radial_blur::reference_margin(
static_cast<int>(ceil(bBox.getLy())),
static_cast<int>(ceil(bBox.getLx())), center.x, center.y,
this->m_twist->getValue(frame) * 3.14159265358979 / 180.0,
0.0 // this->m_twist_radius->getValue(frame) * scale
,
this->m_blur->getValue(frame) / ino_param_range
//,this->m_radius->getValue(frame) * scale
,
0 /* debug:2012-02-01:ゼロ以上だとmarginが小さすぎになり画像が切れてしまう
*/
,
(this->m_anti_alias->getValue() ? 4 : 1));
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:21,代码来源:ino_radial_blur.cpp
示例18: get_render_enlarge
void Iwa_GradientWarpFx::get_render_enlarge(const double frame,
const TAffine affine,
TRectD &bBox)
{
double h_maxlen = 0.0;
double v_maxlen = 0.0;
this->get_render_real_hv(frame, affine, h_maxlen, v_maxlen);
const int margin = static_cast<int>(ceil(
(h_maxlen < v_maxlen) ? v_maxlen : h_maxlen));
if (0 < margin) {
bBox = bBox.enlarge(static_cast<double>(margin));
}
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:13,代码来源:iwa_gradientwarpfx.cpp
示例19: rect_autofill_learn
void rect_autofill_learn(const TVectorImageP &imgToLearn, const TRectD &rect)
{
if (rect.getLx() * rect.getLy() < MIN_SIZE) return;
double pbx, pby;
double totalArea = 0;
pbx = pby = 0;
if (!regionsReference.isEmpty()) regionsReference.clear();
int i, index = 0, regionCount = imgToLearn->getRegionCount();
for (i = 0; i < regionCount; i++) {
TRegion *region = imgToLearn->getRegion(i);
if (rect.contains(region->getBBox())) {
scanRegion(region, index, regionsReference, rect);
index++;
}
int j, subRegionCount = region->getSubregionCount();
for (j = 0; j < subRegionCount; j++) {
TRegion *subRegion = region->getSubregion(j);
if (rect.contains(subRegion->getBBox()))
scanSubRegion(subRegion, index, regionsReference, rect);
}
}
QMap<int, Region>::Iterator it;
for (it = regionsReference.begin(); it != regionsReference.end(); it++) {
pbx += it.value().m_barycentre.x;
pby += it.value().m_barycentre.y;
totalArea += it.value().m_area;
}
if (totalArea > 0)
referenceB = TPointD(pbx / totalArea, pby / totalArea);
else
referenceB = TPointD(0.0, 0.0);
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:38,代码来源:autofillpli.cpp
示例20: invalidate
void TTool::invalidate(const TRectD &rect) {
if (m_viewer) {
if (rect.isEmpty())
m_viewer->GLInvalidateAll();
else {
TPointD dpiScale(1, 1);
TXshSimpleLevel *sl =
getApplication()->getCurrentLevel()->getSimpleLevel();
if (sl) dpiScale = getCurrentDpiScale(sl, getCurrentFid());
m_viewer->GLInvalidateRect(getCurrentColumnMatrix() *
TScale(dpiScale.x, dpiScale.y) * rect);
}
}
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:14,代码来源:tool.cpp
注:本文中的TRectD类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论