|
From: Analist <in...@an...> - 2006-07-26 08:14:05
|
Hi McSeem,
1) I load an image, example 300 dpi with this code:
BOOL CAggBuffer::LoadBmp(CString csFile)
{
ASSERT(!csFile.IsEmpty());
agg::pixel_map pmap_tmp;
if(!pmap_tmp.load_from_bmp(csFile)) return false;
m_dImageWidht = pmap_tmp.width();
m_dImageHeight = pmap_tmp.height();
agg::rendering_buffer rbuf_tmp;
rbuf_tmp.attach(pmap_tmp.buf(),
pmap_tmp.width(),
pmap_tmp.height(),
m_flip_y ?
pmap_tmp.stride() :
-pmap_tmp.stride());
m_pmap_img.create(pmap_tmp.width(),
pmap_tmp.height(),
agg::org_e(m_bpp),
0);
m_rbuf_window.attach(m_pmap_img.buf(),
m_pmap_img.width(),
m_pmap_img.height(),
m_flip_y ?
m_pmap_img.stride() :
-m_pmap_img.stride());
FitToImageSize(m_dImageWidht,m_dImageHeight);
switch(m_format)
{
case agg::pix_format_gray8:
switch(pmap_tmp.bpp())
{
//case 16: agg::color_conv(&m_rbuf_window, &rbuf_tmp,
color_conv_rgb555_to_gray8()); break;
case 24: agg::color_conv(&m_rbuf_window, &rbuf_tmp,
agg::color_conv_bgr24_to_gray8()); break;
//case 32: agg::color_conv(&m_rbuf_window, &rbuf_tmp,
color_conv_bgra32_to_gray8()); break;
}
break;
case agg::pix_format_gray16:
.................
.................
3) I process it with:
typedef agg::span_interpolator_persp_exact<> interpolator_type;
typedef agg::span_subdiv_adaptor<interpolator_type> subdiv_adaptor_type;
typedef agg::image_accessor_clone<pixfmt> source_type;
interpolator_type interpolator(m_quad.polygon(), g_x1, g_y1, g_x2, g_y2);
subdiv_adaptor_type subdiv_adaptor(interpolator);
if(interpolator.is_valid() /*&& 1==2*/)
{
typedef image_resample_type<source_type, subdiv_adaptor_type>
span_gen_type;
span_gen_type sg(source, subdiv_adaptor, filter);
sg.blur(1);
agg::render_scanlines_aa(g_rasterizer, g_scanline, m_ElabBuff.m_rb, sa,
sg);
}
m_bTransform = FALSE;
3) I save the buffer with : m_pmap_window.save_as_bmp
4) The resulting image is 72 dpi
Antonio
"Maxim Shemanarev" <mcs...@ya...> ha scritto nel messaggio
news:200...@we......
> Can you explain it more? What do you use to load and save images?
>
>> Hello,
>>
>> How is possible not to lose bitmap resolution during processing?
>> For example if I load a 300 dpi image after processing and saving I
>> obtain a
>> 70 dpi image.
>>
>> Regards
>> Antonio
>>
|