C++ :: GetImage Function - Save Other Shapes Except Rectangle?

Jan 11, 2012

GetImage func give up this parameters :

getimage(int left,int top,int right,int bottom,void far *bitmap);

so Getimage save a rectangle shape on *bitmap.

Is it possible that we can save the other shapes except rectangle? circle,or star, or...

View 5 Replies


ADVERTISEMENT

C++ :: Send Rectangle To A Function Which Takes A Rectangle Argument

May 13, 2014

Consider I have a rectangle like this:

Point p1(100,100);
Point p2(300,200);
Graph_lib::Rectangle r(p1,p2);

And also I have a function that takes a rectangle and returns a Point of that, say, top-left corner of that rectangle. For example:

Point N(Graph_lib::Rectangle R1);

My question is that, first, how to send that Rectangle r(p1,p2) to the Point N(Graph_lib::Rectangle R1) function? And then, how to return a Point from that function?

My IDE is visual studio 2012.

View 19 Replies View Related

C++ :: Processing Speed Of Rectangle Intersect Function?

Feb 20, 2014

I'm trying to find the fastest method to find whether or not two rectangles intersect in an effort to streamline my code. I've built this function into a rectangle class I created below.

struct rectangle{
rectangle() :X1(0), Y1(0), X2(0), Y2(0) {};
rectangle(int X1, int Y1, int X2, int Y2)
:X1(X1), Y1(Y1), X2(X2), Y2(Y2) {};

[Code].....

View 3 Replies View Related

C :: Making HTML Shapes

Oct 13, 2014

So basically I have to write a C program that, when opening the html file in a browser, looks essentially like this: (Size, position, color of the shapes doesn't matter so long as I have one of each shape and the box surrounding them. Words up top dont matter either.)

This is what I have so far:
Code:
#include <stdio.h>
#include <stdlib.h>
#define FILENAME ("A4P1.html")
[code]....

Anyways i can get the individual shapes, but I don't know how to get all the shapes to appear at once..

View 6 Replies View Related

C++ :: How To Use Mouse In Drawing Shapes

May 3, 2013

i have to make an application called " paint " in c++ . It should facilitate user to draw different shapes using a mouse. Now the biggest hurdle i am facing is the usage of mouse .. what is the header file for usage of mouse ? i am using visual studio 2010 . the syntax is creating problems ..

View 1 Replies View Related

C/C++ :: How To Draw Shapes Using Loop

Apr 11, 2014

How can I draw thus shape using loop for
0
0 1
0 1 2
0 1 2 3
0 1 2 3 4
0 1 2 3 4 5

Also this shape
1*****
12****
123***
1234**
12345*
123456

View 6 Replies View Related

C Sharp :: Data Save But 2nd Record Doesn't Save

Jan 28, 2015

1st when i fill the things on form then saved in database after saving record when i want add another record it shows an error. after saving it saves new record refresh doesn't work

View 1 Replies View Related

Visual C++ :: Unable To Save File Using Cfiledialog Save As In MFC

Nov 5, 2013

I am trying to develop a GUI using MFC, but I am having trouble using CFiledialog to save a file. The problem is, the file is not getting saved to the folder when I use the CFiledialog. Below is the code I am using.

Code:

CString szFilter = "XNRep Files (*.xnrep)|*.xnrep||";
CString s = "xnrep";
CString t = "";
CFileDialog fileDlg(FALSE, s, t, NULL, szFilter);
if(fileDlg.DoModal() == IDOK)
{
std::ofstream file;

[Code]....

After the file dialog opens up, I enter the name of the file and select OK button. But the file does not show up in the directory I am saving to.

View 4 Replies View Related

C :: Different HTML Shapes With Random Attributes

Oct 21, 2014

This time I need to generate random shapes (circles, rectangles, squares, and ellipses) with random attributes with C, to html.

I am able to create specific shapes with random attributes, but I am unsure how to have the function create a random shape...

Also, the function "box" is meant to create a black border around the shapes. It does this, but I do not know how to make it so that the other shapes do not show up along the lines of this "box."

I guess it appears that certain shapes are "layered" over top of others? ie. My circles/ellipses always show up on top of the rects/squares/box.Currently I have this:

Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define NO_SHAPES 10
#define X_RANGE 797
#define Y_RANGE 397

[Code] .....

View 4 Replies View Related

C++ :: How To Save Callback Function With Its Parameter And Call It Later

Dec 31, 2013

I have a function (name Callback), with take some parameter( name Arg). I want to create it before, pass it to other class ( class B). And in class B, call the Callback function with Arg paramater. It's something like this:

class A {
void A::doSomething(int a, bool b){//dosomething};
void A::setCallback(B b) {//I don't know how to do this};

[Code].....

How can i do this? And what happen with I want B can get more type of callback function, which mean I don't know the type of Callback's paramater?

View 7 Replies View Related

C++ :: Calculate Surface Area Of Various Shapes - Symbolic Constant For The Value Of PI

Mar 2, 2013

This error keeps coming.

******************************************************************
CSCI 240 Program 5 Part 2 Spring 2013

Programmer:
Section: 1
Date Due: 3/1/13

Purpose: This program uses functions to calculate the surface area of various shapes. It is an exercise in learning to write functions.
******************************************************************/

#include <iostream>
#include <iomanip>
using namespace std;
#define PI 3.14
//Symbolic constant for the value of PI

int Menu();
int getValue( string prompt, int lowerBound, int upperBound );

[Code] .....

View 10 Replies View Related

C/C++ :: Application To Calculate Area And Perimeter Of Geometric Shapes

Oct 18, 2013

How would this look like in C? Develop an application to calculate the area and perimeter of geometric shapes. First the user is asked to enter a letter representing the shape. We use C for circle, R for rectangle and S for square. After the user chooses the shape, the program prompts for the appropriate dimensions of the shape accordingly.

For instance, if the user has chosen a square, the program will ask for a side. If it's a circle, the program will ask for radius. If it's a rectangle, it will ask for length and width. Upon receiving the appropriate dimensions, the program will calculate the area and the perimeter of the requested shape and print it on the screen. And again, the code will ask for another letter. If the user enters 'Q' the program terminates.

Please Enter Shape (C: Circle, S: Square, R: Rectangle Q:quit) >S
Please enter the side of the square > 8
The area is 64 and the perimeter is 32
Please Enter Shape (C: Circle, S: Square, R: Rectangle Q:quit) >R
Please enter the width of the rectangle > 5
Please enter the length of the rectangle > 7
The area is 35 and the perimeter is 24
Please Enter Shape (C: Circle, S: Square, R: Rectangle Q:quit) >Q

View 1 Replies View Related

Visual C++ :: Fill Color In Shapes Using FLTK Doesn't Work For Circles

Aug 28, 2014

I installed FLTK 1.3.X from [URL] on my visual studio 2012 compiler and use PPP book for C++ programming [URL]. My problem is about filling a Shape in.

Code:
#include <Simple_window.h>
using namespace Graph_lib;
int main() {
Simple_window win(Point(100,100), 1000, 600, "Binary_tree");
Graph_lib::Circle c(Point(200,200),50);
c.set_color(Color::red);

[code]....

When I run the program, All three Shapes are drawn on window but only the Rectangle is filled in! Why? set_color works for the three and apparently the set_fill_color is defined for all Shapes and it too should work but why it doesn't for Circle and Ellipse?

This [URL] is the .CPP and .h files ( )

View 6 Replies View Related

C/C++ :: Put A Number In Rectangle?

Oct 4, 2014

the code draws rectangle or square it depends on you (column,row) then, put number in the center of the rectangle i don't want to extra space after putting one,two,three or four digits number in the center of the rectangle

#include <stdio.h>
int main(){
int i,j;

[Code]....

View 3 Replies View Related

C++ :: Algorithm To Roll A Rectangle

Sep 17, 2014

I'm trying to draw and pivot a rectangle. How to get the new coordinates if I turn it 90 degree for example?

From this:

To this:

This is not good because it will reduce it in size.

Code:
int size = 50;
if(b) // draw rectangle
{
POINT points[4] =
{{xCoord, yCoord},

[Code] ....

View 7 Replies View Related

C :: Printing A Rectangle Using For Loops?

Jan 27, 2015

I'm trying to make a program that prints a rectangle using "*" asterisks. I am only allowed to use "for loops" and I simply cannot get this to work properly. Here is my code so far...

Code:
int main(void)
{
//RectangleSize represents the area of the rectangle(width*length)
int length, width, RectangleSize;

[Code].....

View 5 Replies View Related

C++ :: How To Create A Rectangle With 3X5 Dimension

Nov 2, 2013

I am trying to create a rectangle with 3*5 dimension which would look like:

#####
#####
#####

I wanted to use for, and do while loop for that programming. I couldn't been able to create my desired dimension of 3*5.

//complier directives
#include<iostream>
#include<cstdlib>
using namespace std;
//main body
int main () {
//local identifiers
//complier directives

[Code] .....

View 5 Replies View Related

C++ :: Representing A Rectangle With Only 3 Variables Instead Of 4

Apr 6, 2013

how to use 3 variables to represent a rectangle in a grid instead of using 4. The traditional way is to use (x,y) (x2,y2). I propose using (x,l,h).In the traditional way as you probably know, (x,y) is the left op most corner, and (x2,y2) is the bottom right most corner. In the way I am proposing X is the left side, l is the length of the top side, and also the length of the bottom. 'h' is the height of the left and right. I think it's obvious how these three can define a rectangle same as the four.

View 2 Replies View Related

C# :: Indexing Through Rectangle List?

Mar 11, 2014

I have having trouble looping through the list in the update section to update each object in the rectangleList. I am not sure how to format it because it is only drawing one and it does not move across the screen. I thought this section of code would work and loop through each object and make each one move but it does not.

for (int i = 0; i < rectangleList.Count; i++) {
enemyPosition = new Rectangle(rectangleList[i].X + 2, rectangleList[i].Y ,enemyPosition.Width,enemyPosition.Height);
} List<Rectangle> rectangleList;
protected override void Initialize() {
rectangleList = new List<Rectangle>();

[code].....

View 5 Replies View Related

C++ :: How To Assign A Rectangle To Images

Apr 26, 2012

I am making a game Pong, and have been struggling with the collision aspect between the baal hitting off the paddle. I have created a Class, to draw a rectangle, to work with collision however I dont know how to assign the rectangle to the images of the ball and paddle.

#include "stdafx.h"
#include <iostream>
#include <time.h>
#include <vector>
#include <cmath>
#include "gwin.h"
const int NUMBEROFBALLS = 1;

[Code] .....

View 1 Replies View Related

C :: Produce A Rectangle Out Of Asterisks Using While Loops

Jan 30, 2015

I am new to C and am unfortunately racking my brain against this simple assignment. I believe the task is to produce a rectangle out of asterisks using while loops, yet I can only produce an "L" shape. We were given a code, with syntax errors included.We are to correct the errors and test.

Code:

#include <stdio.h>
/*Houghton, Micah*/
/*ET2560 - Cordova*/
/*Unit 5 Lab - Programming Loops*/
int main(void) {
int length, width;
int lcount, wcount;

[code]....

View 3 Replies View Related

C++ :: Calculate Area Using Rectangle / Trapezoid Or Both

Feb 17, 2014

#include <iostream>
#include <cmath>
using namespace std;

//prototypes for all separate functions
int chooseFunc(int);
int chooseMethod(int);
int numRect(int);

[Code] .....

It seems that my program will ask the user for the number of rectangles and trapezoids but will fail to compute the area under the curve from the user input. Therefore, I believe I have a logical error somewhere or I'm forgetting to call something somewhere.

View 1 Replies View Related

C++ :: Detect Colors In The Black Rectangle?

Oct 5, 2013

I want to detect colors that in the black rectangle. [URL] How can I do? What library should I use?

View 7 Replies View Related

C++ :: Drawing A Rectangle And Diamond Using Recursion?

Oct 23, 2013

write a code that draw a block and diamond each in a single run by using '*' in recursion.

Below are one 10X10 rectangle and 6X4 diamond.

**********
**********
**********
**********
**********
**********
**********
**********
**********
**********

**
* *
* *
* *
* *
* *
* *
* *
**

Note: I couldn't write the diamond here appropriately somehow.

View 1 Replies View Related

C/C++ :: Subtracting Area Of Two Circles From A Rectangle

Mar 31, 2015

[URL] .... This is what I have so far, and it isn't incorrect, but how to improve this or make it more accurate?

// subtracting the area of two circles from a rectangle
#include <iostream>
using namespace std;
int main() {
cout << "This program is designed to calculate the area of a rectangle, to exclude the area of 2 circles that have been placed inside of the rectangle." << endl << endl;

[Code] .....

View 12 Replies View Related

C/C++ :: How To Use Rectangle Height And Width In Functions

May 13, 2014

The problem says:

Define functions n(), s(), e(), w(), center(), ne(), se(), sw() and nw(). Each takes a Rectangle argument and returns a Point. These functions define connection points on and in the rectangle. For example, nw® is the northwest (top-left corner) of a rectangle called r.

I wrote below code for that:

#include <Simple_window.h>
Point n(const Graph_lib::Rectangle& r);
Point s(const Graph_lib::Rectangle& r);
Point e(const Graph_lib::Rectangle& r);
Point w(const Graph_lib::Rectangle& r);
Point ne(const Graph_lib::Rectangle& r);
Point se(const Graph_lib::Rectangle& r);

[Code]...

As you see, this just mark the top-left corner of the rectangle r. In other functions I need the specifications of that rectangle, for example its height and width. How to use these specs in those functions?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved