Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7886551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:20:48+00:00 2026-06-03T05:20:48+00:00

I just experimented a bit with Javascript and HTML5 canvas and when I saw

  • 0

I just experimented a bit with Javascript and HTML5 canvas and when I saw it in my browser (chrome) I realised that it’s not very pretty rendered. After that I saw it in the Internet Explorer and there it looks even more crawful. I made a little Example: http://ios.xomz.de/
I just declared the canvas object in the html code

<canvas id="mycanvas" width="1000px" height="600px"/>

and rendered into it with

var canvas = document.getElementById("mycanvas");
var context = canvas.getContext("2d");
context.beginPath();
context.rect(200, 200, 600, 200);
context.lineWidth = 5;
context.strokeStyle = 'black';
context.stroke();
context.font = "40pt arial";
context.fillStyle = "black";
context.fillText("Hello World!", 220, 380);

for example.

Can you explain why the rendering isn’t good ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T05:20:50+00:00Added an answer on June 3, 2026 at 5:20 am

    This problem is related to the way objects are drawn on a float based grid (especially vertical and horizontal lines and thus rects).

    See there for an explanation and a schema : http://canop.org/blog/?p=220

    Depending on the size of your objects, you need to use integer or mid-integer coordinates and sizes for your shapes, the goal being to fill complete pixels in both dimensions.

    For example :

    • use a mid-integer for a thin line (one pixel width)
    • use an integer coordinate for a 2 pixels wide line

    (and extend the logic for rects)

    In your case, with a line width of 5, you have sharper rects by using this :

    context.rect(200.5, 200.5, 600, 200);
    

    Demonstration here : http://jsfiddle.net/dystroy/TyNBB/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was just trying out some code, not a experienced coder. I implemented(at least
Just wondering if the following is considered to be good programming practice or not?
Just to make sure I'm understanding shallow copies of reference types correctly and that
Just switched over from eclipse to vs 2008 for debugging javascript, i feel more
I have this very simple (yet big) code that doesn't work. The triangle doesn't
I've been adding quite a bit of javascript to my pages lately, but have
I have experimented with a technique that involves a web page request which you
I'm not very experienced with subjects such as Concurrency and Multithreading. In fact, in
I am just playing around with Go and do not yet have a good
I'm not very experienced in JSP. I have an application, which uses the Spring

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.