c++ - BitBlt issues with Memory DC created from printer DC -
i have issue fix made allow flood filled object printed...
so, full story using windows gdi floodfill function, noticed doesnt work on printers, found on inet, create memory dc, compatible printer dc, , make drawing operations on memory dc, , bitblt @ once printer dc (i had change use recursive, color replacment flood fill function too, since memory dc allows main dc did)
the problem memory dc seems pixel or 2 bigger on x , y, dont know do, when selected bitmap memory dc, shows correct size, use stretchblt, values have access use params stretchblt, make no different calling bitblt
let me know if need more info...
thanks in advance!!!
heres code:
hdc hmemprndc = createcompatibledc (hprndc); hbitmap hbitmap = createcompatiblebitmap (hprndc, iwidthlp, iheightlp); hbitmap holdbitmap = selectbitmap (hmemprndc, hbitmap); // paint whole memory dc window color hbrush hbrush = createsolidbrush (getsyscolor (color_window)); rect rect; // add 1 right , bottom, fillrect doesnt include right , bottom edges setrect (&rect, 0, 0, iwidthlp + 1, iheightlp + 1); // note: im doing cause starts out black fillrect (hmemprndc, &rect, hbrush); // delete object deletebrush (hbrush); // // movetoex, lineto, ellipse, arc, textout, // setpixel, etc calls on hmemprndc here // // copy memory dc drawing data printer dc bitblt (hprndc, 0, 0, iwidthlp, iheightlp, hmemprndc, 0, 0, srccopy); // select old bitmap, , clean objects selectbitmap (hmemprndc, holdbitmap); deletebitmap (hbitmap); deletedc (hmemprndc); hmemprndc = null;
update (sept 5):
here link pdf print draw straight printer dc: hprndc.pdf
and here same draw memory dc bitblt printer dc: hmemprndc.pdf
now, did enable recursive flood fill function on second, show example of trying achieve, same without it, not issue
as can see, bottom , right edge cut off, i'm concerned differences in font & line weight between two, not as sizing mismatch
note: filename printed @ top doesn't go through memory dc, drawn straight printer dc
i found solution problem, more of work-around, achieved desired results...
i used memory dc go between on items needed recursive flood fill (getpixel , setpixel), draw them first memory dc, copy on printer dc , draw else straight printer dc, seems work fine
thanks help!
Comments
Post a Comment