Breaking changes for expr_color

Removed the typedef-name nana::color_t
This commit is contained in:
cnjinhao
2014-12-18 13:08:44 +08:00
parent 42788db077
commit e64b6ec2b2
43 changed files with 185 additions and 915 deletions

View File

@@ -6,16 +6,6 @@ namespace nana
{
namespace paint
{
namespace image_process
{
//There are definitions of pure virtual destructor of image processor interfaces
stretch_interface::~stretch_interface(){}
alpha_blend_interface::~alpha_blend_interface(){}
blend_interface::~blend_interface(){}
line_interface::~line_interface(){}
blur_interface::~blur_interface(){}
}
namespace detail
{
//class image_process_provider

View File

@@ -48,9 +48,10 @@ namespace detail
}
unsigned char * alloc_fade_table(double fade_rate)
std::unique_ptr<unsigned char[]> alloc_fade_table(double fade_rate)
{
unsigned char* tablebuf = new unsigned char[0x100 * 2];
std::unique_ptr<unsigned char[]> ptr(new unsigned char[0x100 * 2]);
unsigned char* tablebuf = ptr.get();
unsigned char* d_table = tablebuf;
unsigned char* s_table = d_table + 0x100;
@@ -76,37 +77,9 @@ namespace detail
d_table += 4;
s_table += 4;
}
return tablebuf;
return ptr;
}
void free_fade_table(const unsigned char* table)
{
delete [] table;
}
/*
nana::pixel_color_t fade_color(nana::pixel_color_t bgcolor, nana::pixel_color_t fgcolor, double fade_rate) //deprecated
{
pixel_color_t ret;
double lrate = 1.0 - fade_rate;
ret.element.red = static_cast<unsigned char>(bgcolor.element.red * fade_rate + fgcolor.element.red * lrate);
ret.element.green = static_cast<unsigned char>(bgcolor.element.green * fade_rate + fgcolor.element.green * lrate);
ret.element.blue = static_cast<unsigned char>(bgcolor.element.blue * fade_rate + fgcolor.element.blue * lrate);
ret.element.alpha_channel = 0;
return ret;
}
nana::pixel_color_t fade_color(nana::pixel_color_t bgcolor, nana::pixel_color_t fgcolor, const unsigned char* const fade_table) //deprecated
{
const unsigned char * const s_fade_table = fade_table + 0x100;
bgcolor.element.red = fade_table[bgcolor.element.red] + s_fade_table[fgcolor.element.red];
bgcolor.element.green = fade_table[bgcolor.element.green] + s_fade_table[fgcolor.element.green];
bgcolor.element.blue = fade_table[bgcolor.element.blue] + s_fade_table[fgcolor.element.blue];
return bgcolor;
}
*/
nana::pixel_color_t fade_color_intermedia(nana::pixel_color_t fgcolor, const unsigned char* fade_table)
{
fade_table += 0x100;
@@ -124,7 +97,7 @@ namespace detail
return bgcolor;
}
void blend(drawable_type dw, const nana::rectangle& area, unsigned color, double fade_rate)
void blend(drawable_type dw, const nana::rectangle& area, pixel_color_t color, double fade_rate)
{
if(fade_rate <= 0) return;
if(fade_rate > 1) fade_rate = 1;
@@ -133,9 +106,9 @@ namespace detail
if(false == nana::overlap(drawable_size(dw), area, r))
return;
unsigned red = static_cast<unsigned>((color & 0xFF0000) * fade_rate);
unsigned green = static_cast<unsigned>((color & 0xFF00) * fade_rate);
unsigned blue = static_cast<unsigned>((color & 0xFF) * fade_rate);
unsigned red = static_cast<unsigned>((color.value & 0xFF0000) * fade_rate);
unsigned green = static_cast<unsigned>((color.value & 0xFF00) * fade_rate);
unsigned blue = static_cast<unsigned>((color.value & 0xFF) * fade_rate);
double lrate = 1 - fade_rate;
pixel_buffer pixbuf(dw, r.y, r.height);

View File

@@ -1,7 +1,7 @@
/*
* Paint Graphics Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -319,8 +319,8 @@ namespace paint
if(dw)
{
//dw->fgcolor(0);
dw->set_color(0x0);
dw->set_text_color(0x0);
dw->set_color(colors::black);
dw->set_text_color(colors::black);
#if defined(NANA_WINDOWS)
dw->bytes_per_line = width * sizeof(pixel_argb_t);
#else
@@ -522,305 +522,7 @@ namespace paint
}
return false;
}
/*
unsigned graphics::bidi_string(int x, int y, color_t col, const nana::char_t* str, std::size_t len) //deprecated
{
int origin_x = x;
unicode_bidi bidi;
std::vector<unicode_bidi::entity> reordered;
bidi.linestr(str, len, reordered);
for(auto & i : reordered)
{
string(x, y, col, i.begin, i.end - i.begin);
x += static_cast<int>(text_extent_size(i.begin, i.end - i.begin).width);
}
return static_cast<unsigned>(x - origin_x);
}
*/
/*
void graphics::string(int x, int y, color_t color, const nana::string& str, std::size_t len)
{
string(x, y, color, str.c_str(), len);
}
void graphics::string(int x, int y, color_t color, const nana::string& str)
{
string(x, y, color, str.c_str(), str.size());
}
void graphics::string(int x, int y, color_t color, const nana::char_t* str, std::size_t len)
{
if(handle_ && str && len)
{
handle_->set_text_color(color);
const nana::char_t * end = str + len;
const nana::char_t * i = std::find(str, end, '\t');
if(i != end)
{
std::size_t tab_pixels = handle_->string.tab_length * handle_->string.tab_pixels;
while(true)
{
len = i - str;
if(len)
{
//Render a part that does not contains a tab
detail::draw_string(handle_, point{ x, y }, str, len);
x += detail::raw_text_extent_size(handle_, str, len).width;
}
str = i;
while(str != end && (*str == '\t'))
++str;
if(str != end)
{
//Now i_tab is not a tab, but a non-tab character following the previous tabs
x += static_cast<int>(tab_pixels * (str - i));
i = std::find(str, end, '\t');
}
else
break;
}
}
else
detail::draw_string(handle_, point{ x, y }, str, len);
if(changed_ == false) changed_ = true;
}
}
void graphics::string(int x, int y, color_t c, const nana::char_t* str)
{
string(x, y, c, str, nana::strlen(str));
}
*/
/*
void graphics::set_pixel(int x, int y, color_t color)
{
if(handle_)
{
#if defined(NANA_WINDOWS)
::SetPixel(handle_->context, x, y, NANA_RGB(color));
#elif defined(NANA_X11)
Display* disp = nana::detail::platform_spec::instance().open_display();
handle_->fgcolor(color);
::XDrawPoint(disp, handle_->pixmap, handle_->context,x, y);
#endif
if(changed_ == false) changed_ = true;
}
}
void graphics::rectangle(int x, int y, unsigned width, unsigned height, color_t color, bool solid)
{
if((static_cast<int>(width) > -x) && (static_cast<int>(height) > -y) && width && height && handle_)
{
#if defined(NANA_WINDOWS)
::RECT r = {x, y, static_cast<long>(x + width), static_cast<long>(y + height)};
handle_->brush.set(handle_->context, handle_->brush.Solid, color);
(solid ? ::FillRect : ::FrameRect)(handle_->context, &r, handle_->brush.handle);
#elif defined(NANA_X11)
Display* disp = nana::detail::platform_spec::instance().open_display();
handle_->fgcolor(color);
if(solid)
::XFillRectangle(disp, handle_->pixmap, handle_->context, x, y, width, height);
else
::XDrawRectangle(disp, handle_->pixmap, handle_->context, x, y, width - 1, height - 1);
#endif
if(changed_ == false) changed_ = true;
}
}
void graphics::rectangle(nana::color_t color, bool solid)
{
rectangle(0, 0, size_.width, size_.height, color, solid);
}
void graphics::rectangle(const nana::rectangle & r, color_t color, bool solid)
{
rectangle(r.x, r.y, r.width, r.height, color, solid);
}
void graphics::rectangle_line(const nana::rectangle& r, color_t color_left, color_t color_top, color_t color_right, color_t color_bottom)
{
int right = r.x + r.width - 1;
int bottom = r.y + r.height -1;
line_begin(r.x, r.y);
line_to(right, r.y, color_top);
line_to(right, bottom, color_right);
line_to(r.x, bottom, color_bottom);
line_to(r.x, r.y, color_left);
}
void graphics::round_rectangle(int x, int y, unsigned width, unsigned height, unsigned radius_x, unsigned radius_y, color_t color, bool solid, color_t color_if_solid)
{
if(handle_)
{
#if defined(NANA_WINDOWS)
handle_->pen.set(handle_->context, PS_SOLID, 1, color);
if(solid)
{
handle_->brush.set(handle_->context, handle_->brush.Solid, color_if_solid);
::RoundRect(handle_->context, x, y, x + static_cast<int>(width), y + static_cast<int>(height), static_cast<int>(radius_x * 2), static_cast<int>(radius_y * 2));
}
else
{
handle_->brush.set(handle_->context, handle_->brush.Solid, color);
handle_->round_region.set(nana::rectangle(x, y, width, height), radius_x , radius_y);
::FrameRgn(handle_->context, handle_->round_region.handle, handle_->brush.handle, 1, 1);
}
if(changed_ == false) changed_ = true;
#elif defined(NANA_X11)
if(solid && (color == color_if_solid))
{
rectangle(x, y, width, height, color, true);
}
else
{
rectangle(x, y, width, height, color, false);
if(solid)
rectangle(x + 1, y + 1, width - 2, height - 2, color_if_solid, true);
}
#endif
}
}
void graphics::round_rectangle(const nana::rectangle& r, unsigned radius_x, unsigned radius_y, color_t color, bool solid, color_t color_if_solid)
{
round_rectangle(r.x, r.y, r.width, r.height, radius_x, radius_y, color, solid, color_if_solid);
}
void graphics::shadow_rectangle(const nana::rectangle& r, color_t beg_color, color_t end_color, bool vertical)
{
#if defined(NANA_WINDOWS)
if(pxbuf_.open(handle_))
{
pxbuf_.shadow_rectangle(r, beg_color, end_color, 0.0, vertical);
pxbuf_.paste(handle_, 0, 0);
}
#elif defined(NANA_X11)
shadow_rectangle(r.x, r.y, r.width, r.height, beg_color, end_color, vertical);
#endif
}
void graphics::shadow_rectangle(int x, int y, unsigned width, unsigned height, color_t color_begin, color_t color_end, bool vertical)
{
#if defined(NANA_WINDOWS)
if(pxbuf_.open(handle_))
{
pxbuf_.shadow_rectangle(nana::rectangle(x, y, width, height), color_begin, color_end, 0.0, vertical);
pxbuf_.paste(handle_, 0, 0);
}
#elif defined(NANA_X11)
if(0 == handle_) return;
int deltapx = int(vertical ? height : width);
double r, g, b;
const double delta_r = int(((color_end & 0xFF0000) >> 16) - (r = ((color_begin & 0xFF0000) >> 16))) / double(deltapx);
const double delta_g = int(((color_end & 0xFF00) >> 8) - (g = ((color_begin & 0xFF00) >> 8))) / double(deltapx);
const double delta_b = int((color_end & 0xFF) - (b = (color_begin & 0xFF))) / double(deltapx);
unsigned last_color = (int(r) << 16) | (int(g) << 8) | int(b);
Display * disp = nana::detail::platform_spec::instance().open_display();
handle_->fgcolor(last_color);
const int endpos = deltapx + (vertical ? y : x);
if(endpos > 0)
{
if(vertical)
{
int x1 = x, x2 = x + static_cast<int>(width);
for(; y < endpos; ++y)
{
::XDrawLine(disp, handle_->pixmap, handle_->context, x1, y, x2, y);
unsigned new_color = (int(r += delta_r) << 16) | (int(g += delta_g) << 8) | int(b += delta_b);
if(new_color != last_color)
{
last_color = new_color;
handle_->fgcolor(last_color);
}
}
}
else
{
int y1 = y, y2 = y + static_cast<int>(height);
for(; x < endpos; ++x)
{
::XDrawLine(disp, handle_->pixmap, handle_->context, x, y1, x, y2);
unsigned new_color = (int(r += delta_r) << 16) | (int(g += delta_g) << 8) | int(b += delta_b);
if(new_color != last_color)
{
last_color = new_color;
handle_->fgcolor(last_color);
}
}
}
}
#endif
if(changed_ == false) changed_ = true;
}
void graphics::line(int x1, int y1, int x2, int y2, color_t color)
{
if(!handle_) return;
handle_->set_color(color);
#if defined(NANA_WINDOWS)
if(x1 != x2 || y1 != y2)
{
handle_->update_pen();
//handle_->pen.set(handle_->context, PS_SOLID, 1, color); //deprecated
::MoveToEx(handle_->context, x1, y1, 0);
::LineTo(handle_->context, x2, y2);
}
::SetPixel(handle_->context, x2, y2, NANA_RGB(color));
#elif defined(NANA_X11)
Display* disp = nana::detail::platform_spec::instance().open_display();
//handle_->fgcolor(color); //deprecated
handle_->update_color();
::XDrawLine(disp, handle_->pixmap, handle_->context, x1, y1, x2, y2);
#endif
if(changed_ == false) changed_ = true;
}
void graphics::line(const point& beg, const point& end, color_t color)
{
line(beg.x, beg.y, end.x, end.y, color);
}
void graphics::lines(const point* points, std::size_t n_of_points, color_t color)
{
if(!handle_ || nullptr == points || 0 == n_of_points) return;
#if defined(NANA_WINDOWS)
handle_->pen.set(handle_->context, PS_SOLID, 1, color);
::MoveToEx(handle_->context, points->x, points->y, nullptr);
const point * end = points + n_of_points;
for(const point * i = points + 1; i != end; ++i)
::LineTo(handle_->context, i->x, i->y);
if(*points != *(end - 1))
::SetPixel(handle_->context, (end-1)->x, (end-1)->y, NANA_RGB(color));
#elif defined(NANA_X11)
Display* disp = nana::detail::platform_spec::instance().open_display();
handle_->fgcolor(color);
XPoint * const x11points = new XPoint[n_of_points];
XPoint * end = x11points + n_of_points;
for(XPoint * i = x11points; i != end; ++i)
{
i->x = points->x;
i->y = points->y;
++points;
}
::XDrawLines(disp, handle_->pixmap, handle_->context, x11points, static_cast<int>(n_of_points), CoordModePrevious);
delete [] x11points;
#endif
if(changed_ == false) changed_ = true;
}
*/
void graphics::line_begin(int x, int y)
{
if(!handle_) return;
@@ -832,25 +534,6 @@ namespace paint
handle_->line_begin_pos.y = y;
#endif
}
/*
void graphics::line_to(int x, int y, color_t color)
{
if(!handle_) return;
#if defined(NANA_WINDOWS)
handle_->pen.set(handle_->context, PS_SOLID, 1, color);
::LineTo(handle_->context, x, y);
#elif defined(NANA_X11)
Display* disp = nana::detail::platform_spec::instance().open_display();
handle_->fgcolor(color);
::XDrawLine(disp, handle_->pixmap, handle_->context,
handle_->line_begin_pos.x, handle_->line_begin_pos.y,
x, y);
handle_->line_begin_pos.x = x;
handle_->line_begin_pos.y = y;
#endif
if(changed_ == false) changed_ = true;
}
*/
void graphics::bitblt(int x, int y, const graphics& src)
{
@@ -937,15 +620,6 @@ namespace paint
}
}
void graphics::blend(const nana::rectangle& r, nana::color_t color, double fade_rate)
{
if(handle_)
{
nana::paint::detail::blend(handle_, r, color, fade_rate);
if(changed_ == false) changed_ = true;
}
}
void graphics::blur(const nana::rectangle& r, std::size_t radius)
{
if(handle_)
@@ -1182,32 +856,17 @@ namespace paint
#endif
}
}
/*
color_t graphics::mix(color_t a, color_t b, double fade_rate) //deprecated
{
pixel_argb_t pa, pb, ret;
ret.value = 0;
pa.value = a;
pb.value = b;
ret.element.red = static_cast<unsigned char>(pa.element.red * fade_rate + pb.element.red * (1 - fade_rate));
ret.element.green = static_cast<unsigned char>(pa.element.green * fade_rate + pb.element.green * (1 - fade_rate));
ret.element.blue = static_cast<unsigned char>(pa.element.blue * fade_rate + pb.element.blue * (1 - fade_rate));
return ret.value;
}
*/
void graphics::set_color(const ::nana::expr_color& col)
{
if (handle_)
handle_->set_color(col.argb().value);
handle_->set_color(col);
}
void graphics::set_text_color(const ::nana::expr_color& col)
{
if (handle_)
handle_->set_text_color(col.argb().value);
handle_->set_text_color(col);
}
unsigned graphics::bidi_string(const nana::point& pos, const char_t * str, std::size_t len)
@@ -1228,7 +887,7 @@ namespace paint
{
if (handle_)
{
nana::paint::detail::blend(handle_, r, clr.px_color().value, fade_rate);
nana::paint::detail::blend(handle_, r, clr.px_color(), fade_rate);
if (changed_ == false) changed_ = true;
}
}
@@ -1237,7 +896,7 @@ namespace paint
{
if (handle_)
{
handle_->set_color(clr.px_color().value);
handle_->set_color(clr);
set_pixel(x, y);
}
}
@@ -1342,7 +1001,7 @@ namespace paint
void graphics::line_to(const point& pos, const expr_color& clr)
{
if (!handle_) return;
handle_->set_color(clr.px_color().value);
handle_->set_color(clr);
line_to(pos);
}
@@ -1474,7 +1133,7 @@ namespace paint
if (handle_)
{
#if defined(NANA_WINDOWS)
handle_->set_color(clr.px_color().value);
handle_->set_color(clr);
if (solid)
{
handle_->update_pen();

View File

@@ -776,7 +776,7 @@ namespace nana{ namespace paint
}
}
void pixel_buffer::line(const nana::point &pos_beg, const nana::point &pos_end, nana::color_t color, double fade_rate)
void pixel_buffer::line(const point &pos_beg, const point &pos_end, const ::nana::expr_color& clr, double fade_rate)
{
pixel_buffer_storage * sp = storage_.get();
if(nullptr == sp) return;
@@ -785,21 +785,25 @@ namespace nana{ namespace paint
//are always in the area of rectangle, good_pos_beg is left point, good_pos_end is right.
nana::point good_pos_beg, good_pos_end;
if(intersection(nana::rectangle(sp->pixel_size), pos_beg, pos_end, good_pos_beg, good_pos_end))
(*(sp->img_pro.line))->process(*this, good_pos_beg, good_pos_end, color, fade_rate);
(*(sp->img_pro.line))->process(*this, good_pos_beg, good_pos_end, clr, fade_rate);
}
void pixel_buffer::rectangle(const nana::rectangle &r, nana::color_t col, double fade_rate, bool solid)
void pixel_buffer::rectangle(const nana::rectangle &r, const ::nana::expr_color& clr, double fade_rate, bool solid)
{
pixel_buffer_storage * sp = storage_.get();
if((nullptr == sp) || (fade_rate == 1.0)) return;
bool fade = (fade_rate != 0.0);
unsigned char * fade_table = nullptr;
std::unique_ptr<unsigned char[]> autoptr;
auto rgb_color = clr.px_color().value;
nana::pixel_argb_t rgb_imd;
if(fade)
{
fade_table = detail::alloc_fade_table(1 - fade_rate);
rgb_imd.value = col;
autoptr = detail::alloc_fade_table(1 - fade_rate);
fade_table = autoptr.get();
rgb_imd.value = rgb_color;
rgb_imd = detail::fade_color_intermedia(rgb_imd, fade_table);
}
@@ -830,7 +834,7 @@ namespace nana{ namespace paint
for (int top = ybeg; top < yend; ++top)
{
for (auto i = lineptr; i != end; ++i)
i->value = col;
i->value = rgb_color;
lineptr += sp->pixel_size.width;
end = lineptr + (xend - xbeg);
@@ -857,8 +861,8 @@ namespace nana{ namespace paint
{
for(;i != end; ++i, ++i_other)
{
i->value = col;
i_other->value = col;
i->value = rgb_color;
i_other->value = rgb_color;
}
}
}
@@ -877,7 +881,7 @@ namespace nana{ namespace paint
else
{
for(;i != end; ++i)
i->value = col;
i->value = rgb_color;
}
}
@@ -895,7 +899,7 @@ namespace nana{ namespace paint
else
{
for(;i != end; ++i)
i->value = col;
i->value = rgb_color;
}
}
}
@@ -924,8 +928,8 @@ namespace nana{ namespace paint
{
while(true)
{
i->value = col;
i_other->value = col;
i->value = rgb_color;
i_other->value = rgb_color;
if(i == end)
break;
@@ -955,7 +959,7 @@ namespace nana{ namespace paint
{
while(true)
{
i->value = col;
i->value = rgb_color;
if(i == end) break;
i += sp->pixel_size.width;
@@ -981,80 +985,13 @@ namespace nana{ namespace paint
{
while(true)
{
i->value = col;
i->value = rgb_color;
if(i == end) break;
i += sp->pixel_size.width;
}
}
}
}
detail::free_fade_table(fade_table);
}
void pixel_buffer::shadow_rectangle(const nana::rectangle& draw_rct, nana::color_t beg, nana::color_t end, double fade_rate, bool vertical)
{
pixel_buffer_storage * sp = storage_.get();
if(nullptr == sp) return;
nana::rectangle rct;
if(false == overlap(nana::rectangle(sp->pixel_size), draw_rct, rct))
return;
int deltapx = int(vertical ? rct.height : rct.width);
if(sp && deltapx)
{
nana::color_t r, g, b;
const int delta_r = (int(end & 0xFF0000) - int(r = (beg & 0xFF0000))) / deltapx;
const int delta_g = (int((end & 0xFF00) << 8) - int(g = ((beg & 0xFF00) << 8))) / deltapx;
const int delta_b = (int((end & 0xFF) << 16 ) - int(b = ((beg & 0xFF)<< 16))) / deltapx;
auto pxbuf = sp->raw_pixel_buffer + rct.x + rct.y * sp->pixel_size.width;
if(vertical)
{
if(deltapx + rct.y > 0)
{
unsigned align_4 = (rct.width & ~3);
unsigned align_reset = rct.width & 3;
while(deltapx--)
{
nana::pixel_argb_t px;
px.value = ((r += delta_r) & 0xFF0000) | (((g += delta_g) & 0xFF0000) >> 8) | (((b += delta_b) & 0xFF0000) >> 16);
auto dpx = pxbuf;
for(auto dpx_end = pxbuf + align_4; dpx != dpx_end; dpx += 4)
{
*dpx = px;
dpx[1] = px;
dpx[2] = px;
dpx[3] = px;
}
for(auto dpx_end = dpx + align_reset; dpx != dpx_end; ++dpx)
*dpx = px;
pxbuf += sp->pixel_size.width;
}
}
}
else
{
if(deltapx + rct.x > 0)
{
auto pxbuf_end = pxbuf + rct.width;
for(; pxbuf != pxbuf_end; ++pxbuf)
{
nana::pixel_argb_t px;
px.value = ((r += delta_r) & 0xFF0000) | (((g += delta_g) & 0xFF0000) >> 8) | (((b += delta_b) & 0xFF0000) >> 16);
auto dpx_end = pxbuf + rct.height * sp->pixel_size.width;
for(auto dpx = pxbuf; dpx != dpx_end; dpx += sp->pixel_size.width)
*dpx = px;
}
}
}
}
}
void pixel_buffer::gradual_rectangle(const ::nana::rectangle& draw_rct, const ::nana::expr_color& from, const ::nana::expr_color& to, double fade_rate, bool vertical)
@@ -1071,7 +1008,7 @@ namespace nana{ namespace paint
{
auto beg = from.argb().value;
auto end = to.argb().value;
nana::color_t r, g, b;
unsigned r, g, b;
const int delta_r = (int(end & 0xFF0000) - int(r = (beg & 0xFF0000))) / deltapx;
const int delta_g = (int((end & 0xFF00) << 8) - int(g = ((beg & 0xFF00) << 8))) / deltapx;
const int delta_b = (int((end & 0xFF) << 16) - int(b = ((beg & 0xFF) << 16))) / deltapx;

View File

@@ -118,7 +118,6 @@ namespace nana
{
graphics & graph;
int x, endpos;
//nana::color_t color; //deprecated
::nana::expr_color fgcolor;
unsigned omitted_pixels;
nana::unicode_bidi bidi;
@@ -452,7 +451,8 @@ namespace nana
std::size_t len = i.end - i.begin;
if(len > 1)
{
unsigned * pxbuf = new unsigned[len];
std::unique_ptr<unsigned[]> scope_res(new unsigned[len]);
auto pxbuf = scope_res.get();
//Find the char that should be splitted
graph.glyph_pixels(i.begin, len, pxbuf);
std::size_t idx_head = 0, idx_splitted;
@@ -520,8 +520,6 @@ namespace nana
}
}
}while(idx_head < len);
delete [] pxbuf;
}
else
xpos = x + static_cast<int>(i_ts_keeper->width);
@@ -555,39 +553,6 @@ namespace nana
: graph_(graph), text_align_(ta)
{}
/*
void text_renderer::render(int x, int y, color_t col, const char_t * str, std::size_t len)
{
if(graph_)
{
helper::draw_string ds(graph_.handle(), x, static_cast<int>(graph_.width()), text_align_);
ds.dw->fgcolor(col);
helper::for_each_line(str, len, y, ds);
}
}
void text_renderer::render(int x, int y, color_t col, const char_t * str, std::size_t len, unsigned restricted_pixels, bool omitted) //deprecated
{
if(graph_)
{
helper::draw_string_omitted dso(graph_, x, x + static_cast<int>(restricted_pixels), col, omitted);
graph_.handle()->fgcolor(col);
helper::for_each_line(str, len, y, dso);
}
}
*/
/*
void text_renderer::render(int x, int y, color_t col, const nana::char_t * str, std::size_t len, unsigned restricted_pixels)
{
if(graph_)
{
helper::draw_string_auto_changing_lines dsacl(graph_, x, x + static_cast<int>(restricted_pixels), text_align_);
graph_.handle()->fgcolor(col);
helper::for_each_line(str, len, y, dsacl);
}
}
*/
nana::size text_renderer::extent_size(int x, int y, const char_t* str, std::size_t len, unsigned restricted_pixels) const
{
nana::size extents;
@@ -628,7 +593,5 @@ namespace nana
}
}
//end class text_renderer
}
}