Sponsored Content
Full Discussion: [ C++ ] Drawing Program.
Top Forums Programming [ C++ ] Drawing Program. Post 302152850 by porter on Friday 21st of December 2007 02:24:33 PM
Old 12-21-2007
Your page, as far as I can see only has a width and a height.

No storage for the representation of the page itself.

Code:
class Page
{
.....
char *pagedata;

       Page(....)
       {
            pagedata=new char[width*height];
       }

       ~Page()
       {
            delete pagedata;
       }

       plot_character(int x,int y,char c)
       {
            pagedata[(y*width)+x]=c;
       }

       void print_page()
       {
             int y=0;
             char *p=pagedata;
             while (y < height)
             {
                   fwrite(p,width,1,stdout);
                   fprintf(fp,"\n");
                   y++;
                   p+=x;
             }
       }
};

 

5 More Discussions You Might Find Interesting

1. Programming

Line-drawing character!

Hi guys, I'm trying to make my program to print out tables usings line-drawing character (alternate char. set) with Curses Library. However, it always prints out control characters (^@) instead of the correct ones. code example: mvwaddch(my_window, 23, 12, ACS_RTEE); appreciate your help,... (5 Replies)
Discussion started by: zecoj
5 Replies

2. Shell Programming and Scripting

Drawing

Hi, Is it possible to draw circle, box and other basic shapes using shell scripts ? If so can anyone please tell as how to do it. Thanks in advance. (3 Replies)
Discussion started by: abrd600
3 Replies

3. Programming

problems with drawing in x using xlib

Hi all, I'm currently learning xlib and I've encountered a bizarre mistake: function calls such as XDrawPoint, XDrawLine, etc., don't seem to work; a blank window with nothing in is appears. I believe this has something to do with the window manager I use, fluxbox. After checking the code and... (0 Replies)
Discussion started by: hydronium
0 Replies

4. Post Here to Contact Site Administrators and Moderators

Question Regarding Megabits Drawing

Dear Admins / Mods, I have been trying my luck with Megabits Drawing few times ;) but I am not sure how it works! :confused: http://i49.tinypic.com/2ake15f.jpg I have few questions:- Why this page for me is still showing 3 Lotto & 4 SuperForumLotto purchased even after the drawing... (22 Replies)
Discussion started by: Yoda
22 Replies

5. UNIX for Advanced & Expert Users

Server room drawing software

Hello All, I want to get ride of Excel/word and want some software to draw my server room racks/server and overall topology. Please share you opinion/experience. thanks inadvance (1 Reply)
Discussion started by: Vit0_Corleone
1 Replies
CAIROIMAGESURFACE(3)							 1						      CAIROIMAGESURFACE(3)

The CairoImageSurface class

INTRODUCTION
CairoImageSurface provide the ability to render to memory buffers either allocated by cairo or by the calling code. The supported image formats are those defined in CairoFormat. CLASS SYNOPSIS
CairoImageSurface CairoImageSurfaceextends CairoSurface Methods o public CairoImageSurface::__construct (int $format, int $width, int $height) o publicstatic void CairoImageSurface::createForData (string $data, int $format, int $width, int $height, [int $stride = -1]) o publicstatic CairoImageSurface CairoImageSurface::createFromPng (string $file) o public string CairoImageSurface::getData (void ) o public int CairoImageSurface::getFormat (void ) o public int CairoImageSurface::getHeight (void ) o public int CairoImageSurface::getStride (void ) o public int CairoImageSurface::getWidth (void ) Inherited methods o public CairoSurface::__construct (void ) o public void CairoSurface::copyPage (void ) o public void CairoSurface::createSimilar (CairoSurface $other, int $content, string $width, string $height) o public void CairoSurface::finish (void ) o public void CairoSurface::flush (void ) o public int CairoSurface::getContent (void ) o public array CairoSurface::getDeviceOffset (void ) o public void CairoSurface::getFontOptions (void ) o public int CairoSurface::getType (void ) o public void CairoSurface::markDirty (void ) o public void CairoSurface::markDirtyRectangle (string $x, string $y, string $width, string $height) o public void CairoSurface::setDeviceOffset (string $x, string $y) o public void CairoSurface::setFallbackResolution (string $x, string $y) o public void CairoSurface::showPage (void ) o public int CairoSurface::status (void ) o public void CairoSurface::writeToPng (string $file) PHP Documentation Group CAIROIMAGESURFACE(3)
All times are GMT -4. The time now is 03:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy