41223108 cp2023

  • Home
    • SMap
    • reveal
    • blog
  • About
  • 倉儲維護
    • s.cycu.org維護
    • windows維護
  • weekly progress
    • w1~4
    • w5
    • w6
    • w7
    • w9
    • w12
      • helloworld
      • GD繪圖程式1
    • W13
    • w15
  • ANSIC
    • 1.
    • 2.
    • 3.
    • 4.
    • 5.
    • 6.
    • 7.
    • 8.
    • 9.
    • 10.
  • NOTE
    • ssh
    • puttygen
  • 國旗練習
    • Thai
    • Laos
    • Bangladesh
    • vietnam
    • Italian
    • Russia
    • Belgium
    • Ukraine
    • Korea
  • 課程評分
  • Brython
  • setup
  • C_lib
  • replit
  • MSD
  • Final
Thai << Previous Next >> Bangladesh

Laos

#include <stdio.h>
#include <gd.h>
#include <math.h>

#define WIDTH 600
#define HEIGHT 400
#define RED 0xCE1126    // Red color
#define WHITE 0xFFFFFF  // White color
#define BLUE 0x0033A0   // Blue color

void drawLaosFlag() {
    gdImagePtr im;
    FILE *output;

    im = gdImageCreateTrueColor(WIDTH, HEIGHT);
    output = fopen("laos_flag.png", "wb");

    // Draw red background
    gdImageFilledRectangle(im, 0, 0, WIDTH - 1, HEIGHT - 1, RED);

    // Draw blue rectangle (symbolizing the Mekong River)
    int blueRectWidth = WIDTH;
    int blueRectHeight = HEIGHT / 2;  // Increase the height
    int blueRectX = 0;
    int blueRectY = HEIGHT / 2 - blueRectHeight / 2;

    gdImageFilledRectangle(im, blueRectX, blueRectY, blueRectX + blueRectWidth, blueRectY + blueRectHeight, BLUE);

    // Draw white circle
    int centerX = WIDTH / 2;
    int centerY = HEIGHT / 2;
    int circleRadius = HEIGHT / 8;  // Adjusted radius

    gdImageFilledEllipse(im, centerX, centerY, circleRadius * 2, circleRadius * 2, WHITE);

    gdImagePng(im, output);
    fclose(output);
    gdImageDestroy(im);
}

int main() {
    drawLaosFlag();
    return 0;
}



Thai << Previous Next >> Bangladesh

Copyright © All rights reserved | This template is made with by Colorlib